Sunday, October 21, 2012

How many concurrent requests can ASP.NET handle?

Following are settings that effect the number of requests that ASP.NET can handle at a time. And when we mean requests, it is incoming requests that has been placed by IIS in the CLR threadpool.
Configuration settingDefault value (.NET Framework 1.1)Recommended value
maxconnection212 * #CPUs
maxIoThreads20100
maxWorkerThreads20100
minFreeThreads888 * #CPUs
minLocalRequestFreeThreads 476 * #CPUs
So,

Number of requests that ASP.NET runtime can handle = Number of worker threads available to handle incoming requests = maxWorkerThreads - minFreeThreads = 100 - 88 = 12

The recommendation to limit the ASP.NET runtime to 12 threads for handling incoming requests is most applicable for quick-running operations. The limit also reduces the number of context switches. If your application makes long-running calls, first consider the design alternatives. If the alternative designs cannot be applied in your scenario, start with 100 maxWorkerThreads, and keep the defaults for minFreeThreads. This ensures that requests are not serialized in this particular scenario.

The idea is always to reduce contention. Performance counters to watch out for are

  • CPU utilization increases.
  • Throughput increases according to the ASP.NET Applications\Requests/Sec performance counter.
  • Requests in the application queue decrease according to the ASP.NET Applications/Requests In Application Queue performance counter.

No comments: