First request is very slow after website sits idle

2020-03-24 11:37发布

问题:

I developed a project in ASP.Net MVC 3, my hosting is using iis7 (Win Web Serv 2008 R2), and the first request after the website sit's idle (during about 1-2 hours) is very slow.

I use VPS with 512Mb RAM. Can this be related with a too little RAM?

Can anyone help me with possible causes of such behaviour?

回答1:

After a certain amount of inactivity IIS unloads the AppDomain. And then the first request loads the application once again which is slower. You could try to configure this period in the properties of IIS but there might also be other causes that an application unloads such as for example a certain threshold of CPU or memory usage is reached. Those thresholds are also configurable in IIS.

That's not something specific for ASP.NET MVC. It's true for all ASP.NET applications in general.



回答2:

We had also this problem with ruby and passenger that takes the app out of memory after a while, but I found a nice application that fixed this issue for us without changing anything in the server configuration, the app is called wekkars, and you can find it here: http://www.wekkars.com