r/ASPNET • • Feb 18 '13

Application_ResolveRequestCache() taking 10 seconds on first call after Application first starts?

I am using RackSpace hosting for my ASPX WebApp and I noticed that, if the site is not accessed in a while, the first pageload can take upwards of 10-15 seconds. After that, subsequent requests load really fast, until there is again a longer pause between them.

I put timestamp logging in all the Global.asax function and here's what it reveals (in miliseconds): Applicaton_BeginRequest[0], Application_AuthenticateRequest[16], Application_ResolveRequestCache[16], Session_Start[11216], Application_AcquireRequestState[11216] ...

So it seems between ResolveRequestCache and Session_Start it takes about 11 seconds! Like I said, this only happens when the website has not been viewed for a while. What's going on? Is my application building the initial cache on first request after it starts? Is 11 seconds normal or is my code that horrible? Is it an issue on my end or my webhost?

FYI: Log confirms Application_End() gets called after x seconds of inactivity and then Application_Start(), followed by the lengthy first pageload, then normal fast pageloads

3 Upvotes

3 comments sorted by

View all comments

Show parent comment

1

u/BohemianDre Feb 19 '13

I have a website on shared hosting and I do the same... I have a simple windows service that does 2 things actually:

  1. Connects to our database (also on a shared server), select getdate() simply to time the response, disconnect
  2. Uses a webclient object to make a few simple http gets.

The result (success or failure) and time it took to carry out the action is recorded in a small database running on the same box as my monitoring service. It helped alleviate this issue you are seeing.