Skip to content

Conversation

@daniel-sanche
Copy link
Contributor

@daniel-sanche daniel-sanche commented Jul 28, 2025

python-bigtable performs pre-emptive refresh of its grpc channel. This means it has a background task to automatically cycle out the grpc channel with a new pre-warmed one every ~45 mins, to avoid latency spikes when the channel eventually expires

The current implementation has issues:

To fix this, this PR adds a new SwappableChannel class, that wraps a real grpc channel, but provides methods to swap out the channel internally. This allows the channel refrence used by the gapic layer to remain constant, and leads to less abstraction leakage (issue 2/3). The ReplaceableChannel can also store the arguments used to init the channel, and re-use the same arguments when creating new ones (issue 1)

I performed some benchmarks, and didn't see a performance regression from this change

Fixes #1094

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigtable Issues related to the googleapis/python-bigtable API. labels Jul 28, 2025
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Jul 29, 2025
@daniel-sanche daniel-sanche marked this pull request as ready for review July 29, 2025 22:51
@daniel-sanche daniel-sanche requested review from a team as code owners July 29, 2025 22:51
@daniel-sanche daniel-sanche added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 25, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 25, 2025
@daniel-sanche daniel-sanche merged commit 6fa3008 into main Aug 26, 2025
33 of 35 checks passed
@daniel-sanche daniel-sanche deleted the refactor_refresh branch August 26, 2025 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigtable Issues related to the googleapis/python-bigtable API. size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor channel refresh to avoid internal api_core references

5 participants