8000 feat: Use multiplexed sessions for read-only transactions by sakthivelmanii · Pull Request #3917 · googleapis/java-spanner · GitHub
[go: up one dir, main page]

Skip to content

feat: Use multiplexed sessions for read-only transactions #3917

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

Merged
merged 11 commits into from
Jun 23, 2025

Conversation

sakthivelmanii
Copy link
Collaborator
@sakthivelmanii sakthivelmanii commented Jun 17, 2025

Description:

Multi-use and single-use read-only transactions now use a single multiplexed session, instead of a session from the session pool. Multiplexed sessions can handle any number of queries and read-only transactions at the same time.

This change means that the client library will require fewer regular sessions to run the same workload. How much, depends on the distribution of read-only vs read/write transactions that are executed by the application.

Users do not need to take any specific action to re-configure their Spanner client due to this change. However, users who have configured a large number of Min or Max sessions in the session pool due to executing a large number of read-only transactions, could consider whether they can lower this number.

This change does not affect how read/write transactions are executed.

The use of multiplexed sessions can be disabled by setting the environment variable GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS=false.

See https://cloud.google.com/spanner/docs/sessions#multiplexed_sessions for more background information about multiplexed sessions.

@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Jun 17, 2025
Copy link
generated-files-bot bot commented Jun 17, 2025

Warning: This pull request is touching the following templated files:

  • .github/workflows/ci.yaml

@product-auto-label product-auto-label bot added api: spanner Issues related to the googleapis/java-spanner API. size: s Pull request size is small. and removed size: m Pull request size is medium. labels Jun 17, 2025
@sakthivelmanii sakthivelmanii force-pushed the make_mux_session_default branch from 9c195b1 to 6298992 Compare June 17, 2025 10:45
@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. and removed size: s Pull request size is small. labels Jun 17, 2025
@product-auto-label product-auto-label bot added size: s Pull request size is small. and removed size: xs Pull request size is extra small. labels Jun 18, 2025
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: s Pull request size is small. labels Jun 18, 2025
@sakthivelmanii sakthivelmanii marked this pull request as ready for review June 19, 2025 17:04
@sakthivelmanii sakthivelmanii requested review from a team as code owners June 19, 2025 17:04
rahul2393
rahul2393 previously approved these changes Jun 19, 2025
@harshachinta
Copy link
Contributor

Couple of suggestions - Please ignore if any of these points have already been addressed.

  1. Can we update the PR title to highlight the default behavior of using multiplexed sessions is only for read-only transactions and not for any other transaction types.
  2. With this change, we no longer run integration tests for read-only transactions using regular sessions. Since customers can still disable multiplexed sessions, we may need to continue verifying integration test coverage for the regular session path. Would it make sense to run these tests in continuous or nightly builds to ensure we catch any regressions?
  3. Currently, all client systest configurations use regular sessions, except for one (cloudclientmultiplexedsession), which explicitly enables multiplexed sessions. With this change, all systests will now run read-only transactions using multiplexed sessions. To maintain coverage, we may want to modify or add a lightweight systest that explicitly disables multiplexed sessions for read-only transactions, ensuring the regular session flow is still exercised.
    (Note: Since all client systests are currently disabled due to an ongoing issue, feel free to defer this if needed.)

@sakthivelmanii sakthivelmanii changed the title feat: Enable Multiplex session by default feat: Enable Multiplex session by default for RO transactions Jun 20, 2025
@sakthivelmanii
Copy link
Collaborator Author

@harshachinta Thanks for your inputs.

  1. I have updated it.
  2. Will introduce a new pipeline to run integration tests with regular session as well.
  3. Yes. I am waiting for the issues to be fixed in the systest side. I will ensure all the tests are running with mux session where as one systest is running with regular session

@sakthivelmanii sakthivelmanii changed the title feat: Enable Multiplex session by default for RO transactions feat: Use multiplexed sessions for read-only transactions Jun 20, 2025
@sakthivelmanii sakthivelmanii merged commit 37fdc27 into main Jun 23, 2025
42 checks passed
@sakthivelmanii sakthivelmanii deleted the make_mux_session_default branch June 23, 2025 08:56
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: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0