-
Notifications
You must be signed in to change notification settings - Fork 59
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
[DRAFT] feat: dynamic channel pool #799
Closed
daniel-sanche
wants to merge
44
commits into
googleapis:experimental_v3
from
daniel-sanche:dynamic_channel_pool
Closed
[DRAFT] feat: dynamic channel pool #799
daniel-sanche
wants to merge
44
commits into
googleapis:experimental_v3
from
daniel-sanche:dynamic_channel_pool
Conversation
This file contains 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
product-auto-label
bot
added
size: xl
Pull request size is extra large.
api: bigtable
Issues related to the googleapis/python-bigtable API.
labels
Jun 15, 2023
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: xl
Pull request size is extra large.
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.
This PR adds dynamic channel pooling, where channel pools will resize depending on channel usage patterns. To implement this, I moved more logic into grpc channel subclasses, resulting in the following classes:
_WrappedChannel
: a generic class that holds a grpc channel, and delegates all calls to the wrapped object_BackgroundTaskMixin
: an interface/mixin class that provides logic for starting and managing a background task associated with a grpc channelRefreshableChannel
: a channel that uses_BackgroundTaskMixin
and_WrappedChannel
to periodically refresh the wrapped channel, and call a warm up callback when the new channel is set up. This replaces some logic that was currently in the clientTrackedChannel
: a_WrappedChannel
that keeps tracks of the counts number of active rpcs as they are sentPooledChannel
: a grpc channel subclass that maintains a static pool of channels, and alternates incoming requests between them. For our use-case, (if we allow static channels) each channel in the pool will be aRefreshableChannel
.DynamicPooledChannel
: aPooledChannel
that wraps each channel in the pool in aTrackedChannel
, and maintains a_BackgroundTaskMixin
task to periodically change the pool size based on channel usage.TODO:
RefreshableChannel
withTrackedChannel
, to cut down on the layers of wrappingCacheableChannel
that saves and returns a cahed MultiCallable, to avoid the overhead of creating one on each call (does grpc already do this internally?)Later:
_channel_pooling
intoapi_core
, to share with other libraries