Entity Framework 6.1 Slow cold start only when running in Azure Cloud Service

While I have found EF Code First is known to be slow on cold starts after doing many suggestions, I have cold start times down to about 2 seconds locally. I actually have a very simple 6 table \ DbSet model.

Using an on-prem database and after deploying my application in a web role, my cold start takes about 10 seconds. All requests and actions after initial launch, and slower than local ones, are perfectly acceptable.

I have enabled EF logging and see that it takes about 3.5 seconds from the generated DbContext class until I get the "Open connection ..." log entry. The following EF log entry is for my first ready-to-execute SQL statement, which happens about 5 seconds after "Open connection ...".

I can understand 3.5 seconds to open a cloud connection on on-prem (local connection speed -.5), but the next 5 seconds, which is .6 local, is a big inexplicable hit. I pre-compiled the views and even tried the Database First version, but there is always a 5 second gap.

Anyone experiencing this cold start only gets to Azure ..... any ideas?

+3


source to share





All Articles