High CPU Usage and .NET Thread Pool

High CPU Usage and .NET Thread Pool

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

If you experience unusually high CPU usage or an increase of CPU usage over time, it may be related to a known issue in the common language runtime (CLR) thread pool in .NET Framework 3.5 SP1.

Profile the application to find where the process time is spent. If significant time is spent in lock contention methods inside the CLR thread pool, you are likely affected by this issue.

Alternatively, connect the debugger to the process (or load a dump of the process into the debugger) and run the !threadpool command from the sos.dll extension DLL. If the queue length is very low (0, 1, or 2), but the total number of worker threads is equal to or very close to Max Limit of worker threads, your application is very likely affected by this issue.

Limit the maximum number of worker threads in the thread pool by calling ThreadPool.SetMaxThreads. The number used should reflect the application's needs, and can vary from application to application.

© 2015 Microsoft