-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: remove custom transport executor #2366
Conversation
Remove the custom executor provider that is set on the underlying generated clients and instead use the internal core gRPC executor provider. The latter is a shared executor provider for all gRPC channels that creates threads on demand. This prevents the creation of unnecessary threads at startup, and can reduce overall thread usage for applications that create multiple Spanner instances during their lifetime.
@@ -54,7 +54,10 @@ public ScheduledExecutorService get() { | |||
|
|||
@Override | |||
public void release(ScheduledExecutorService executor) { | |||
executor.shutdown(); | |||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cleans up errors that are being logged during tests, clogging up the test log.
SpannerOptions.newBuilder().setProjectId("test-project").enableGrpcGcpExtension().build(); | ||
SpannerOptions.newBuilder() | ||
.setProjectId("test-project") | ||
.setCredentials(NoCredentials.getInstance()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cleans up errors that are being logged during tests, clogging up the test log.
SpannerOptions options = | ||
SpannerOptions.newBuilder() | ||
.setProjectId("test-project") | ||
.setCredentials(NoCredentials.getInstance()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cleans up errors that are being logged during tests, clogging up the test log.
@@ -943,6 +951,7 @@ public void testNumChannelsWithGrpcGcpExtensionEnabled() { | |||
SpannerOptions options1 = | |||
SpannerOptions.newBuilder() | |||
.setProjectId("test-project") | |||
.setCredentials(NoCredentials.getInstance()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cleans up errors that are being logged during tests, clogging up the test log.
@@ -954,6 +963,7 @@ public void testNumChannelsWithGrpcGcpExtensionEnabled() { | |||
SpannerOptions options2 = | |||
SpannerOptions.newBuilder() | |||
.setProjectId("test-project") | |||
.setCredentials(NoCredentials.getInstance()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cleans up errors that are being logged during tests, clogging up the test log.
@@ -972,12 +982,19 @@ public void checkCreatedInstanceWhenGrpcGcpExtensionDisabled() { | |||
Spanner spanner2 = options1.getService(); | |||
|
|||
assertNotSame(spanner1, spanner2); | |||
|
|||
spanner1.close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cleans up errors that are being logged during tests, clogging up the test log.
SpannerOptions.newBuilder().setProjectId("test-project").enableGrpcGcpExtension().build(); | ||
SpannerOptions.newBuilder() | ||
.setProjectId("test-project") | ||
.setCredentials(NoCredentials.getInstance()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cleans up errors that are being logged during tests, clogging up the test log.
@@ -986,5 +1003,8 @@ public void checkCreatedInstanceWhenGrpcGcpExtensionEnabled() { | |||
Spanner spanner2 = options1.getService(); | |||
|
|||
assertNotSame(spanner1, spanner2); | |||
|
|||
spanner1.close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cleans up errors that are being logged during tests, clogging up the test log.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
🤖 I have created a release *beep* *boop* --- ## [6.40.0](https://togithub.com/googleapis/java-spanner/compare/v6.39.0...v6.40.0) (2023-04-14) ### Features * Savepoints ([#2278](https://togithub.com/googleapis/java-spanner/issues/2278)) ([b02f584](https://togithub.com/googleapis/java-spanner/commit/b02f58435b97346cc8e08a96635affe8383981bb)) ### Performance Improvements * Remove custom transport executor ([#2366](https://togithub.com/googleapis/java-spanner/issues/2366)) ([e27dbe5](https://togithub.com/googleapis/java-spanner/commit/e27dbe5f58229dab208eeeed44d53e741700c814)) ### Dependencies * Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.7.0 ([#2377](https://togithub.com/googleapis/java-spanner/issues/2377)) ([40402af](https://togithub.com/googleapis/java-spanner/commit/40402af54f94f16619d018e252181db29ae6855e)) * Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.21 ([#2379](https://togithub.com/googleapis/java-spanner/issues/2379)) ([ae7262d](https://togithub.com/googleapis/java-spanner/commit/ae7262d37391c0ec2fee1dcbb24899e4fa16ae17)) * Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.21 ([#2380](https://togithub.com/googleapis/java-spanner/issues/2380)) ([0cb159e](https://togithub.com/googleapis/java-spanner/commit/0cb159efc97f02b42f064244e3812a0fd3d82db6)) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
Remove the custom executor provider that is set on the underlying generated clients and instead use the internal core gRPC executor provider. The latter is a shared executor provider for all gRPC channels that creates threads on demand. This prevents the creation of unnecessary threads at startup, and can reduce overall thread usage for applications that create multiple Spanner instances during their lifetime.