BizTalk Tip : Preventing Thread Starvation

This is yet another classic BizTalk Server performance optimization.  The .NET threadpool for BizTalk Server has a finite number of threads allocated to each BizTalk process.  Threads being the most basic unit of work available to a .NET process.  If a process runs out of threads it can slow down without fully exploiting available resources.  Conversely if too many threads are allocated to a process then excess context switching can occur which has the net effect of slowing down performance.  Context switching is the overhead incurred when the windows kernal switches control between threads.
 
To view how many threads are currently allocated to a BizTalk host view the "Thread Count" BizTalk Host Throttling Performance Counter.  The values we need to tweak are within the registry.  So as always ensure your registry is backed up before proceeding any further.  The four properties we are going to change are

MaxIOThreads, MaxWorkerThreads, MinIOThreads, MinWorkerThreads.  The value of each of these properties is multipled by the number of CPUs to give the number of threads available to a process.  The conservative default values are MaxIOThreads = 20, MaxWorkerThreads = 25, MinIOThreads = 1, MinWorkerThreads = 1.  The recommended values are MaxIOThreads = 100, MaxWorkerThreads = 100, MinIOThreads = 25, MinWorkerThreads = 25.

Add the below to a .reg file and run it being sure to tweak the BizTalkHostName value on the registry key path.

Windows Registry Editor version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTSSvc$BizTalkHostName\CLR Hosting]
“MaxIOThreads”=dword:00000064
“MaxWorkerThreads”=dword:00000064
“MinIOThreads”=dword:00000019
“MinWorkerThreads”=dword:00000019

Advertisements
This entry was posted in BizTalk Server. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s