NIO one-to-one connection read threads?
ljohnston
johnstlr at yahoo.co.uk
Tue Aug 9 10:18:55 EDT 2011
If you use NioServerSocketChannelFactory(Executor bossExecutor, Executor
workerExecutor) then Netty will default to 2 worker threads per
Runtime.availableProcessors() as specified in the javadoc. Netty performs
round robin load balancing of incoming connections to worker threads hence
why you're seeing a one-to-one relationship between connections and IO
worker threads up to 128 connections.
If you want to limit the number of worker threads you can use the
constructor NioServerSocketChannelFactory(Executor bossExecutor, Executor
workerExecutor, int workerCount). Netty will limit the number of IO worker
threads to workerCount. Round robin load balancing will still be performed
within the limited number of threads.
I don't think I quite understand the idea with the synchronous queue. A
single thread that never blocks can potentially handle thousands of
connections, if not necessarily quickly and with low server utilisation. Do
you need to perform blocking operations when handling connections?
Cheers
Lee
--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/NIO-one-to-one-connection-read-threads-tp6663856p6668258.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list