Ramon Smits

Tell me your secrets and i'll tell you mine

Recent Posts

Tags

Community

Email Notifications

Patterns & Practices / Guidelines

EntLib

Nant

Blogs that I monitor

Archives

ThreadPool default thread count not useful for testing

Today I got reminded again that it is sometimes required to adjust thread pool settings. This time to test some possible connection issues and I required to open a number of connections simultaneously and also use them in parallel.

The test system is a virtual machine which only has one core so the defaults that .net uses are based on that. I first thought that the problems were caused by nunit but pretty soon found out that the case had to do with the thread pool. When I queried the current values via ThreadPool.GetMinThreads it told me that the thread pool used just one thread as minimal. After forcing that with ThreadPool.SetMinThreads to a thread count in where I could test my scenario I still had issues.

I am now using a custom Parellel.For which I adjusted so that I can set a different ChunkSize (set to 1) and ThreadCount for testing purposes.

Comments

Kristof said:

Why don't you use a virtual machine with two cores? :) VMWare Workstation can do this perfectly.

# May 27, 2010 11:37 AM

Ramon Smits said:

Two cores would still not be enough for testing purposes. But yes I know that some virtual machine hosts can emulate multiple cores. AFAIK virtualbox can do this to but we are using VMware ESX and I am not the admin of that host so I cannot change any of the guest parameters.

# May 27, 2010 11:56 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Please add 6 and 6 and type the answer here: