Solved

Web server slow to launch asp.net site after inactivity

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

809 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