ThreadPool default thread count not useful for testing

By ramon
May 26, 2010

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: 1

  1. Ramon Smits says:

    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.

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Recent Posts
  • Recent Comments
  • Archives
  • Categories
  • Meta