Solved

Web server slow to launch asp.net site after inactivity

Posted on 2004-10-02
2
306 Views
Last Modified: 2010-07-27
I have a Windows 2003 server with .NET 1.1 sp1 installed.  I have a web application that runs pre-compiled DLLs (these are aspx pages with the code-behinds in VB.NET DLLS).  If I recompile a DLL, there's about a 10 -20 second delay opening the website.  Then it serves up pages almost instaneously, as it should.

But if I don't visit the site for 20 minutes, then go back, the delay occurs again.  I've done some research, and I think this is because the application pool the web app resides in has to launch a new w3wp.exe process every 20 minutes.  I looked at the application pool properties, and I have 2 settings set as 20 minutes:

Recycle worker process: 20 minutes

Idle Timeout:
Shutdown worker processes after being idle for 20 minutes.

Can I just increase the idle timeout to 1440 minutes (1 day)?  Will that solve the problem, assuming someone visits the site once a day to keep the w3wp process running so it doesn't shutdown for an idle timeout.

Is there a better way, or does dot net just suck?
0
Comment
Question by:itcnbwise
2 Comments
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12208831
I wouldn't say it just sucks, but that is a current known limitation, they are working on JIT for 2.0.  In the mean time if you are really that hard up for performance consider ngen:

Precompiling Code (Using ngen.exe)

For an application vendor, the ability to precompile code during installation is an attractive option. Microsoft does provide this option in the form ngen.exe, which will let you run the normal JIT compiler over your whole program once, and save the result. Since the run time-only optimizations cannot be performed during precompilation, the code generated is not usually as good as that generated by a normal JIT. However, without having to JIT methods on the fly, the startup cost is much lower, and some programs will launch noticeably faster. In the future, ngen.exe may do more than simply run the same run time JIT: more aggressive optimizations with higher bounds than the run time, load-order-optimization exposure to developers (optimizing the way code is packed into VM pages), and more complex, time consuming optimizations that can take advantage of the time during precompilation.

Cutting the startup time helps in two cases, and for everything else it doesn't compete with the run time-only optimizations that regular JITing can do. The first situation is where you call an enormous number of methods early on in your program. You'll have to JIT a lot of methods up front, resulting in an unacceptable load time. This is not going to be the case for most people, but pre-JITing might make sense if it affects you. Precompiling also makes sense in the case of large shared libraries, since you pay the cost of loading these much more often. Microsoft precompiles the Frameworks for the CLR, since most applications will use them.

It's easy to use ngen.exe to see if precompiling is the answer for you, so I recommend trying it out. However, most of the time it's actually better to use the normal JIT and take advantage of the run-time optimizations. They have a huge payoff, and will more than offset the one-time startup cost in most situations.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/dotnetperftechs.asp

Also, go through that link and make sure you have performed all of the JIT optimizations Microsoft suggests.

Regards,

Aeros
0
 
LVL 2

Accepted Solution

by:
raed_hasan earned 500 total points
ID: 12214667
There are two issues here:

a) When you first hit the site after rebuilding your project and
redeploying, ASP.NET needs to compile your MSIL .NET code down to machine
code. This incurs some processing overhead

b) The second issue occurs due to your Application Pool being unloaded after
a set amount of idle timeout. When this happens, the w3wp.exe process
serving the pool is shutdown. The reason for this setting is to allow IIS to
handle many more websites (and web app pools) than previously, because not
every web app pool needs to have a w3wp.exe process at all times. However,
it does mean that when a request does come in, Windows needs to start up a
new process to service that web app pool.

In your case, if your server is not under load, then you can simply choose
*not* to unload the web app pool after any inactivity period (just uncheck
the option), and the w3wp.exe process will never need to "started up" again

Regards

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Adjust the position 3 50
ASP.net VB.net Load contents of a GridView  to Excel 2 27
Need a complete list of ASP.NET page load events 3 29
Syntax Error 2 47
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

863 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

26 Experts available now in Live!

Get 1:1 Help Now