Shared thread pools for multiple server sockets?

GoldenKevin goldstar.kevin at gmail.com
Sat Jun 18 19:33:21 EDT 2011


I have been refactoring a lot of the code for my application. I have multiple
NioServerSocketChannelFactory instances that all listen on different ports,
and each uses its own worker thread pool. The listeners on each port all
receive similar loads and perform similar tasks, so I figured it would be
more efficient if they were to share a single worker thread pool so that
there would be fewer idling threads.

Now, say I passed a number 'n' for the parameter workerCount in the
NioServerSocketChannelFactory constructor, and I run 'm' instances of
NioServerSocketChannelFactory. When creating a fixed size thread pool,
should I call Executors.newFixedThreadPool(n) or
Executors.newFixedThreadPool(m * n)? Or would it be wiser just to call
Executors.newCachedThreadPool() instead?

--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Shared-thread-pools-for-multiple-server-sockets-tp6491909p6491909.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list