Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
bossGroup = new NioEventLoopGroup(maxShuffleThreads, new ThreadFactory() { @Override public Thread newThread(Runnable r) { return new Thread(r, BOSS_THREAD_NAME_PREFIX + bossThreadCounter.incrementAndGet()); } });
With netty3, we initialized NioServerSocketChannelFactory with below constructor:
selector = new NioServerSocketChannelFactory(
Executors.newCachedThreadPool(bossFactory),
Executors.newCachedThreadPool(workerFactory),
maxShuffleThreads);
this always creates 1 boss and n maxShuffleThreads threads:
public NioServerSocketChannelFactory( Executor bossExecutor, Executor workerExecutor, int workerCount) { this(bossExecutor, 1, workerExecutor, workerCount); }
In Nio model, bossThread take care all bounded socket(listen socket), workerThread take care Accepted-socket (included IO and call event method such as messageReceived).
In case of the boss thread pool, actually the thread pool is unneeded because current implementation acquires only a single thread from it. That thread sleeps on the selector for server socket most of the time, after accepting connection that connection is registered with a worker. From that moment on worker is responsible for serving that connection.
Attachments
Issue Links
- is related to
-
TEZ-4157 ShuffleHandler: upgrade to Netty4 and remove Netty3 dependency from tez
- Resolved
- links to