aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google
diff options
context:
space:
mode:
authorGravatar olaola <olaola@google.com>2017-07-14 17:31:19 +0200
committerGravatar Jakob Buchgraber <buchgr@google.com>2017-07-17 10:10:45 +0200
commit33bd2570b7e942eaf13145c66adc53f223c0b80b (patch)
treef66acf8582eac1b7689e132eaaca11f547463397 /src/main/java/com/google
parente0b6a21750f93739de4e0ff50eb13b90c60cc286 (diff)
Update the gRPC channels for remote caching and execution to use a RoundRobin client side load balancer instead of the default PickFirst.
A RoundRobin rotates between all addresses returned by the resolver, while PickFirst sends all traffic to the first address. This might help resolve some of the load problems we encountered (see https://github.com/grpc/grpc/issues/11704 for more details). TESTED=remote worker PiperOrigin-RevId: 161960008
Diffstat (limited to 'src/main/java/com/google')
-rw-r--r--src/main/java/com/google/devtools/build/lib/remote/GrpcUtils.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/remote/GrpcUtils.java b/src/main/java/com/google/devtools/build/lib/remote/GrpcUtils.java
index 8f91c51708..e559885a02 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/GrpcUtils.java
+++ b/src/main/java/com/google/devtools/build/lib/remote/GrpcUtils.java
@@ -18,6 +18,8 @@ import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe;
import io.grpc.ManagedChannel;
import io.grpc.netty.NegotiationType;
import io.grpc.netty.NettyChannelBuilder;
+import io.grpc.util.RoundRobinLoadBalancerFactory;
+
import java.io.IOException;
/** Helper methods for gRPC calls */
@@ -29,7 +31,8 @@ final class GrpcUtils {
NettyChannelBuilder builder =
NettyChannelBuilder.forTarget(target)
.negotiationType(
- channelOptions.tlsEnabled() ? NegotiationType.TLS : NegotiationType.PLAINTEXT);
+ channelOptions.tlsEnabled() ? NegotiationType.TLS : NegotiationType.PLAINTEXT)
+ .loadBalancerFactory(RoundRobinLoadBalancerFactory.getInstance());
if (channelOptions.getSslContext() != null) {
builder.sslContext(channelOptions.getSslContext());
if (channelOptions.getTlsAuthorityOverride() != null) {