Skip to content
davidfowl edited this page Nov 7, 2011 · 39 revisions

Performance

ASP.NET and IIS scale very well, but you'll need to change a few settings to set up your server for lots of concurrent connections, as opposed to lots of requests per second.

IIS Configuration

Max concurrent requests per application

Increase the number of concurrent requests IIS will serve at once:

  • Open %windir%\inetsrv\config\applicationHost.config
  • Locate the serverRuntime element
  • Add the appConcurrentRequestLimit attribute if not already there and set it to a suitable number (5000 is the default in IIS7+)

Example

<serverRuntime appConcurrentRequestLimit="250000" />

ASP.NET Configuration

Maximum Concurrent Requests Per CPU

By default ASP.NET 4.0 sets the maximum concurrent connections to 5000 per CPU. If you need more concurrent connections then you need to increase the maxConcurrentRequestsPerCPU setting.

  • Open %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet.config (Framework64 for 64 bit processes)

Example

<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
    <runtime>
        <legacyUnhandledExceptionPolicy enabled="false" />
        <legacyImpersonationPolicy enabled="true"/>
        <alwaysFlowImpersonationPolicy enabled="false"/>
        <SymbolReadingPolicy enabled="1" />
        <shadowCopyVerifyByTimestamp enabled="true"/>
    </runtime>
    <startup useLegacyV2RuntimeActivationPolicy="true" />
    <system.web>
        <applicationPool maxConcurrentRequestsPerCPU="20000" />
    </system.web>
</configuration>

Request Queue Limit

When the total amount of connections exceed the maxConcurrentRequestsPerCPU setting (i.e. maxConcurrentRequestsPerCPU * number of logical processors), ASP.NET will start throttling requests using a queue. To control the size of the queue, you can tweak the requestQueueLimit.

  • Open %windir%\Microsoft.NET\Framework\v4.0.30319\Config\machine.config (Framework64 for 64 bit processes)
  • Locate the processModel element
  • Set the autoConfig attribute to false and the requestQueueLimit attribute to a suitable number

Example

<processModel autoConfig="false" requestQueueLimit="250000" />

Other Resources

Clone this wiki locally