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

A42 update: io.grpc.channel_id should be initialized with a random number #320

Merged
merged 3 commits into from Sep 15, 2022

Conversation

Comment on lines 97 to 100
(Note that we do not recommend that applications create multiple gRPC
channels to the same virtual host, but if you do that, then the
behavior here will not be exactly the same as using `connection_properties`,
because each channel may use a different endpoint.)
because each channel may use a different endpoint.). In order to facilitate
Copy link
Member

Choose a reason for hiding this comment

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

(Note that we do not recommend that applications create multiple gRPC
channels to the same virtual host, but if you do that, then the
behavior here will not be exactly the same as using connection_properties,
because each channel may use a different endpoint.)

Did we want that behavior? Because we could initialize this ID globally to a process if desired.

Also: nit: no period after the parenthetical sentence. But should this sentence come before it, maybe?

Copy link
Contributor Author

@apolcyn apolcyn Aug 19, 2022

Choose a reason for hiding this comment

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

Did we want that behavior? Because we could initialize this ID globally to a process if desired.

Changed wording to note that we do want even backend distribution across channels, which may or may not be in the same process or machine (i.e. we want even distribution across all channels).

We know of use cases that do use multiple channels within a process, and for those use cases, each channel should have affinity to its own backend (but hot spotting one backend is undesirable for them).

Also: nit: no period after the parenthetical sentence. But should this sentence come before it, maybe?

Moved things around to keep the parenthetical sentence at the end.

requests on a given gRPC channel. In order to facilitate an even selection
of backends across different channels (which may or may not be in the same
process or machine), the value of `io.grpc.channel_id` should be initialized
with a uniform random number. This can be used in similar situations to where
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps this instead?

Suggested change
with a uniform random number. This can be used in similar situations to where
with a random number from a uniform distribution. This can be used in similar situations to where

"uniform random number" could be misread as "generate a single random number and use it for all the channel ids", but I think you're trying to say that each client id should be different (and if you want a uniform distribution across backends, the random number needs to be from a uniform distribution so that hashing doesn't get skewed).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could see that. Changed to your wording.

@apolcyn apolcyn merged commit 057bb11 into grpc:master Sep 15, 2022
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.

None yet

5 participants