ASP.net Threadpool Optimizations for the 1.1 Machine.config
If you’re using ASP.net 1.1 and your web
server has more than one processor it is probably advisable to consider testing
some "threadpool optimizations." These optimizations are not guaranteed to be
perfect for your environment but generally they are very good recommendations.
I’d recommend testing with them and, if desired, tweaking them to your own
specifications as you see fit.
The default
settings in the
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG\machine.config file are:
maxconnection 2;
maxIoThreads 20;
maxWorkerThreads 20;
minFreeThreads 8;
minLocalRequestFreeThreads 4
Consider beginning optimization attempts
using the following formula:
maxconnection 12 * #CPUs
;
maxIoThreads 100;
maxWorkerThreads 100;
minFreeThreads 88 * #CPUs;
minLocalRequestFreeThreads 76 * #CPUs
minWorkerThreads 50 [this
one needs to be added]
You might want to doublecheck
my math on this cheat-sheet before using them:
|
Two Processors: |
Four Processors: |
Eight Processors: |
Twelve Processors: |
|||||
|
maxconnection="24" |
maxconnection="48" |
maxConnection=”96” |
maxConnection=”144” |
|||||
|
minFreeThreads="176" |
minFreeThreads="352" |
minFreeThreads="704" |
minFreeThreads="1056" |
|||||
|
minLocalRequestFreeThreads="152" |
minLocalRequestFreeThreads="304" |
minLocalRequestFreeThreads="608" |
minLocalRequestFreeThreads="912" |
|||||
|
maxWorkerThreads="100" |
maxWorkerThreads="100" |
maxWorkerThreads="100" |
maxWorkerThreads="100" |
|||||
|
minWorkerThreads="50" |
minWorkerThreads="50" |
minWorkerThreads="50" |
minWorkerThreads="50" |
|||||
|
maxIoThreads="100" |
maxIoThreads="100" |
maxIoThreads="100" |
maxIoThreads="100" |
|||||
As an example, on a four processor web
server, the machine.config settings highlighted in
yellow (ignore the ones that are not highlighted please) need to be changed to
something resembling the following:
<connectionManagement>
<add address="*"
maxconnection="48"
/>
<httpRuntime
executionTimeout="90"
maxRequestLength="4096"
useFullyQualifiedRedirectUrl="false"
minFreeThreads="352"
minLocalRequestFreeThreads="304"
appRequestQueueLimit="100"
enableVersionHeader="true"
/>
<processModel
enable="true"
timeout="Infinite"
idleTimeout="Infinite"
shutdownTimeout="0:00:05"
requestLimit="Infinite"
requestQueueLimit="5000"
restartQueueLimit="10"
memoryLimit="60"
webGarden="false"
cpuMask="0xffffffff"
userName="machine"
password="AutoGenerate"
logLevel="Errors"
clientConnectedCheck="0:00:05"
comAuthenticationLevel="Connect"
comImpersonationLevel="Impersonate"
responseDeadlockInterval="00:03:00"
maxWorkerThreads="100"
minWorkerThreads="50"
maxIoThreads="100"
/>
After making these improvements, be sure to
restart IIS with an IISRESET and test your ASP.net pages.
These optimizations are not needed with
ASP.net 2.0 since the machine.config file has autoconfig set to true by default.
Reference:
KB 821268 Contention, poor performance, and deadlocks
when you make Web service requests from ASP.NET applications
http://support.microsoft.com/default.aspx?scid=kb;EN-US;821268