-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remote: gRPC load balancing. (Part 5)
Refactor ReferenceCountedChannel to use DynamicConnectionPool when creating new calls. This change allows existing remote execution/cache client dynamically create new connections on demand. This change includes rxjava3 to final jar so the size of install_base is increased (~6M for macOS). PiperOrigin-RevId: 359687769
- Loading branch information
Showing
19 changed files
with
446 additions
and
364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/main/java/com/google/devtools/build/lib/remote/GoogleChannelConnectionFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright 2021 The Bazel Authors. All rights reserved. | ||
// | ||
// Licensed 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 | ||
// | ||
// http://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 com.google.devtools.build.lib.remote; | ||
|
||
import com.google.devtools.build.lib.authandtls.AuthAndTLSOptions; | ||
import com.google.devtools.build.lib.remote.grpc.ChannelConnectionFactory; | ||
import io.grpc.ClientInterceptor; | ||
import io.reactivex.rxjava3.core.Single; | ||
import java.util.List; | ||
|
||
/** | ||
* A {@link ChannelConnectionFactory} which creates {@link ChannelConnection} using {@link | ||
* ChannelFactory}. | ||
*/ | ||
public class GoogleChannelConnectionFactory implements ChannelConnectionFactory { | ||
private final ChannelFactory channelFactory; | ||
private final String target; | ||
private final String proxy; | ||
private final AuthAndTLSOptions options; | ||
private final List<ClientInterceptor> interceptors; | ||
private final int maxConcurrency; | ||
|
||
public GoogleChannelConnectionFactory( | ||
ChannelFactory channelFactory, | ||
String target, | ||
String proxy, | ||
AuthAndTLSOptions options, | ||
List<ClientInterceptor> interceptors, | ||
int maxConcurrency) { | ||
this.channelFactory = channelFactory; | ||
this.target = target; | ||
this.proxy = proxy; | ||
this.options = options; | ||
this.interceptors = interceptors; | ||
this.maxConcurrency = maxConcurrency; | ||
} | ||
|
||
@Override | ||
public Single<ChannelConnection> create() { | ||
return Single.fromCallable( | ||
() -> | ||
new ChannelConnection(channelFactory.newChannel(target, proxy, options, interceptors))); | ||
} | ||
|
||
@Override | ||
public int maxConcurrency() { | ||
return maxConcurrency; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120 changes: 0 additions & 120 deletions
120
src/main/java/com/google/devtools/build/lib/remote/ReferenceCountedChannelPool.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.