ChenSammi commented on a change in pull request #2498:
URL: https://github.com/apache/ozone/pull/2498#discussion_r726724584



##########
File path: 
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationServer.java
##########
@@ -57,22 +67,52 @@
 
   private int port;
 
+  private int poolSize;
+
+  private int queueLimit;
+
+  private ThreadPoolExecutor executor;
+
+  private EventLoopGroup eventLoopGroup;
+
   public ReplicationServer(
       ContainerController controller,
       ReplicationConfig replicationConfig,
-      SecurityConfig secConf,
-      CertificateClient caClient
-  ) {
+      SecurityConfig secConf, DatanodeConfiguration dnConfig,
+      CertificateClient caClient) {
     this.secConf = secConf;
     this.caClient = caClient;
     this.controller = controller;
     this.port = replicationConfig.getPort();
+    this.poolSize = dnConfig.getReplicationMaxStreams();
+    this.queueLimit = dnConfig.getReplicationQueueLimit();
     init();
   }
 
   public void init() {
+    executor = new ThreadPoolExecutor(
+        poolSize, poolSize, 60, TimeUnit.SECONDS,
+        new LinkedBlockingQueue<>(queueLimit),
+        new ThreadFactoryBuilder().setDaemon(true)
+            .setNameFormat("ReplicationServerExecutor-%d")
+            .build());
+
+    Class channelType;
+
+    if (Epoll.isAvailable()) {
+      eventLoopGroup = new EpollEventLoopGroup(poolSize * 2);
+      channelType = EpollServerDomainSocketChannel.class;
+    } else {
+      eventLoopGroup = new NioEventLoopGroup(poolSize * 2);
+      channelType = NioServerSocketChannel.class;
+    }
+
     NettyServerBuilder nettyServerBuilder = NettyServerBuilder.forPort(port)
         .maxInboundMessageSize(OzoneConsts.OZONE_SCM_CHUNK_MAX_SIZE)
+        .workerEventLoopGroup(eventLoopGroup)
+        .bossEventLoopGroup(eventLoopGroup)
+        .channelType(channelType)

Review comment:
       @adoroszlai , thanks for the code review.   It's because 
EpollServerSocketChannel is not supported on Mac. I believe most of us  use Mac 
for code develoepment.  I'd like to make sure replication related unit tests 
will not fail on Mac book.   You can find that there is an channelType identify 
process ahead. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to