Skip to content

Commit cb408f5

Browse files
committed
[#2595] Add configurable 'RPC_RETRY_BACKOFF_MS' option into GrpcClient
1 parent 19d5e8a commit cb408f5

File tree

1 file changed

+19
-4
lines changed
  • internal-client/src/main/java/org/apache/uniffle/client/impl/grpc

1 file changed

+19
-4
lines changed

internal-client/src/main/java/org/apache/uniffle/client/impl/grpc/GrpcClient.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.slf4j.Logger;
2626
import org.slf4j.LoggerFactory;
2727

28+
import org.apache.uniffle.common.config.RssClientConf;
2829
import org.apache.uniffle.common.util.GrpcNettyUtils;
2930

3031
public abstract class GrpcClient {
@@ -34,17 +35,33 @@ public abstract class GrpcClient {
3435
protected int port;
3536
protected boolean usePlaintext;
3637
protected int maxRetryAttempts;
38+
protected long rpcRetryBackoffMs;
3739
protected ManagedChannel channel;
3840

3941
protected GrpcClient(String host, int port, int maxRetryAttempts, boolean usePlaintext) {
40-
this(host, port, maxRetryAttempts, usePlaintext, 0, 0, 0, -1);
42+
this(
43+
host,
44+
port,
45+
maxRetryAttempts,
46+
usePlaintext,
47+
RssClientConf.RPC_RETRY_BACKOFF_MS.defaultValue(),
48+
0,
49+
0,
50+
0,
51+
-1);
52+
}
53+
54+
protected GrpcClient(
55+
String host, int port, int maxRetryAttempts, boolean usePlaintext, long rpcRetryBackoffMs) {
56+
this(host, port, maxRetryAttempts, usePlaintext, rpcRetryBackoffMs, 0, 0, 0, -1);
4157
}
4258

4359
protected GrpcClient(
4460
String host,
4561
int port,
4662
int maxRetryAttempts,
4763
boolean usePlaintext,
64+
long rpcRetryBackoffMs,
4865
int pageSize,
4966
int maxOrder,
5067
int smallCacheSize,
@@ -53,6 +70,7 @@ protected GrpcClient(
5370
this.port = port;
5471
this.maxRetryAttempts = maxRetryAttempts;
5572
this.usePlaintext = usePlaintext;
73+
this.rpcRetryBackoffMs = rpcRetryBackoffMs;
5674

5775
if (nettyEventLoopThreads > 0) {
5876
System.setProperty(
@@ -69,9 +87,6 @@ protected GrpcClient(
6987
channelBuilder.usePlaintext();
7088
}
7189

72-
if (maxRetryAttempts > 0) {
73-
channelBuilder.enableRetry().maxRetryAttempts(maxRetryAttempts);
74-
}
7590
channelBuilder.maxInboundMessageSize(Integer.MAX_VALUE);
7691

7792
channel = channelBuilder.build();

0 commit comments

Comments
 (0)