feat(spanner): add experimental numChannels round-robin transport mode#8138
Open
feat(spanner): add experimental numChannels round-robin transport mode#8138
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces an experimental numChannels option to the Spanner client, enabling manual gRPC channel pooling and round-robin assignment for transaction RPCs as an alternative to grpc-gcp. The changes involve managing multiple internal client instances within the Spanner class and ensuring that transactions consistently use the same channel via a channelHint. Feedback was provided regarding the round-robin counter implementation to avoid potential precision loss by applying the modulo operation during increment.
d2b0789 to
16ef557
Compare
db605e3 to
77dea0d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an experimental fixed-channel round-robin mode for Spanner data RPCs.
By default, when no customer
grpc.gcpApiConfigis provided, Spanner now usesnumChannels = 4and disables grpc-gcp channel pooling for Spanner data RPCs. Customers can override the channel count withnumChannels, or continue using grpc-gcp by passing a customgrpc.gcpApiConfig.When fixed-channel mode is active:
grpc.use_local_subchannel_pool = 1is set so grpc-js does not share one transportMotivation
Multiplexed sessions currently bind transaction RPCs to the session affinity key under grpc-gcp, which can pin high-concurrency write workloads to one HTTP/2 transport. Fixed-channel mode enables round-robin distribution while preserving transaction stickiness.
Validation
Added local benchmark tooling with Go mock Spanner server:
table.insert()callsObserved warmed run with default
numChannels = 4:Observed warmed run with
SPANNER_NUM_CHANNELS=10:Notes
This is experimental and currently focused on Spanner data RPC routing. Admin clients continue to use normal shared client behavior. Customers with custom grpc-gcp configs can keep the grpc-gcp path by passing
grpc.gcpApiConfig.