ThreadPool Optimization

Doug Wolanick
edited August 2011 in Photon Server
Just looking to see how i can optimize these values:

		<!-- Using the same value for initial, min and max makes the pool fixed size, which allows optimizations. -->

In the following thread Boris mentions:
3) the threads in the config file are just the number of threads that feed operations to your .Net code. The peer base class queues all requests to it's request fiber and from that moment on the normal .net threadpool is used so you don't really have to worry about it. .net threadpool size can be configured with the ThreadPool class, properties MinThreads, MaxThreads etc. Per default it's 25 threads per CPU core.

But the default I see is 4 & 2. Should I change that to (25 * number of cores) ?


  • the enet thread pool has nothing to do with the .Net environment, it's the number of physical threads that fill the business logic queue. The other thread pool that is configured there empties this business logic queue and feeds the content to the CLR.

    The thread pool you are interested in is this:
    You can configure threads with ThreadPool.SetMinThreads and ThreadPool.SetMaxThreads, but usually this is not necessary.