-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Spanner: Change default MinSessions to 100 #6429
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
Spanner: Change default MinSessions to 100 #6429
Conversation
Changes the default MinSessions configuration for Cloud Spanner to 100 sessions. The sessions are created using the new BatchCreateSessions API of Spanner, meaning that initializing the pool will finish quickly. Fixes googleapis#6169
| Statement.of("UPDATE FOO SET BAR=1 WHERE BAZ=2"); | ||
| private static final long UPDATE_COUNT = 1L; | ||
| private static final int MAX_SESSIONS = 10; | ||
| // private static final int MAX_SESSIONS = 10; |
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.
Why is this commented out?
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.
Good spot. The line needed to be removed, as it would be invalid to configure a session pool with MaxSessions=10 now that MinSessions=100 is the default. I was testing a couple of things during testing, and therefore I had only commented it out, instead of actually removing it.
This does trigger another thought, though: Changing the default of MinSessions to 100, means that anyone that currently has a session pool configuration with MaxSessions set to anything between 1 and 99 (inclusive) will get an error after this change, as the session pool configuration will be invalid (MaxSessions >= MinSessions is enforced by the session pool). Do we want to:
- Accept this, and instruct users to change their session pool configuration in these cases?
- Change the behavior of
SessionPoolConfiguration.Builder.setMaxSessions(int)into automatically also changeMinSessionsif the new value forMaxSessionsis less than the current value forMinSession? - Something else?
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.
I prefer option 2. If the user has bother to explicitly set a max session size, then I feel that we should respect it.
- If user has set both min sessions and max sessions, use the user settings.
- If user has only set max sessions but not min sessions, then set min sessions = max sessions.
- If user hasn't set either min or max sessions, then set min sessions to 100.
Hope that helps.
Codecov Report
@@ Coverage Diff @@
## master #6429 +/- ##
============================================
+ Coverage 46.34% 46.34% +<.01%
- Complexity 27967 27985 +18
============================================
Files 2613 2613
Lines 287929 287931 +2
Branches 33756 33751 -5
============================================
+ Hits 133443 133456 +13
+ Misses 144267 144255 -12
- Partials 10219 10220 +1
Continue to review full report at Codecov.
|
Changes the default MinSessions configuration for Cloud Spanner to 100 sessions. The sessions are created using the new BatchCreateSessions API of Spanner, meaning that initializing the
pool will finish quickly.
Fixes #6169