ThreadPool Optimization

edited August 2011 in Photon Server
Just looking to see how i can optimize these values:
<ThreadPool
			InitialThreads="4"
			MinThreads="4"
			MaxThreads="4">
		</ThreadPool>

		<!-- Using the same value for initial, min and max makes the pool fixed size, which allows optimizations. -->
		<ENetThreadPool
			InitialThreads="2"
			MinThreads="2"
			MaxThreads="2">
		</ENetThreadPool>

In the following thread Boris mentions:
viewtopic.php?f=5&t=559&p=2635&hilit=maxthreads#p2635
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) ?

Comments

  • 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: http://msdn.microsoft.com/en-us/library/y5htx827.aspx
    You can configure threads with ThreadPool.SetMinThreads and ThreadPool.SetMaxThreads, but usually this is not necessary.
Sign In or Register to comment.