Skip to content

Commit 036dbfd

Browse files
committed
chore(spanner): enable dynamic channel pooling by default
1 parent 42cc961 commit 036dbfd

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

google-cloud-spanner/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
<dependency>
163163
<groupId>com.google.cloud</groupId>
164164
<artifactId>grpc-gcp</artifactId>
165+
<version>1.6.2-SNAPSHOT</version>
165166
</dependency>
166167
<dependency>
167168
<groupId>io.grpc</groupId>

google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
import com.google.cloud.grpc.GcpManagedChannel;
6161
import com.google.cloud.grpc.GcpManagedChannelBuilder;
6262
import com.google.cloud.grpc.GcpManagedChannelOptions;
63+
import com.google.cloud.grpc.GcpManagedChannelOptions.GcpChannelPoolOptions;
6364
import com.google.cloud.grpc.GcpManagedChannelOptions.GcpMetricsOptions;
6465
import com.google.cloud.grpc.GrpcTransportOptions;
6566
import com.google.cloud.spanner.AdminRequestsPerMinuteExceededException;
@@ -589,8 +590,11 @@ private static GcpManagedChannelOptions grpcGcpOptionsWithMetrics(SpannerOptions
589590
if (metricsOptions.getNamePrefix().equals("")) {
590591
metricsOptionsBuilder.withNamePrefix("cloud.google.com/java/spanner/gcp-channel-pool/");
591592
}
593+
GcpChannelPoolOptions.Builder channelPoolOptionsBuilder =
594+
GcpChannelPoolOptions.newBuilder().setDynamicScaling(0, 100, Duration.ofMinutes(30L));
592595
return GcpManagedChannelOptions.newBuilder(grpcGcpOptions)
593596
.withMetricsOptions(metricsOptionsBuilder.build())
597+
.withChannelPoolOptions(channelPoolOptionsBuilder.build())
594598
.build();
595599
}
596600

0 commit comments

Comments
 (0)