Skip to content

Conversation

@olavloite
Copy link

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

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
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 3, 2019
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;
Copy link

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?

Copy link
Author

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:

  1. Accept this, and instruct users to change their session pool configuration in these cases?
  2. Change the behavior of SessionPoolConfiguration.Builder.setMaxSessions(int) into automatically also change MinSessions if the new value for MaxSessions is less than the current value for MinSession?
  3. Something else?

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.

  1. If user has set both min sessions and max sessions, use the user settings.
  2. If user has only set max sessions but not min sessions, then set min sessions = max sessions.
  3. If user hasn't set either min or max sessions, then set min sessions to 100.

Hope that helps.

@codecov
Copy link

codecov bot commented Oct 4, 2019

Codecov Report

Merging #6429 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
...able/gaxx/reframing/ReframingResponseObserver.java 88.99% <0%> (-1.84%) 29% <0%> (-1%)
...oogle/cloud/spanner/jdbc/SingleUseTransaction.java 86% <0%> (-0.5%) 36% <0%> (ø)
...m/google/cloud/spanner/jdbc/ConnectionOptions.java 83.63% <0%> (+1.21%) 46% <0%> (ø) ⬇️
...m/google/cloud/spanner/jdbc/StatementExecutor.java 91.11% <0%> (+6.66%) 8% <0%> (+1%) ⬆️
...main/java/com/google/cloud/datastore/GqlQuery.java 44.75% <0%> (+7.16%) 11% <0%> (+2%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 19eee78...bfc9ba3. Read the comment docs.

@skuruppu skuruppu merged commit d6182e6 into googleapis:master Oct 15, 2019
@olavloite olavloite deleted the spanner-min-sessions-100 branch October 15, 2019 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spanner: BatchCreateSessions

3 participants