How to Tune the ASPProcessorThreadMax and EmulateMTSBehavior

 

Background

Sometimes we may find the ASP requests are very slow because of too many requests queued. Then we can modify the Metabase property of ASPProcessorThreadMax to improve the performance. For more information about how to tune this property, please refer to the following articles

https://support.microsoft.com/kb/238583

https://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/d4ed262f-11d0-4a87-b15d-57a8c800539e.mspx

Analysis

Based on the ASPProcessorThreadMax definition, it seems this property can be set on website level or virtual directory level. However, after some experiments I find this property ONLY works when we set on W3SVC level as below.

adsutil.vbs set w3svc/AspProcessorThreadMax <NewValue>

Besides this value, we can also set the EmulateMTSBehavior value to 1 so that the worker process can host at most 100 concurrent ASP requests.

HKEY_LOCAL_MACHINE\Software\Microsoft\COM3\STAThreadPool

Value name: EmulateMTSBehavior

Data type: REG_DWORD

Value data: default is 0

By setting this parameter to 1, it will set the max threads number of STAThreadPool to 100, so this setting can also affect the other STA COM+ applications. Furthermore, if you set the EmulateMTSBehavior value, the AspProcessorThreadMax setting will be ignored. And the EmulateMTSBehavior setting won't aware the processor number, this means the process can only starts at most 100 STA threads no matter how many processors you have.

More Info

We can also let ASP run in MTA by setting AspExecuteInMTA value. If your COM components are primarily free-threaded or both-threaded, running the ASP threads as MTA can improve performance significantly.

 

Regards,

ZhiXing Lv