Skip to content
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

feat: add support for configuring minimum num gRPC channels on CacheClient #345

Merged
merged 1 commit into from
Dec 21, 2023

Conversation

cprice404
Copy link
Contributor

Prior to this commit, each instance of the CacheClient would always
open a single gRPC channel to the server. This commit adds a configuration
setting on the GrpcConfiguration object which allows a user to configure
a minimum number of channels; this is useful for cases where callers will
be issuing more than 100 concurrent requests, since 100 is the maximum
number of requests that can be multiplexed over a single channel.

…lient

Prior to this commit, each instance of the CacheClient would always
open a single gRPC channel to the server. This commit adds a configuration
setting on the GrpcConfiguration object which allows a user to configure
a minimum number of channels; this is useful for cases where callers will
be issuing more than 100 concurrent requests, since 100 is the maximum
number of requests that can be multiplexed over a single channel.
Copy link
Contributor

@bruuuuuuuce bruuuuuuuce left a comment

Choose a reason for hiding this comment

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

One nit otherwise LGTM

@@ -48,6 +54,8 @@ final class ScsDataGrpcStubsManager implements AutoCloseable {
ScsDataGrpcStubsManager(
@Nonnull CredentialProvider credentialProvider, @Nonnull Configuration configuration) {
this.deadline = configuration.getTransportStrategy().getGrpcConfiguration().getDeadline();
this.numGrpcChannels =
configuration.getTransportStrategy().getGrpcConfiguration().getMinNumGrpcChannels();
Copy link
Contributor

Choose a reason for hiding this comment

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

just wondering, why name it minNumGrpcChannels when it looks like its the exact number of grpc channels that get created. min to me implies that we will create more over time if we need to

Copy link
Contributor

Choose a reason for hiding this comment

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

unless that is a future optimization that we plan on doing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

astute observation!

You guessed exactly right. In an ideal world I would like to make this dynamic; keep track of how many open requests they have, and automatically add more channels as needed. But that is a bigger/riskier change that will require a lot of perf testing, so I don't want to tackle it right now.

In the future, if we add that, then this setting would become the floor rather than the exact number of channels.

lmk if that makes sense.

@cprice404 cprice404 merged commit 223a5d5 into main Dec 21, 2023
5 checks passed
@cprice404 cprice404 deleted the config-for-multiple-channels branch December 21, 2023 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants