Solved

ASP.NET pages slow to load for first time

Posted on 2004-09-20
39
700 Views
Last Modified: 2008-02-01
I have a number of aspx pages that use forms authentication.

When a page is accessed for the first time, it takes between 10-20 seconds before loading the page. Then that page will work fast as long as someone hits it within a certain amount of time.  I know this has to do withthe JIT compiler.

How can I get rid of this delay forever?  
Is there a setting that can cause all compiled pages to stay in memory? Or can I easily pre-compile all of the pages?

I need options!!!

Thanks.
0
Comment
Question by:gozoliet
  • 17
  • 6
  • 6
  • +2
39 Comments
 
LVL 4

Expert Comment

by:tekchic
ID: 12102070
Hi gozoliet,

What I do for clients is when those pages are published, I go out there and personally hit each one so they compile.  Then after that they're set and the client just sees that they load the way pages normally do.  Others may have some ideas for you, but it's what I've done in the past to "precompile" the pages.  Hope this helps.

.: tekchic :.
0
 
LVL 4

Expert Comment

by:tekchic
ID: 12102085
There are also programs that can hit web addresses for you, what you could do is set up a load script and have it hit the pages you need refreshed automatically.  I can't remember what the software's called, but I think it's something like "WinRunner".  You can also set schedules so it'll go and do this periodically.
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12102094
Part of the slow down could also come with caching on the initial visit, which cannot be avoided.  As long as you hit the pages first, thats about all you can do.

Regards,

Aeros
0
 
LVL 28

Accepted Solution

by:
mmarinov earned 500 total points
ID: 12102102
Hi,

with asp.net v 1.1. you can not rid of this :( but it is correct in asp.net 2.0 and visual studio 2005 and the delay will no longer exist

Regards,
B..M
0
 
LVL 4

Author Comment

by:gozoliet
ID: 12102133
Can't wait for 2.0!

I would have to log in each morning and access all XX pages so that it runs fast. Ugh.

How about a script that works with forms authentication that I could setup as a scheduled task and have it run every hour to keep the pages alive? Anyone have one of those?
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12102260
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12102277
You could also create a macro to do this:

http://www.iopus.com/guides/winscheduler.htm

0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12102283
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12102287
Heres a good list of apps to do this:

http://lists.gpick.com/pages/Task_Scheduling.htm

0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12102289
many of which are free;)
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12102297
let me know when you've had enough lol
http://www.theabsolute.net/sware/#tasksched
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12102316
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12102324
0
 
LVL 4

Expert Comment

by:tekchic
ID: 12102334
Here's a thought, put them all in one reply.
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12102344
naa, lol
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12102352
I post them as I find them, if not someone else will before you submit, you learn these things the hard way.

Regards,

Aeros
0
 
LVL 4

Expert Comment

by:tekchic
ID: 12102407
Technically he is asking a second question within this first one..... but oh well :)
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12102443
lol when does anyone just ask one question here
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 25

Expert Comment

by:nauman_ahmed
ID: 12102494
gozoliet,

It seems that you are using inline code for asp.net pages. The problem with the inline code is that it has to be compiled everytime a new request is generated for this page. Do you use VS .Net to create your pages and codebehind so that it is compiled in the DLL format and runs faster than the inline code? Actually VS.Net makes your life easier but you can also compile your files without the need of vs.net. Have a look at the following tutorial for more information:

http://www.asp101.com/articles/john/codebehindnovs/default.asp

One thing more is that after making changes and compiling your files, when you hit your asp.net page first time, it will run slowly but will be ok after that and you will not need to browse the pages every morning as you are doing now ;). This will happen only when you compile your files, restart your IIS, or update the web.config file.

Best, Nauman.
0
 
LVL 4

Author Comment

by:gozoliet
ID: 12102570
AerosSaga - I know how to schedule tasks. I was wondering what kind of tasks would run through a asp.net site that uses authentication. The Internet Macros link looked promising, but I want something a bit more automatic and behind the scenes.

Tekchic - it's all 1 question.. how do I get rid of the slow load the first time an aspx page has been loaded in a while. Any options, or tricks will do.

Nauman - I use vs.net, and everything is in code-behind. You are right though, after making changes and compiling, the asp.net page will be slow the first time.  However, I find that if a page hasn't been used for 12 hours (not sure what the minimum time is) it will also run slowly for the first load. Then it's fine afterwards.


0
 
LVL 4

Expert Comment

by:tekchic
ID: 12102627
For automated testing (eg hitting the pages without you having to do it) the standard is still WinRunner.  I'll look around and see if there are any other decent solutions, but if you have hundreds of pages, then I'd use WinRunner.

If we're talking 20 or 30 pages that get changed at a time, I'd say just to sit there with a cup of coffee and click through em all, or make a stub page that has links to all the pages you need to refresh and click down the list.

Hope this helps :)

.: tekchic :.
0
 
LVL 25

Expert Comment

by:nauman_ahmed
ID: 12102676
Perhaps the aspnet_wp.exe file is getting recycled unexpectedly. Please check the event viewer and the responseDeadlockInterval settings in machine.config file. The following URLs will provide you more information about it:

http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B321792
http://www.dotnet247.com/247reference/msgs/38/191027.aspx

Best, Nauman.
0
 
LVL 4

Author Comment

by:gozoliet
ID: 12102851
I just looked in Event Viewer and do not see any asp.net events whatsoever.
Looking at the machine.config did give me some ideas.. like numRecompilesBeforeAppRestart among others.

There must be a setting somewhere that says how long aspnet_wp keeps its compiled pages in memory...

As long as people keep using, it works fine.. But we stop using it at 5 pm, and startup again the next day and the delay in the morning is hella annoying.

Tekchic - I will look further into Winrunner. It sounds promising, though a bit complicated.



0
 
LVL 25

Expert Comment

by:nauman_ahmed
ID: 12103567
What is the application protection settings in the IIS? Try setting it to High (Isolated) and see if it solves the problem.

Look at the following URL for reference:

http://www.microsoft.com/resources/documentation/WindowsServ/2003/all/deployguide/en-us/Default.asp?url=/resources/documentation/WindowsServ/2003/all/deployguide/en-us/iisdg_mei_mdrd.asp

-Nauman.
0
 
LVL 4

Expert Comment

by:tekchic
ID: 12103872
You mean the pages have to be recompiled every morning?  Why?
0
 
LVL 4

Author Comment

by:gozoliet
ID: 12103942
No, not in the sense that I need to open visual studio and hit 'Compile'.

But ASP.Net uses a JIT compiler to pre-compile pages before they're loaded. If a page hasn't been visited in a while, then the next person who goes to see the page has to wait 10-20 seconds while ASP.NET gets that page ready.

So to answer my question we need to either find:
1) A way to make ASP.NET keep those pre-compiled pages ready until I make changes to them, regardless how long between visits.
or
2) A tool that can be scheduled to access each page on the site, even if they are using forms authentication (which they all are)
0
 
LVL 25

Expert Comment

by:nauman_ahmed
ID: 12104362
You can use Windows Task Scheduler to run the IE in the background with the following command:

C:\Program Files\Internet Explorer\Internet Explorer.exe http://www.myserver.com/default.aspx

Best, Nauman.
0
 
LVL 4

Author Comment

by:gozoliet
ID: 12105340
Only problem, is that I then have to put in a username/password because all pages will bring you back to the forms authentication login screen... I guess there isn't an easy answer.
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12105426
License: Free and Pro $30.00      Reviewed: 2004-06-13
Version: 3.31 - Dated: 2004-04-26      Windows: 95, 98, Me, NT4, 2000, XP, 2003
"System Scheduler (previously known as 'Windows Scheduler') is an excellent tool to schedule unattended running of applications, batch files, scripts and much more. For anyone used to using MSTask, AT or WinAT, System Scheduler is an ideal and easy to use replacement, with more flexibility and features. Also, you can schedule popup reminders so you'll never forget those important appointments and things to do. Reminders, tasks and other events can be set to run once or every minute, hour, day, week, month or year and several variations on these. System Scheduler not only allows you to launch programs at scheduled times but also to *************send keypresses to those programs. This allows you to not only schedule programs to run overnight or at the weekend but also get those programs to do useful things. System Scheduler also has a 'Window Watcher' feature. The program will check for the existence of a particular window and send keypresses or send the window a 'close signal' to terminate running applications. Useful for triggering actions when 'error messages' appear while you are away.
"The Professional version contains all the great features of the free version plus more:
 ¤  Runs as a NT, 2000, XP, 2003 Service (run jobs while logged off)
 ¤  Shutdown/Reboot local and REMOTE computers
 ¤  Auto-Logon/Logoff Computer
 ¤  Auto-Lock/Unlock Console (NT, 2000, XP, 2003)
 ¤  Run Programs/Tasks on Logon and Logoff/Shutdown
 ¤  Extra Scheduling Options such as 'On Idle', 'On Cease Idle'
 ¤  Priority Email Support from Splinterware
 ¤  Upgrades for a year
 ¤  All for just $30 (US)"

Maybe this would be your best option then:
http://www.splinterware.com/products/wincron.htm
0
 
LVL 25

Expert Comment

by:nauman_ahmed
ID: 12105460
>>Only problem, is that I then have to put in a username/password because all pages will bring you back to the forms >>authentication login screen... I guess there isn't an easy answer.

Do you have sub applications under main application? If not then you can make this thing work by adding a blank asp.net page and giving its URL in the Task Scheduler. This page will only be used to invoke the asp.net process and you will not have to go to each form again and again.

Best, Nauman.
0
 
LVL 25

Expert Comment

by:nauman_ahmed
ID: 12105467
I am assuming here that you are using Forms Authentication.

-Nauman.
0
 
LVL 4

Author Comment

by:gozoliet
ID: 12105590
THanks Nauman,

It sounds like you've been referring to a problem where aspnet itself crashes or becomes inaccessible.

My problem is on a per-page basis. Like the whole site can work fine, but if there's 1 page that doesn't get accessed in a while, it will take 10-20 seconds to load the next time someone goes to it.  But the other pages will still keep loading fast.  By extension, since the offices are closed for over 12 hours each day, then every page on the intranet site will be slow the first time someone goes to it the next morning.

The more I read on the net, the less I think there is a solution other than wait for Whidbey.
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12105630
License: Free and Pro $30.00     Reviewed: 2004-06-13
Version: 3.31 - Dated: 2004-04-26     Windows: 95, 98, Me, NT4, 2000, XP, 2003
"System Scheduler (previously known as 'Windows Scheduler') is an excellent tool to schedule unattended running of applications, batch files, scripts and much more. For anyone used to using MSTask, AT or WinAT, System Scheduler is an ideal and easy to use replacement, with more flexibility and features. Also, you can schedule popup reminders so you'll never forget those important appointments and things to do. Reminders, tasks and other events can be set to run once or every minute, hour, day, week, month or year and several variations on these. System Scheduler not only allows you to launch programs at scheduled times but also to *************send keypresses to those programs. This allows you to not only schedule programs to run overnight or at the weekend but also get those programs to do useful things. System Scheduler also has a 'Window Watcher' feature. The program will check for the existence of a particular window and send keypresses or send the window a 'close signal' to terminate running applications. Useful for triggering actions when 'error messages' appear while you are away.
"The Professional version contains all the great features of the free version plus more:
 ¤  Runs as a NT, 2000, XP, 2003 Service (run jobs while logged off)
 ¤  Shutdown/Reboot local and REMOTE computers
 ¤  Auto-Logon/Logoff Computer
 ¤  Auto-Lock/Unlock Console (NT, 2000, XP, 2003)
 ¤  Run Programs/Tasks on Logon and Logoff/Shutdown
 ¤  Extra Scheduling Options such as 'On Idle', 'On Cease Idle'
 ¤  Priority Email Support from Splinterware
 ¤  Upgrades for a year
 ¤  All for just $30 (US)"

Maybe this would be your best option then:
http://www.splinterware.com/products/wincron.htm

Does the section with the astricks not pertain to this situation?
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12293790
I think a split is in order for this one.

Aeros
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12333704
If no one else feels they contributed then I'll take them, I fell I provided mutliple solutions.

Aeros
0
 
LVL 28

Expert Comment

by:mmarinov
ID: 12336362
Aeros, as i see the gozoliet has made the choise, not TheLearnedOne

B..M
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12337490
Thanks for pointing that out
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now