Solved

Web server slow to launch asp.net site after inactivity

Posted on 2004-10-02
2
303 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

760 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

21 Experts available now in Live!

Get 1:1 Help Now