Skip to content

perf(spanner): add gRPC channel pooling#5491

Open
olavloite wants to merge 2 commits intogoogleapis:mainfrom
olavloite:spanner-channel-pool
Open

perf(spanner): add gRPC channel pooling#5491
olavloite wants to merge 2 commits intogoogleapis:mainfrom
olavloite:spanner-channel-pool

Conversation

@olavloite
Copy link
Copy Markdown
Contributor

Applications that use Spanner for high throughput often need more than one gRPC channel in order to achieve the best possible performance. Having more than one channel both increases the number of concurrent streams that an application can have open at any time (the limit is 100 per gRPC channel), and distributes the load that is generated by the application across multiple Spanner frontends.

See also go/spanner-rust-channel-pool

Applications that use Spanner for high throughput often need more than one
gRPC channel in order to achieve the best possible performance. Having more
than one channel both increases the number of concurrent streams that an
application can have open at any time (the limit is 100 per gRPC channel),
and distributes the load that is generated by the application across
multiple Spanner frontends.
@olavloite olavloite requested review from a team as code owners April 22, 2026 08:17
@product-auto-label product-auto-label Bot added the api: spanner Issues related to the Spanner API. label Apr 22, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

❌ Patch coverage is 97.68212% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.74%. Comparing base (47cfd15) to head (a5cd5fa).

Files with missing lines Patch % Lines
src/spanner/src/client.rs 95.65% 7 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #5491    +/-   ##
========================================
  Coverage   97.73%   97.74%            
========================================
  Files         218      218            
  Lines       49013    49236   +223     
========================================
+ Hits        47904    48124   +220     
- Misses       1109     1112     +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/spanner/src/client.rs
let transport =
crate::generated::gapic_dataplane::transport::Spanner::new(config.clone()).await?;
let grpc_client = transport.inner.clone();
let num_channels = std::env::var("SPANNER_NUM_CHANNELS")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will add a 'normal' configuration option for this as well in a follow-up PR (assuming that we go with this solution)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this helps, but consider:

pub grpc_subchannel_count: Option<usize>,

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 Spanner API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants