?
Solved

Web server slow to launch asp.net site after inactivity

Posted on 2004-10-02
2
Medium Priority
?
313 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 1500 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

765 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