cshannon commented on code in PR #4715:
URL: https://github.com/apache/accumulo/pull/4715#discussion_r1675791412


##########
server/base/src/main/java/org/apache/accumulo/server/grpc/CompactionCoordinatorServiceServer.java:
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.server.grpc;
+
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+
+import 
org.apache.accumulo.core.compaction.protobuf.CompactionCoordinatorServiceGrpc;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.grpc.Grpc;
+import io.grpc.InsecureServerCredentials;
+import io.grpc.Server;
+import io.grpc.ServerBuilder;
+
+/**
+ * Simple wrapper to start/stop the grpc server
+ */
+public class CompactionCoordinatorServiceServer {
+
+  private static final Logger logger =
+      LoggerFactory.getLogger(CompactionCoordinatorServiceServer.class);
+
+  private final int port;
+  private final Server server;
+
+  public CompactionCoordinatorServiceServer(
+      CompactionCoordinatorServiceGrpc.CompactionCoordinatorServiceImplBase 
service, int port)
+      throws IOException {
+    this(Grpc.newServerBuilderForPort(port, 
InsecureServerCredentials.create()), service, port);

Review Comment:
   We should be able to configure different pools for requests and responses 
for sure. gRPC is async based out of the box so we will be using a different 
thread for sending responses.
   
   I found this helpful [post](https://stackoverflow.com/a/42422045) which is 
written by one of the contributors to the java grpc library which explains how 
to configure the thread pool for the responses vs requests.
   
   We are using the generic 
[ServerBuilder](https://grpc.github.io/grpc-java/javadoc/io/grpc/ServerBuilder.html)
 API right now which allows setting an 
[executor](https://grpc.github.io/grpc-java/javadoc/io/grpc/ServerBuilder.html#executor(java.util.concurrent.Executor))
 and that is for the responses according to that post. We could switch to using 
the more specific 
[NettyServerBuilder](https://grpc.github.io/grpc-java/javadoc/io/grpc/netty/NettyServerBuilder.html)
 instead and that would also allow us to 
[configure](https://grpc.github.io/grpc-java/javadoc/io/grpc/netty/NettyServerBuilder.html#workerEventLoopGroup(io.netty.channel.EventLoopGroup))
 the event loop for the incoming requests and tune that.



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