views:

434

answers:

7

Hi,

Every now and then (always after a long period of idle-time, e.g. overnight) when I access a site built using asp.net - it takes around 15 seconds to load the page (15 seconds before I see any progress whatsoever, then the page comes up fast).

Further pages on that site, or refreshes, are quick as usual - they are also fast on other machines, only the first one seems to take the 'hit'.

Page tracing never through anything up (whole cycle was a fraction of a second)

So my question is where else should I be looking? Perhaps IIS? Or could it still be my asp.net app and I'm just looking in the wrong place (the trace) for clues?

As I don't have much control over the IIS server, anything I can check through asp.net would be more helpful, before I go ask that particular admin.

cheers :D

+3  A: 

You can schedule the recycling of the application pool, possibly using a warm-up script. Give it its own application pool first and see if that helps.

IrishChieftain
@Taboloo - Use a warm up script on the application pool. If you're application is large and/or takes up a lot of memory/cpu space, then make sure you configure your pool settings to handle this extra load.
Joel Etherton
+6  A: 

The IIS application pool is shut down after 30 minutes of inactivity. After that, when you make a request IIS basically has to start the website up again, which leads to the behavior you are describing. You can change the idle time of your website in iis though to avoid it.

klausbyskov
I would go with this answer. Usnless you are short on system resources you can just increase the timeout value.
modernzombie
Thanks to klausbyskov and all the other help - much appreciated. I know exactly where to look now :)
Tabloo Quijico
+1  A: 

I've encountered the same problem in the past. I never managed to get to bottom of the problem, but I suspected that the IIS application pools were the culprit.

madman1969
+1  A: 

Futhering the answers that noted IIS will shut down an idle, as your site comes back up your Application.OnStart will fire (within your global.asa) If you are doing a lot of work here this may slow your application. Other things going on all your caches will be empty, all your DB connection will be disconnected.

This behaviour is configurable in IIS, if you do not have access to the IIS settings a hacky way around this is to hit your site every 10 minites either from a script or a special page that has a meta refresh.

Your other option is to accept that the first page hit of the day will take a few seconds longer then usal.

David Waters
+2  A: 

You could also look into the Auto-Start feature of the 4.0 framework.

Trevor
A: 

I have faced with this problem and found a kind of way of tackling with it. It has a drawback but can be considered.

http://www.yasarmurat.com/Blog/33/asp-net-application-warm-up-by-using-windows-service.aspx

Regards,

Murat Yasar

Murat Yasar
A: 

If you're using IIS 7 there is an IIS plugin call Application Warm Up that will help

I've written a blog post about my experiences using it here (don't know if i'm allowed to post to my own content?):

http://www.diaryofaninja.com/blog/2010/05/06/keep-your-aspnet-websites-warm-and-fast-247

Doug