Reputation: 1590
I'm working on a site that is hosted on our local network at work. It's running ASP.Net 2.0 and IIS6. The site uses master pages and has some code files (C#) for a search utility. There are a few .js files and a couple ajax calls made once the page is loaded.
The site is not very "heavy" at this point and shouldn't take very long to load. For some reason the first time the site is loaded there is a very long delay before anything happens (20-24 seconds). At first I thought it might be the compile time for the site, but I pre-compiled it and there wasn't any difference.
Once visited, the site loads very fast. After a long while (several hours) a subsequent visit will
If it helps, I've included some screen captures from firebug below.
Does anyone have an idea what could be causing the delay or how I could figure out what is going on?
Upvotes: 0
Views: 862
Reputation: 44971
We always see a long lag time on first spin up due to a combination of our internal caching activities, IIS spinning up aspnet_wp, and establishing connections to various databases.
You will probably also see this in subsequent visits if IIS is set to recycle the process after a specified number of seconds, memory threshold reached, or other threshold.
About the only thing you can do about the initial spin up time is carefully trace your application's activity during startup. Pay special attention to database connectivity and caching as we have found this is where the majority of our time is spent.
As for the subsequent visits, we always remove the default recycle time in IIS (which is something like 22 hours) and replace it with a fixed time recycle. It still doesn't help the first request, but at least you'll know when it happens.
If the initial request is really a problem and you can't figure out how to reduce it through code, you could schedule a small .Net exe to run 10 minutes after the recycle time and uses WebClient to hit the site once in order to get the initialization process out of the way.
Upvotes: 1