Establish a connection to SQL in 10 - 15 seconds

We have some weird performance issues, and I was hoping someone could point us in the right direction. Our script is a ASP.NET MVC C#website using EF4 POCOin IIS 7(high-size servers, designed for this application only).

Obviously, this is slower at application_startup, which can be expected, but as soon as you download, you can navigate the site and everything will work fine and quickly load pages for 0.5 ms (we use Mini-Profiler). Now, if you stop using the site for, say, 5-10 minutes (we have the application pool recycling set for 2 hours and we register so that we know that it has not been recycled), then loading the first page is ridiculously slow, 10 - 15 seconds, but then you can move again without problems (0.5 ms).

It is not SQL queriesthat slow, since all requests work fine after the first page, even if they are not already running, and are also not cached anywhere.

We conducted a huge number of tests, and I can not understand this. The main thing I've tried so far is to pre-generate EF views, but that didn't help.

It seems that after viewing Sql Server Profilerafter 5 minutes, enter or take 30 seconds without activity in the Sql Server Profiler and without interacting with the site for the application, several “Audit Logout” entries will appear, and as soon as this happens, then it seems to take 10 - 15 seconds to update the application. Is there any waiting time on Sql Server?

+3
source share
7 answers

This should work if you use below in the connection string:

server=MyServer;database=MyDatabase;Min Pool Size=1;Max Pool Size=100

. , ( ), .

+4

LMHOSTS? . LMHOSTS 10 . , 10 , , LMHOSTS, .

+2

, Sql Server Profiler 5 , 30 Sql Server Profiler " " , , , , 10 - 15 . Sql ?

, , , SQL- / , . SQL- , SQL . , , ( ), . / SQL.

/dev , SQL-, ? , , .

+1

" SQL Server" SQL Server , 5-10 . . , , ApplicationName "EntityFramework...". , EF . , EF ( - sessionState web.config)

0

-, SQL Server "Select getDate()" . , ​​ Pingdom , 30 . .

0

Try overwriting the timeout in the web.config file, as in this example:

Data Source=mydatabase;Initial Catalog=Match;Persist Security Info=True
;User ID=User;Password=password;Connection Timeout=120

If this works, this is not a solution. Just work.

0
source

All Articles