-
Notifications
You must be signed in to change notification settings - Fork 119
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: close sessions async #24
Conversation
The binary compatibility check fails because of:
Both |
Sessions should be closed using an async gRPC call in order to speed up the closing of a large session pool. Instead of using its own executor, which is limited to 8 worker threads, to execute asynchronous delete session calls, the session pool should use the asynchronous call option in gRPC. This allows a larger number of asynchronous delete session calls to be executed in parallel and speeds up closing a session pool with a large number of sessions. Testing against a real Cloud Spanner database with a session pool containing 1,000 sessions shows the following performance for closing the session pool: Before (3 runs): 6603ms 8169ms 8367ms After (3 runs): 1297ms 1710ms 1851ms Fixes #19.
b3cfae4
to
a2be792
Compare
google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolStressTest.java
Outdated
Show resolved
Hide resolved
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, thanks for the benchmarking test 👍.
@skuruppu @hengfengli @chingor13 So:
|
I don't believe it should be flagged as a breaking change given that we should reserve those when making backwards-incompatible changes that requires users to rebuild their apps.
I'm not sure actually :( @kolea2 would you be able to advice us on whether it's ok to ignore a Binary Compatibility failure and merge this change. I don't know why the Java 11 test fails so I triggered a rebuild. |
As discussed offline, it's ok to push this change despite the Binary Compatibility failure since the changes being made are to internal interfaces. |
Yikes, it turns out the compatibility check just keeps failing for all future PRs as well. I was hoping that it would stop complaining after it was merged in. Let me check with @kolea2 offline about what we can do to fix this issue. |
Should we revert this change? We can wait until it is resolved so that we can merge it in. |
Yeah good point. I'll revert it now. |
asyncClose() was added to com.google.cloud.spanner.Session and asyncDeleteSession() was added to com.google.cloud.spanner.spi.v1.SpannerRpc in #24 which resulted in binary compatibility test failures. This config allows us to ignore the failure.
* Revert "Revert "perf: close sessions async (#24)" (#43)" This reverts commit 809ed88. * Ignore compatibility check failure in internal interfaces. asyncClose() was added to com.google.cloud.spanner.Session and asyncDeleteSession() was added to com.google.cloud.spanner.spi.v1.SpannerRpc in #24 which resulted in binary compatibility test failures. This config allows us to ignore the failure. * Annotate SpannerRpc and Session classes as @internalapi. Users shouldn't be implementing these interfaces as they're internal to the client library implementation.
Sessions should be closed using an async gRPC call in order to speed up the closing of a large session pool. Instead of using its own executor, which is limited to 8 worker threads, to execute asynchronous delete session calls, the session pool should use the asynchronous call option in gRPC. This allows a larger number of asynchronous delete session calls to be executed in parallel and speeds up closing a session pool with a large number of sessions.
Testing against a real Cloud Spanner database with a session pool containing 1,000 sessions shows the following performance for closing the session pool:
Without this change (3 test runs):
6603ms
8169ms
8367ms
With this change (3 test runs):
1297ms
1710ms
1851ms
Fixes #19