You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@tez.apache.org by "László Bodor (Jira)" <ji...@apache.org> on 2023/02/28 08:39:00 UTC

[jira] [Updated] (TEZ-4394) Netty4 ShuffleHandler: should use 1 boss thread

     [ https://issues.apache.org/jira/browse/TEZ-4394?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

László Bodor updated TEZ-4394:
------------------------------
    Fix Version/s: 0.10.3

> Netty4 ShuffleHandler: should use 1 boss thread
> -----------------------------------------------
>
>                 Key: TEZ-4394
>                 URL: https://issues.apache.org/jira/browse/TEZ-4394
>             Project: Apache Tez
>          Issue Type: Bug
>            Reporter: László Bodor
>            Assignee: László Bodor
>            Priority: Major
>             Fix For: 0.10.3
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> https://github.com/apache/tez/commit/01847814d32aac6b77a6810ea25d6780fb94b257#diff-5c5dffcaf349fe521937812b49849c59fba3e67fc53d74fb990b7e0ef7ff5e59R182
> {code}
>     bossGroup = new NioEventLoopGroup(maxShuffleThreads, new ThreadFactory() {
>       @Override
>       public Thread newThread(Runnable r) {
>         return new Thread(r, BOSS_THREAD_NAME_PREFIX + bossThreadCounter.incrementAndGet());
>       }
>     });
> {code}
> With netty3, we initialized NioServerSocketChannelFactory with below constructor:
> {code}
>     selector = new NioServerSocketChannelFactory(
>         Executors.newCachedThreadPool(bossFactory),
>         Executors.newCachedThreadPool(workerFactory),
>         maxShuffleThreads);
> {code}
> this always creates 1 boss and n maxShuffleThreads threads:
> {code}
>     public NioServerSocketChannelFactory(
>             Executor bossExecutor, Executor workerExecutor,
>             int workerCount) {
>         this(bossExecutor, 1, workerExecutor, workerCount);
>     }
> {code}
> 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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)