Condividi tramite


Controlling the CLR Thread pool hosted by BizTalk

The CLR thread pool is global to the process, meaning that all components using the thread pool in a given process share the same thread pool and therefore compete for it. This for the most part is a good thing as it is more efficient in terms of system resources. When you do performance testing/tuning there are scenarios when you need to control the thread pool, for example when using the SOAP Adapter.

I came across this little gem last week, I hadn’t realized that Q886966 added the registry keys MinCompletionPortThreads, and MinWorkerThreads and then SP1 added the MaxWorkerThreads key below. These all exist under:

 

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTSSvc{Guid}\CLR Hosting

MinWorkerThreads - the minimum number of worker threads that are available in the thread pool

MaxWorkerThreads – the number of worker threads in the thread pool

MinCompletionPortThreads – default 150

 

MinWorkerThreads can be tuned to address the problem due to the slow speed at which the thread pool can sometimes add new threads, this typically happens during service startup or during a burst of new load after a lull period. MaxWorkerThreads can be used to increase the number of threads in the thread pool, and this can be used to address the “out of threads issue” while using the SOAP adapter.

Note, as with most BizTalk registry keys they don’t exist by default, you’ll need to create them in order to use their non-default values.

Comments