Skip to content

Commit a2e365f

Browse files
committed
perf: experiment with lower poll delays
1 parent 9cdba74 commit a2e365f

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

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

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import com.google.api.gax.grpc.GrpcTransportChannel;
3333
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
3434
import com.google.api.gax.longrunning.OperationFuture;
35+
import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
3536
import com.google.api.gax.retrying.ResultRetryAlgorithm;
3637
import com.google.api.gax.retrying.RetrySettings;
3738
import com.google.api.gax.retrying.TimedAttemptSettings;
@@ -485,15 +486,28 @@ public GapicSpannerRpc(final SpannerOptions options) {
485486
.build();
486487
this.instanceAdminStub = GrpcInstanceAdminStub.create(instanceAdminStubSettings);
487488

488-
this.databaseAdminStubSettings =
489+
DatabaseAdminStubSettings.Builder databaseAdminStubSettingsBuilder =
489490
options.getDatabaseAdminStubSettings().toBuilder()
490491
.setTransportChannelProvider(channelProvider)
491492
.setCredentialsProvider(credentialsProvider)
492493
.setStreamWatchdogProvider(watchdogProvider)
493494
.setTracerFactory(
494495
options.getApiTracerFactory(
495-
/* isAdminClient= */ true, isEmulatorEnabled(options, emulatorHost)))
496-
.build();
496+
/* isAdminClient= */ true, isEmulatorEnabled(options, emulatorHost)));
497+
databaseAdminStubSettingsBuilder
498+
.updateDatabaseDdlOperationSettings()
499+
.setPollingAlgorithm(
500+
OperationTimedPollAlgorithm.create(
501+
RetrySettings.newBuilder()
502+
.setInitialRetryDelayDuration(Duration.ofMillis(1500L))
503+
.setRetryDelayMultiplier(1.3)
504+
.setMaxRetryDelayDuration(Duration.ofMillis(30000L))
505+
.setInitialRpcTimeoutDuration(Duration.ZERO)
506+
.setRpcTimeoutMultiplier(1.0)
507+
.setMaxRpcTimeoutDuration(Duration.ZERO)
508+
.setTotalTimeoutDuration(Duration.ofMillis(86400000L))
509+
.build()));
510+
this.databaseAdminStubSettings = databaseAdminStubSettingsBuilder.build();
497511

498512
// Automatically retry RESOURCE_EXHAUSTED for GetOperation if auto-throttling of
499513
// administrative requests has been set. The GetOperation RPC is called repeatedly by gax

0 commit comments

Comments
 (0)