Repository navigation
Conversation
Assign each endpoint an index when building the ring and use that index to read the picker-local connectivity snapshot. Resolve endpoint keys when creating the snapshot so RPC picks can skip address comparison, including when scanning past failed endpoints.
JoeCqupt
force-pushed
the
feat/ring-hash-picker-lookup
branch
from
December 1, 2026 07:03
3730c35 to
baa688c
Compare
Contributor
Author
|
@ejona86 @kannanjgithub PTAL |
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 change addresses the TODO in
RingHashPickerabout reducing the cost of endpoint state lookups. The picker currently performs aHashMaplookup for each ring entry it examines. That lookup can compare endpoint addresses, and a single pick may perform several lookups when it skips failed endpoints. Original TODOAssign each endpoint an index when building the ring and share that index across its virtual nodes. When creating a picker, use the endpoint keys to populate a connectivity snapshot array. The picker then reads each candidate's state directly by index.
Benchmark
JMH 1.37 on JDK 21, using a 4,096-entry ring, fixed request hashes, and simulated connection states. The benchmark measures
pickSubchannel()on an existing picker.The 64-endpoint all-READY result varied across runs.