Skip to content

Commit

Permalink
feat: resizing channel pool size based on the work load
Browse files Browse the repository at this point in the history
  • Loading branch information
mutianf committed Jun 1, 2022
1 parent 1aaa80d commit 897cd09
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -24,6 +24,7 @@
import com.google.api.gax.batching.FlowController.LimitExceededBehavior;
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.grpc.ChannelPoolSettings;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.retrying.RetrySettings;
import com.google.api.gax.rpc.FixedHeaderProvider;
Expand Down Expand Up @@ -250,7 +251,13 @@ public Map<String, String> getJwtAudienceMapping() {
/** Returns a builder for the default ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return BigtableStubSettings.defaultGrpcTransportProviderBuilder()
.setPoolSize(getDefaultChannelPoolSize())
.setChannelPoolSettings(
ChannelPoolSettings.builder()
.setInitialChannelCount(2 * Runtime.getRuntime().availableProcessors())
.setMinRpcsPerChannel(1)
.setMaxRpcsPerChannel(50)
.setPreemptiveRefreshEnabled(true)
.build())
.setMaxInboundMessageSize(MAX_MESSAGE_SIZE)
.setKeepAliveTime(Duration.ofSeconds(30)) // sends ping in this interval
.setKeepAliveTimeout(
Expand Down

0 comments on commit 897cd09

Please sign in to comment.