Microsoft KB Archive/810259

= FIX: SetMinThreads and GetMinThreads API Added to Common Language Runtime ThreadPool Class =

Article ID: 810259

Article Last Modified on 5/23/2007

-

APPLIES TO


 * Microsoft .NET Framework 1.1
 * Microsoft ASP.NET 1.0

-



SYMPTOMS
You cannot configure the minimum number of Worker threads or I/O threads in the ThreadPool class.



RESOLUTION
A supported fix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Apply it only to computers that are experiencing this specific problem. This fix may receive additional testing. Therefore, if you are not severely affected by this problem, Microsoft recommends that you wait for the next .NET Framework service pack that contains this fix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

NOTE: In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The typical support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.

  Date         Time   Version       Size       File name --  08-Nov-2002  17:34  1.0.3705.374    196,608  Aspnet_isapi.dll 08-Nov-2002 17:26                    4,169  Aspnet_perf.h   08-Nov-2002  17:26                   20,468  Aspnet_perf.ini 08-Nov-2002 17:26                   20,342  Aspnet_perf2.ini 08-Nov-2002 17:34  1.0.3705.374     24,576  Aspnet_regiis.exe 08-Nov-2002 17:34  1.0.3705.374     28,672  Aspnet_wp.exe 08-Nov-2002 16:52  1.0.3705.374     69,632  Corperfmonext.dll 10-Nov-2002 14:56  1.0.3705.374  1,953,792  Mscorlib.dll 31-Oct-2002 18:04                   10,252  Mscorlib.ldo 08-Nov-2002 16:51  1.0.3705.374  2,269,184  Mscorsvr.dll 08-Nov-2002 16:51  1.0.3705.374  2,269,184  Mscorwks.dll 22-Aug-2002 19:23                       15  Smartnav.htm 22-Oct-2002 13:41                    8,728  Smartnav.js   20-Mar-2002  13:31                    7,003  Smartnavie5.js   10-Nov-2002  14:59  1.0.3705.374  1,187,840  System.web.dll



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
Functionality has been added to the common language runtime ThreadPool class that permits you to configure the minimum number of Worker threads and I/O threads during load.

Microsoft recommends that you tune the minimum number of threads only when there is load on the Web server for only short periods (0 to 10 minutes). In these cases, the ThreadPool does not have enough time to reach the optimal level of threads to handle the load.

If the minimum number of Worker threads or I/O threads is configured, the ThreadPool immediately creates new threads up to the minimum number specified (the default is 0) during a time of high load. After inactivity, these threads die.

The following two APIs have been added to the ThreadPool class:   ThreadPool.SetMinThreads Method

Sets the minimum number of worker threads and the minimum number of asynchronous I/O threads for the ThreadPool.

public static bool SetMinThreads(int workerThreads, int completionPortThreads); Parameters

workerThreads: The number of worker threads.

completionPortThreads: The number of asynchronous I/O threads.   ThreadPool.GetMinThreads Method

Gets the minimum number of worker threads and the minimum number of asynchronous I/O threads for the ThreadPool.

public static void GetMinThreads(out int workerThreads, out int completionPortThreads); Parameters

workerThreads: The number of worker threads.

completionPortThreads: The number of asynchronous I/O threads. 

For more information about the ThreadPool class, visit the following Microsoft Web site:

ThreadPool Class

http://msdn2.microsoft.com/en-us/library/system.threading.threadpool(vs.71).aspx

Two new configuration settings have been added to the  configuration section in the Machine.config to use the new ThreadPool class functionality from ASP.NET:
 * minWorkerThreads: Configures the minimum number of worker threads to be used for the process on a per-CPU basis. For example, if this value is 10 on a single-processor server, ASP.NET uses the runtime APIs to set the process limit to 10. On a two-processor server, the limit is set to 20. The default is 0.
 * minIoThreads: Configures the minimum number of asynchronous I/O threads to be used for the process on a per-CPU basis. For example, if this value is 10 on a single-processor server, ASP.NET uses the runtime APIs to set the process limit to 10. On a two-processor server, the limit is set to 20. The default is 0.

Keywords: kbhotfixserver kbqfe kbfix kbbug KB810259

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.