Hi,
I am a newbie. When I reviewed Netty's guides and some codes, I had some questions.
NioServerSocketChannelFactory has 3 params.
1. boss executor
2. worker executor
3. worker count
About 2 and 3, I have questions.
---
Document says:
Boss threads are acquired from the bossExecutor, and worker threads are acquired from the workerExecutor. Therefore, you should make sure the specified Executors are able to lend the sufficient number of threads. It is the best bet to specify a cached thread pool.
...
Worker threads - One NioServerSocketChannelFactory can have one or more worker threads. A worker thread performs non-blocking read and write for one or more Channels in a non-blocking mode.
---
And default worker count is 2 * the number of available processors.
1. When I reviewed codes, Netty creates selectors with worker counts for reading and writing IO and NIOWorkers are executed in worker executor.
If I am understanding correctly, read/write IO work will be executed in these selector threads.
And worker executor's max threads number can't exceed worker's counts. Is it right?
Then a cached thread pool's meaning is only saving redundant threads(from 0 to worker count).
2. If a user overrides SimpleChannelUpstreamHandler#messageReceived() incorrectly, so the method will be blocked or have a long running logic,
the selector thread will be also blocked. Right?
First, I thought Netty's worker threads were only for Read/Write IO logic associated with channel or connection which were delegated by the selector thread.
But Netty's worker threads look like selector threads.
So I am confusing selector thread and worker thread's relations.
Could you please advice me if I am misunderstanding?
Thanks in advance.
Regards,
Bongjae Chang