[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 747
  • Last Modified:

ASP.NET pages slow to load for first time

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
gozoliet
Asked:
gozoliet
  • 17
  • 6
  • 6
  • +2
1 Solution
 
tekchicCommented:
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
 
tekchicCommented:
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
 
AerosSagaCommented:
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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
mmarinovCommented:
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
 
gozolietAuthor Commented:
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
 
AerosSagaCommented:
0
 
AerosSagaCommented:
You could also create a macro to do this:

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

0
 
AerosSagaCommented:
0
 
AerosSagaCommented:
Heres a good list of apps to do this:

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

0
 
AerosSagaCommented:
many of which are free;)
0
 
AerosSagaCommented:
let me know when you've had enough lol
http://www.theabsolute.net/sware/#tasksched
0
 
tekchicCommented:
Here's a thought, put them all in one reply.
0
 
AerosSagaCommented:
naa, lol
0
 
AerosSagaCommented:
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
 
tekchicCommented:
Technically he is asking a second question within this first one..... but oh well :)
0
 
AerosSagaCommented:
lol when does anyone just ask one question here
0
 
nauman_ahmedCommented:
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
 
gozolietAuthor Commented:
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
 
tekchicCommented:
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
 
nauman_ahmedCommented:
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
 
gozolietAuthor Commented:
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
 
nauman_ahmedCommented:
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
 
tekchicCommented:
You mean the pages have to be recompiled every morning?  Why?
0
 
gozolietAuthor Commented:
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
 
nauman_ahmedCommented:
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
 
gozolietAuthor Commented:
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
 
AerosSagaCommented:
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
 
nauman_ahmedCommented:
>>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
 
nauman_ahmedCommented:
I am assuming here that you are using Forms Authentication.

-Nauman.
0
 
gozolietAuthor Commented:
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
 
AerosSagaCommented:
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
 
AerosSagaCommented:
I think a split is in order for this one.

Aeros
0
 
AerosSagaCommented:
If no one else feels they contributed then I'll take them, I fell I provided mutliple solutions.

Aeros
0
 
mmarinovCommented:
Aeros, as i see the gozoliet has made the choise, not TheLearnedOne

B..M
0
 
AerosSagaCommented:
Thanks for pointing that out
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 17
  • 6
  • 6
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now