Skip to content
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

Merged
merged 3 commits into from Apr 12, 2023
Merged

Conversation

olavloite
Copy link
Collaborator

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.

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.
@olavloite olavloite requested a review from a team as a code owner April 7, 2023 10:13
@product-auto-label product-auto-label bot added size: l Pull request size is large. api: spanner Issues related to the googleapis/java-spanner API. labels Apr 7, 2023
@gcf-owl-bot gcf-owl-bot bot requested a review from a team as a code owner April 7, 2023 10:16
@@ -54,7 +54,10 @@ public ScheduledExecutorService get() {

@Override
public void release(ScheduledExecutorService executor) {
executor.shutdown();
try {
Copy link
Collaborator Author

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())
Copy link
Collaborator Author

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())
Copy link
Collaborator Author

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())
Copy link
Collaborator Author

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())
Copy link
Collaborator Author

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();
Copy link
Collaborator Author

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())
Copy link
Collaborator Author

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();
Copy link
Collaborator Author

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.

Copy link
Contributor

@thiagotnunes thiagotnunes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@olavloite olavloite merged commit e27dbe5 into main Apr 12, 2023
23 checks passed
@olavloite olavloite deleted the remove-custom-executor branch April 12, 2023 07:06
gcf-merge-on-green bot pushed a commit that referenced this pull request Apr 14, 2023
🤖 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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/java-spanner API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants