Alfredo Fernández
Alfredo Fernández

Reputation: 200

First request is very slow after website sits idle with Asp.net mvc IIS6

I have a project in asp.net mvc, my hosting is using IIS6, and the first request after the website sit's idle is very slow. I looked at, http://forums.asp.net/t/1418959.aspx and asked the hosting for this settings. They say that the actual settings are:

"The pool is set with Idle Timeout disabled, Rapid-fail enabled and with a single worker process."

But still slow at the first request. Do you have any other clues?

Thanks in advance,

Alfredo

Upvotes: 12

Views: 7197

Answers (3)

Jeff Hardy
Jeff Hardy

Reputation: 7662

You are probably a victim of worker process recycling. Ask your host how often the worker processes are recyled.

When a worker process is recycled, it has to recompile and restart the entire web application, and that's what causes the slowdown.

Upvotes: 8

driis
driis

Reputation: 164341

Just a guess, but perhaps you are caching some data, that needs to be refreshed after the site has been idle for some time ?

If this is not the case, then my guess would be that the worker process has been shut down for some reason (it could be for some other reason than the idle timeout in IIS). If you need to check whether this might be the case, you could add some code to the Application_Start event that logs the startup event to a file or whatever logging you have in place. After some time in operation, you can examine the logs and see, how many Application_Start events has occured.

Upvotes: 2

user1228
user1228

Reputation:

This is natural.

IIS is often configured to shut down the website if it's a certain age or if there hasn't been a request in awhile. Your website has to be loaded (and possibly compiled) when the first request comes after asp.net has been shut down by IIS.

The common solution is to precompile your website before publishing it to the server.

Upvotes: 6

Related Questions