hani-fouladgar commented on code in PR #11295:
URL: https://github.com/apache/ozone/pull/11295#discussion_r4123808292


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/InterSCMGrpcProtocolService.java:
##########
@@ -57,9 +57,30 @@ public class InterSCMGrpcProtocolService {
     this.port = conf.getInt(ScmConfigKeys.OZONE_SCM_GRPC_PORT_KEY,
         ScmConfigKeys.OZONE_SCM_GRPC_PORT_DEFAULT);
 
+    final long maxConnectionIdle = conf.getTimeDuration(
+        ScmConfigKeys.OZONE_SCM_HA_GRPC_SERVER_MAX_CONNECTION_IDLE,
+        ScmConfigKeys.OZONE_SCM_HA_GRPC_SERVER_MAX_CONNECTION_IDLE_DEFAULT,
+        TimeUnit.MILLISECONDS);
+    final long keepAliveTime = conf.getTimeDuration(
+        ScmConfigKeys.OZONE_SCM_HA_GRPC_SERVER_KEEPALIVE_TIME,
+        ScmConfigKeys.OZONE_SCM_HA_GRPC_SERVER_KEEPALIVE_TIME_DEFAULT,
+        TimeUnit.MILLISECONDS);
+    final long keepAliveTimeout = conf.getTimeDuration(
+        ScmConfigKeys.OZONE_SCM_HA_GRPC_SERVER_KEEPALIVE_TIMEOUT,
+        ScmConfigKeys.OZONE_SCM_HA_GRPC_SERVER_KEEPALIVE_TIMEOUT_DEFAULT,
+        TimeUnit.MILLISECONDS);
+    final long permitKeepAliveTime = conf.getTimeDuration(
+        ScmConfigKeys.OZONE_SCM_HA_GRPC_SERVER_PERMIT_KEEPALIVE_TIME,
+        ScmConfigKeys.OZONE_SCM_HA_GRPC_SERVER_PERMIT_KEEPALIVE_TIME_DEFAULT,
+        TimeUnit.MILLISECONDS);
+
     NettyServerBuilder nettyServerBuilder =
         ((NettyServerBuilder) ServerBuilder.forPort(port))
-            .maxInboundMessageSize(OzoneConsts.OZONE_SCM_CHUNK_MAX_SIZE);
+            .maxInboundMessageSize(OzoneConsts.OZONE_SCM_CHUNK_MAX_SIZE)
+            .maxConnectionIdle(maxConnectionIdle, TimeUnit.MILLISECONDS)
+            .keepAliveTime(keepAliveTime, TimeUnit.MILLISECONDS)
+            .keepAliveTimeout(keepAliveTimeout, TimeUnit.MILLISECONDS)
+            .permitKeepAliveTime(permitKeepAliveTime, TimeUnit.MILLISECONDS);

Review Comment:
   Good point. The compatible relationship is client `keepAliveTime` ≥ server 
`permitKeepAliveTime` — the client must not ping more often than the server 
permits, or the server closes the connection with `too_many_pings`. The 
defaults satisfy this (both 5m), and it's already noted in the 
`permit.keepalive.time` description; I'll add the reciprocal note to 
`ozone.scm.ha.grpc.client.keepalive.time` so it's visible from both sides. I'd 
prefer documenting over startup validation: gRPC enforces this at runtime 
rather than failing fast, and cross-validating the two values at startup could 
break clusters on upgrade. 



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