forked from SignalR/SignalR
-
Notifications
You must be signed in to change notification settings - Fork 0
Performance
davidfowl edited this page May 10, 2012
·
39 revisions
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.
Increase the number of concurrent requests IIS will serve at once:
- Open an administrator command prompt at
%windir%\System32\inetsrv\ - Run the command below to update the
appConcurrentRequestLimitattribute to a suitable number (5000 is the default in IIS7+)
Example
appcmd.exe set config /section:serverRuntime /appConcurrentRequestLimit:100000
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) - Copy from the sample below (ensure case is correct!)
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>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
processModelelement - Set the
autoConfigattribute to false and therequestQueueLimitattribute to a suitable number
Example ``xml
## Performance Counters
The following performance counters may be useful to watch while conducting concurrency testing and adjusting the settings detailed above:
**Memory**
* .NET CLR Memory\# bytes in all Heaps (for **w3wp**)
**ASP.NET**
* ASP.NET\Requests Current
* ASP.NET\Queued
* ASP.NET\Rejected
**CPU**
* Processor Information\Processor Time
**TCP/IP**
* TCPv6\Connections Established
* TCPv4\Connections Established
**Web Service**
* Web Service\Current Connections
* Web Service\Maximum Connections
**Threading**
* .NET CLR LocksAndThreads\ # of current logical Threads
* .NET CLR LocksAndThreads\ # of current physical Threads
## Generating Client Load with crank
SignalR uses a particular protocol to communicate so it's best that you use our tool to generate load for testing your server(s). Checkout the github repository (https://github.com/SignalR/crank) for more details.
### Other Resources
* [applicationPool configuration section in aspnet.config](http://msdn.microsoft.com/en-us/library/dd560842.aspx)
* [processModel configuration section](http://msdn.microsoft.com/en-us/library/7w2sway1.aspx)
* [ASP.NET Thread Usage on IIS 7.5, IIS 7.0, and IIS 6.0](http://blogs.msdn.com/b/tmarq/archive/2007/07/21/asp-net-thread-usage-on-iis-7-0-and-6-0.aspx)