Solved

Web server slow to launch asp.net site after inactivity

Posted on 2004-10-02
2
309 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 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