Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASPX page loads VERY Slowly after 30 minute dormancy

Status
Not open for further replies.

svankley

MIS
Aug 25, 2000
45
0
0
US
I'm developing a website for my "other" business that is using ASP.NET.
Everytime I go to the site after about 30 minutes or so, the page takes 30-40 seconds to load which is unacceptable. Anyway, If I let this page load completely and then go back to the age 10-15 minutes later, it comes right up (even if I clear my local browsers cache). If I wait more than 30 minutes or longer the same 30-40 second delay is noted for the first load and then it loads fine again.
I assume the app is recompiling itself? I am making no changes to the code between these hits.
I heard somewhere that there is a built-in timeout of 15 minutes for the compiled version in ASP.NET so if there are no hits in 15 minutes, the app auto-recompiles itself; is this true? And if so, how can I avoid this? My prospective customers are turning away before the page fully loads. Any help would be GREATLY appreciated!!
BTW, the site is: (watch the huge delay for loading the first time)

Thanks,

Steve
 
Steve - great looking page; I tried to access the image sizes but I see you have Javascript on the click event. Of course, you want to minimize the size of the page and if your images can be made smaller that would be best (I try to keep images on web pages, esp a front end page, to less than 50K total if possible).

You page loaded in 35 seconds over a slooow dsl here in Montgomery; not too bad but as you said over a slow phone line you're talking 45 seconds+.

I see in the Source code you have ViewState active; perhaps if that is not needed you could turn that off; just a thought. Caching doesn't seem to be a solution either as it has a maximum time of 300 seconds.

Perhaps you could "write" the compiled page to the Server and access it instead of recompiling the page - just a thought. I'm sure you'll get a few more opinions on this as the day goes on. Hope you get it solved, this is a great question and I look forward to this solution.

 
You don't get this issue if you are using codebehind as the VB.Net/C# code is already compiled. I would switch to using codebehind if you already haven't. It also makes you code easier to manage as it seperates the code from the presentation i.e. the VB from the HTML.

If that still doesn't provide a great amount of improvement take a look at the page caching options that ASP.Net provides.

James :)

James Culshaw
Read my Weblog at DataAide - a free .Net/VB6 code generator - Read independent miniature reviews at
 
Hi,

Thanks all for the replies. I set Viewstate on to facilitate debugging. I'll turn it off shortly.

The webpage is only ~56k big. The images are ~4k each.

The delay I was referencing was the delay until the page even starts loading. I assume it's due to the timeout/recompile issue referenced by Paul Wilson in his article at
I have alot of users that are not waiting for the page to load due to this delay so I really need to find a solution to this. Maybe I'll create a loader page that simply states something like: "Please wait while your page is loaded", and then preload or auto-foreward them to the page???

Thanks again for the help,

Steve
 
Do you make a database hit on page load? If so, revise the SQL and see if it causes the delay. If you use DataSet(s) for some data binding, see if you can substitute them with DataReader, which is forward only and less expensive.
 
The article you linked to was a dead link when I tried it, but I'll contribute more info just in case the page didn't mention it.

When an ASP.NET application starts (upon the first request), the application compiles itself (by default), then stays compiled for the lifetime of the application (until the last active user's session times out). This likely accounts for some of the delay you're experiencing.

To help with the delay, you can pre-compile the app with the command line compiler if you wish to kill said delay. To do so (in C#) simply go to the application's root directory and use:

csc /t:library /out:bin\YourSolutionName.dll YourPageName.cs

...and remove the "Src=YourPageName.cs" attribute from the @Page directive. Of course, the output should end up in the bin directory.

It's more difficult to roll out changes given the above approach, but it should speed things up a bit.
 
PS- I love the selection. Garfield, Rugrats, Hello Kitty, and... Rocky Horror Picture Show [lol]
 
Thanks all for your insight and comments about this challenge and also about my site - THANKS!!!
I particularly like the sugestions about turning off viewstate (i forget how expensive that was) and about pre-compiling.
I just don't understand why asp would want to recompile after the time-out if the page(s) code hasn't changed, If all the dynamic data is in the database, what is the basis for this recompile??
Anyway, I'll give these ideas a shot and let you all know what I find.

Thanks again,

Steve
 
I would suggest against turning off viewstate. That's how .net persists object properties during postbacks. Besides, your viewstate is really small.

My site ( uses viewstate and it's size is comparable to yours. I have never experienced performance hits due to using it.

Your applications should definitely be pre-compiled. Stay away from inline code (code in the html pages) wherever possible. Use code-behind. Compile your applications and deploy them properly.

(deployment with Visual Studio.net)
(commandline deployment)

-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
Just to throw the obvious out, have you checked the webserver to make sure it's not using any manner of power saving?

I had a similar problem with a site a while back and turned out some genius had set the drives to spin down after 30 minutes, which caused an initial hit to the page to take quite a while.
 
Thanks for all your thoughts. GREAT comment Moebius01! I've been called to St. Louis for emergency service so I'll be back this Friday. I'll let you all know how the suggested changes went.

Thanks again so much,

Steve
 
Problem, I set Viewstate to false as suggested on the main page (index.aspx) and now when a user hits the "buy" button on the details screen they get an error! The strange thing is, the "buy" buttons WORK on the main page and on the categories pages but when you go to the details page for a charm and click the "buy" button you get an error:

************ SNIPPET ************
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 217: End If
Line 218:
Line 219: Response.Redirect(Application("ApplicationPath") & "/storemodules/addtocart.aspx?productid=" & productId & _
Line 220: "&qty=" & ItemQty & _
Line 221: "&opt=" & OptGroupDDL.SelectedItem.Value.ToString())

************ END SNIPPET ************

Any ideas why this is happening after that change??

Thanks in advance,

Steve
 
Ahh, I just realized why it's not working. I was having a heck of time directing the user from the addtocart user control page back to where they clicked in from so I used the viewstate to store it and that worked. But now that the viewstate is off that solution won't work. You can see all the other things I tried to no success in the code. Can anyone suggest an alternative to the code below. It is most important to speed up the initial hit on the page, so I want to be able to turn Viewstate off. Here is the code (including my test junk):

*********** SNIPPET ***********

Sub AddToCartBtn_Click(ByVal sender As Object, ByVal e As ImageClickEventArgs)
Dim _context As HttpContext
'HttpContext.Current allows us to gain access to all
'the intrinsic ASP context objects like Request, Response, Session, etc
_context = HttpContext.Current
Dim ItemQty As Integer = 1
ItemQty = CType(ItemQtyField.Text, Integer)
If (ItemQty <= 0) Then
CompareValidator.Text = "Quantity must be 1 or greater." 'ItemQty = 1
CompareValidator.IsValid = False
Exit Sub
End If

'If Not IsNothing(_context.Request.Url) Then
' 'set original url if not set
' setOriginalURL(_context.Request.Url.ToString)
' _sessionURL = _context.Request.Url.ToString
'End If

'Save the URL

If Not IsNothing(_context.Request.UrlReferrer) Then
'set original referrer if not set
'setOriginalReferrer(_context.Request.UrlReferrer.ToString)
'_sessionReferrer = _context.Request.UrlReferrer.ToString
ViewState("ReferrerUrl") = _context.Request.UrlReferrer.ToString 'Request.UrlReferrer.ToString()
End If

Response.Redirect(Application("ApplicationPath") & "/storemodules/addtocart.aspx?productid=" & productId & _
"&qty=" & ItemQty & _
"&opt=" & OptGroupDDL.SelectedItem.Value.ToString())
End Sub


************ End SNIPPET *************

Thanks again so much for the help!!

Steve
 
FYI culshaja, it is using code-behind. Thanks for the idea though.

Steve
 
The slowness that you are talking about is talked about a lot on other sites and that is that the site is no longer in memory on the web server and must reload from scratch... modules such as KeepAlive have been created to keep the site "active"... others have created pages in their project that have auto-refresh set and you leave that page open on a pc etc... but yes there is a dramatic performance hit initial when you site hasn't been hit for a while...
 
Thanks for the suggestions: do you have a site to get this "Keepalive" module?

Thanks,

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top