It seems that my asp.net sites on my web server are very slow to load if they have not been accessed in a while.
Does the ASP.NET processor go into suspend or sleep mode if it has gone unused for a period of time?
Is it better for me to fix this by configuring ASP.NET or writing some program to visit my sites every so often to keep it awake?
Depending on your configuration the Application Pool assigned to your ASP.net application the AppPool will recycle at a certain time of day, or after a certain number of requests. Once this happens it forces ASP.net to recompile the site. There is a good overview on ASP.net compilation on MSDN.
There are also several questions on StackOverfolow:
- Are ASP.NET Web Site projects inherently slow at compiling, or could I have deeper issues?
- Precompilation and startup times on ASP.Net
- What causes an application pool in IIS to recycle?
There are two steps that I use to make this better:
- If possible try to avoid recycling the application pool at a time that someone is going to be using the site. You should be able to identify this by using Google Analytics or another traffic logging package.
- Setup something to hit your website shortly after your Application Pool has recycled, I use PolyMon extensively for my on-site servers, so I have a monitor that checks the site is healthy every 5 minutes which does this job for me. I have used SPWakeUp for SharePoint sites, which could probably be adapted for any ASP.net site.
As an example, if you were able to identify that your site is rarely used at 0200 you could configure your Application Pool as follows (IIS Config -> Right Click the AppPool -> Click “Recycling…”):
The above dialog is from Windows 7, however I don’t think the dialog has changed vastly between Windows 2008 and Windows 7/2007 R2.