web app slow performance when leave idle for some time - asp.net

We have a web application deployed on IIS 7.5 target framework 4.0
the application perform slow when leave idle for few minutes for first time and then perform as expected this happened each time application is idle.
With the help of fiddler I found its TCP/IP connection which is taking time about 21 secs whilein subsequent calls this time is 0.
The Idle time out is also set high and connection time out is also high in the IIS settings.
server is - Windows 2008 R2.
there is nothing in the event viewer related to the website.
we used form authentication but the time out for that is also set about 10 hours in the config file.
Can anybody point me to the setting with is affecting the response time after the app is idle for some time.
Note - this was working proper when deployed withing the LAN but this problem starts when deployed out of the LAN or in separate domain.

Problem
here is the problem in IIS app pool idle time out, its by default set to 20 minutes, after 20 minutes app pool shutdown if no request within 20 minutes,
when any request comes after 20 minute its again start,
The problem is that the first visit to an app pool needs to create a new w3wp.exe worker process which is slow because the app pool needs to be created, ASP.NET or another framework needs to be loaded, and then your application needs to be loaded. so it may take time 20-30 seconds or depends on the application content size.
Solution
so to avoid this type of delay we need to set the idle time out to 0.
now it will always load fast.
app pool setting

The IIS application pool is shut down after 30 minutes of inactivity. After that, when you make a request IIS basically has to start the website up again, which leads to the behavior you are describing. You can change the idle time of your website in IIS though to avoid it.
You could also look into the Auto-Start feature of the 4.0 framework.

Well, a bit late, but may help someone else. I had the same problem, nothing in the logs, spent days, then looking at the network adapter properties / configuration / power management - Allow computer to shut down save power was checked. Unchecked and the problem was solved.

Related

Low Traffic Website - Slow Initial Load

I have a problem with my website and I think it's related to IIS recycling the app pool or shutting down the app after 20 mins of inactivity. As it is a low traffic site, when I first browse to the site the initial load can take up to 30 seconds, then after that it is very fast. If i then come back to the site say a few hours later I get the slow load time again. I'm sure it's something to do with the app pool shutting down after 20 mins of inactivity?
Another problem is that I am hosting via a hosting company so have no direct access to manipulate IIS at all. Does anyone know how I can keep my app alive so I don't suffer from the initial slow load speed issues?
You could setup a service to issue a request every few minutes to your site which can double as monitoring your site to ensure it's still running. You probably don't have access to the application pool configuration I assume.

How to get fast ASP.Net application shutdown for restart/recycle on high traffic site?

I'm running a very high traffic site that gets a good 300+ requests/second (http://cooltext.com). A restart takes a good 90 seconds at least for it. So every time I post a new build it goes down for a minute or two. Long enough to trigger my monitoring services.
When I make a change that restarts the server, it appears that the restart stalls until all of the old requests on the old application pool (some of them very long running) complete. I can make the restart happen much faster by killing the old w3wp.exe instance manually.
Is there some way to force IIS to close all the connections right away and do a hard restart? Some setting in IIS or asp.net to control this?
Just found the following that appears to be what I'm looking for: http://msdn.microsoft.com/en-us/library/aa720127(v=vs.71).aspx
Shutdown Time Limit is the equivalent application pool setting for the shutDownTimeout ASP.NET process model setting. It specifies the amount of time a worker process is given to shutdown gracefully. If the worker process does not shutdown in time amount specified, the ASP.NET ISAPI will end the worker process. Shutdown Time Limit is set to 90 seconds by default. You can specify a different time limit by changing the value in the spin box.

ASP.NET web app slow response after a pause

I'm building a web app using ASP.NET MVC and MS SQL Server CE and deploying it to a shared hosting. Every time I approaching my site after a pause (half an hour) it performs very slow. It takes about 40 seconds to load the first page. After this every page opens quickly.
Please advice what may cause the problem and how to solve it.
Thanks
Update: It appeared that after a pause in visiting (10-20 min) the site is loaded from the server hard drive not memory. That is why it was so slow. Possible solutions are increase site visits, move to a virtual server or ping the home page regulary.
My hosting provider has an option for pinging besides some solutions are described here c# ping a website? (keep-alive service)
If the worker process is not processing requests it will shut down the worker process after the specified number of minutes. (if configured)
Not sure what version of IIS you are using but look into "Idle Time-out (minutes)". IIS 7 specific info below...
http://technet.microsoft.com/en-us/library/cc771956(WS.10).aspx
As a paliative, set your app to recycle only after a long period of inactivity.
See Configure an Application Pool to Recycle at a Scheduled Time (IIS 7)

Overcome compilation(?) pause on *secondary* initial ASP.Net application startup?

After deploying an ASP.Net application to a new server, the first user to hit the app gets a long pause, presumably because the app is performing its initial compilation. However, this pause seems to also also occur after the application has timed out and unloaded itself from memory.
The first compilation would be tolerable as it only happpens once, but the 2nd one seems to me like it should be unnecessary....is there a workaround to address this issue? It would be nice to be able to extend the application timeout, but I only see a way to extend the session timeout, which I would rather not do, as this would keep all user sessions in memory for a long period of time.
That's IIS shutting down the worker process - the default is a 20 min idle time. In IIS6, you can configure the app pool and turn off the Idle timeout (on Performance tab). In IIS7, it's in the Advanced Settings.
A common way (though looks hackish to me) to keep the worker process alive is to have some program issue web requests to some URL in the application on a regular basis.
You can reduce the initial startup time by precompiling the ASP.NET app with aspnet_compiler.exe. This won't reduce the initial request time to zero (it'll still need to create the worker process and do other housekeeping.) but it'll noticeably reduce it.
I did find some recommended settings for the App Pools in IIS. The intended outcome of these settings is to reduce the number of times your application needs to go through the startup cycle. These settings should apply to IIS 6 as well as IIS 7:
Recycle Worker Process: Disable. Use this only if you have multiple websites and are trying to isolate processes.
Shutdown worker processes after being idle for (time in minutes): Disable unless you are sharing resources on your server. With this setting disabled, your website should not unload, ensuring that startup time for your site is as minimal as possible.

Session timeouts in asp.net on a dedicated server

I have a asp.net website hosted in the dedicated server.I'm using web.config to handle the session timeouts and that is 60 minutes.I did the following settings on the dedicated server (windows server 2003 and IIS 6.0 versions)
In the default web site property of IIS-->ASP.net tab-->Edit configuration-->Session timeouts -->60
In the application pool The session timeout has been extended to 60.
Recycling worker process has been set to 60 in the application pool.
I can get this work correct on my local system the problem is on the dedicated server(Goddady). No customer support is available for this problem
It will be also fair if the session timeout is infinity too.
But the timeout occurs after every 20 minutes if the webform is kept idle. How to get rid of this? I have a guess that the idle timeout is overriding the session timeout as I googled around but have not found a solution for this
please help me........
Thanks,
Prabha
We had the same problem on a hosted server, and decided that rather than fighting with the hosting company we would use some javascript on a timer to execute an AJAX request to the server to reset the session if it was about to expire.
This site (PreventTimeout) is very close to what we do.
I know this doesn't answer your question directly, but it has been a good workaround for us.
If you recycle the application pool every 60 minutes, then (assuming your sessions die when the pool recycles) a session started 10 minutes before the pool recycles will only last 10 minutes.
On average, you'd expect a session to last 30 minutes.

Resources