How to handle an unresponsive IIS web application
SYMPTOMS – IIS is using up a lot of memory – resulting in a slowing down of request processing. Both – single request processing – as well as throughput (number of requests processed /sec) are subsequently slowed down.
CAUSE – If your request contains a ‘long-running’ task – and you end up sending multiple such requests to IIS, pretty soon all available threads in IIS are TIED UP processing these requests.
POSSIBLE SOLUTIONS :
Web Gardens
You can assign more than one IIS worker process for a given application pool (this is called a Web Garden). What this does is effectively provide you with more threads to use. You can accomplish the same thing by increasing the maxThreadsPerCPU (set to 0 for max), however, this is probably set as 0 anyway. So your next step is to create multiple worker processes – each of which uses up all the threads it can. Note that this workaround works only if your ‘long running task’ is not CPU intensive. If it is chewing up CPU resources, creating a web garden (more processes that chew up the CPU) will only make the problem worse. For tasks that simply chew up threads – and are not CPU intensive (e.g. Database UPDATES), the WEB GARDEN workaround is an acceptable one.
IIS 8.0 Onwards
The first question to ask is – what is your ASP.NET code doing that is causing this slow down? Whatever this long-running request (task) is (in your asp.net code), you can consider moving it to an IIS background worker process. This is a new feature available in IIS 8.0.
IIS 7.X
There are certain configuration parameters that you can utilize to control the number of threads used per IIS worker process . These include the following parameters:
<system.web> <applicationPool maxConcurrentRequestsPerCPU="12" maxConcurrentThreadsPerCPU="0" requestQueueLimit="5000"/> </system.web>
What are some long-running tasks that chew up threads (but not CPU)?
- Applications that make long running database requests
- Applications that have long-running, synchronous requests (transactions)
- Applications that have long-running , network intensive transactions
Overview of Application Pools and Worker Processes
- One IIS server may have multiple application pools.
- One web application binds to one application pool.
- One application pool may have more than one worker process (when Web Garden is enable).
- One worker process can have multiple app domains (an asp.net only concept). One app domain lives only in one worker process.
- One app domain may have multiple threads. One thread can be shared by different app domains in different time.
Leave a Reply