views:

563

answers:

2

When i recycle the application pool for my web app via IIS MMC, the first user to request a page within the webapp will experience a really slow response from the site. After that initial request, every page there after is fine. The user could also log off the site, come back later and the speeds are quick. My concern is with the first, initial load of the site. If i were to write a script to restart the application pool at 3am in the morning, what else can i do to either

a.) impersonate a user visiting the site and getting that initial slow load to happen, thus making the app "ready" for the users in the morning.

or

b.) tell the app pool to spool up the memory and such without a user having to initiate this process.

A: 

Everything happens on the first load of the site. The only thing you could do is simulate a request to the website after recycling. This can be done with a simple application. The easiest way to do this in .NET would be to use the HttpWebRequest class.

Matt Kellogg
A: 

First, you don't need a script to recycle the app at 3 AM. The app pools have settings to choose when they recycle. By default, I think they recycle every 29 hours, which is an odd setting and I recommend changing it. Otherwise, you'll get calls claiming lost sessions at random times of the day.

I must assume you have an ASP.NET application in the app pool in question. Upon first request, the delay is mostly due to the ASP.NET worker process needing to compile a Web site and/or load DLLs required at runtime. To solve this issue, most use a keep-alive task which can make regular requests to the site to ensure that it is fully loaded. Matt's suggestion is also a good one, but will only solve the issue when you are recycling the app pool yourself. App pools can recycle on their own for any number of other reasons and the keep-alive will be able to keep things loaded most of the time.

Sumo