szetszwo commented on a change in pull request #599:
URL: https://github.com/apache/ratis/pull/599#discussion_r805569768



##########
File path: ratis-netty/src/main/java/org/apache/ratis/netty/NettyConfigKeys.java
##########
@@ -106,6 +106,44 @@ static TimeDuration 
clientReplyQueueGracePeriod(RaftProperties properties) {
     static void setClientReplyQueueGracePeriod(RaftProperties properties, 
TimeDuration timeoutDuration) {
       setTimeDuration(properties::setTimeDuration, 
CLIENT_REPLY_QUEUE_GRACE_PERIOD_KEY, timeoutDuration);
     }
+
+    String SERVER_BOSS_GROUP_THREADS_KEY = PREFIX + 
".server.boss-group.threads";
+    int SERVER_BOSS_GROUP_THREADS_DEFAULT = 0;
+
+    static int serverBossGroupThreads(RaftProperties properties) {
+      return getInt(properties::getInt, SERVER_BOSS_GROUP_THREADS_KEY,
+          SERVER_BOSS_GROUP_THREADS_DEFAULT, getDefaultLog(),
+          requireMin(0), requireMax(65536));
+    }
+
+    static void setServerBossGroupThreads(RaftProperties properties, int num) {
+      setInt(properties::setInt, SERVER_BOSS_GROUP_THREADS_KEY, num);
+    }
+
+    String SERVER_WORKER_GROUP_THREADS_KEY = PREFIX + ".worker-group.threads";
+    int SERVER_WORKER_GROUP_THREADS_DEFAULT = 0;
+
+    static int serverWorkerGroupThreads(RaftProperties properties) {
+      return getInt(properties::getInt, SERVER_WORKER_GROUP_THREADS_KEY,
+          SERVER_WORKER_GROUP_THREADS_DEFAULT, getDefaultLog(),
+          requireMin(0), requireMax(65536));
+    }
+
+    static void setServerWorkerGroupThreads(RaftProperties properties, int 
num) {
+      setInt(properties::setInt, SERVER_WORKER_GROUP_THREADS_KEY, num);
+    }
+
+    String SERVER_EPOLL_ENABLE_KEY = PREFIX + ".epoll.enable";

Review comment:
       Let's call it "use-epoll".
   ```
         String USE_EPOLL_KEY = PREFIX + ".use-epoll";
   ```

##########
File path: 
ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyServerStreamRpc.java
##########
@@ -30,6 +30,7 @@
 import org.apache.ratis.server.DataStreamServerRpc;
 import org.apache.ratis.server.RaftServer;
 import org.apache.ratis.server.RaftServerConfigKeys;
+import 
org.apache.ratis.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder;

Review comment:
       Use ConcurrentUtils.newThreadFactory(..) instead.  We should avoid 
external dependency.

##########
File path: 
ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyServerStreamRpc.java
##########
@@ -127,12 +131,33 @@ public NettyServerStreamRpc(RaftServer server) {
     }
 
     final int port = NettyConfigKeys.DataStream.port(properties);
+
+    final int accepterThreads = 
NettyConfigKeys.DataStream.serverBossGroupThreads(properties);
+    final int workerThreads = 
NettyConfigKeys.DataStream.serverWorkerGroupThreads(properties);
+
+    boolean epollEnable = 
NettyConfigKeys.DataStream.serverEpollEnable(properties) && Epoll.isAvailable();

Review comment:
       Print a warning if use-epoll but !Epoll.isAvailable().




-- 
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]


Reply via email to