Application pool recycling – The not so obvious reason

If your application pool is recycling for no reason, it could be a problem for your visitors because the loading time of your webpages will be increased. Nobody likes slow websites and this can discourage people from coming to your site and this is why you need to fix the problem as soon as possible.

On one of my sites hosted on a Windows 2008 R2 server, I’ve got a dedicated app pool for a website. However I’ve noticed that the application was recycling quite often and this impacted the load time of the website. When any page from the website is loaded for the first time, the web app does a number of things including caching of certain data and loading some necessary classes for it to function properly. This needs to be done only once and any further HTTP requests should be fast from then onwards.

Drilling down into the problem, I found that the application pool has a default timeout setting of 20 mins. This means that if no requests are made within 20 mins, the app pool will be shut down. This is only good if you have a lot of app pools running and running low on memory. However for a low traffic site where you don’t necessarily have visitors within every 20 min interval, your app pool will recycle and the next visitor that you get will see the page load really slowly because startup methods are being called by your web app. To prevent this from happening, you need to set the Idle Time-out (minutes) property in the app pool to zero (0).

You should also set the Regular Time Interval (minutes) to 0 to avoid your application from recycling at specific period of times. It’s also a good idea to enable Event logging for when your application pool is being recycled so that you can easily know if there’s any problem with your website.

comments powered by Disqus