feat(tonic-xds): add gRFC A42 ring-hash picker + member tracking#2695
Open
madhurishgupta wants to merge 1 commit into
Open
feat(tonic-xds): add gRFC A42 ring-hash picker + member tracking#2695madhurishgupta wants to merge 1 commit into
madhurishgupta wants to merge 1 commit into
Conversation
Implements the ring-hash LB picker on the loadbalance/ stack, with ring
construction and the hash-position walk mirroring grpc-go's ringhash balancer:
- RingHashPicker: builds an A42-conformant ring (uniform per-member weighting) —
size = smallest multiple of N >= min_ring_size, clamped to max_ring_size;
entries keyed xxh64("{addr}_{i}", 0); ring held lock-free behind ArcSwap.
pick() reads RouteDecision.request_hash (per-request random fallback), finds
the ring position closest to that hash and walks clockwise to the first ready
host (None/Unavailable if no ring host is ready).
- ChannelPicker::on_members_changed hook (default no-op; P2C inherits it),
delegating to RingHashPicker::rebuild.
- LoadBalancer tracks `members` (full healthy-EDS set, independent of
connection/ejection state) and rebuilds the picker's ring once per discovery
drain. Outlier detection composes for free: ejected hosts stay in the ring
but are not picked (not in `ready`).
Currently it supports uniform weighting and an eager-connect pick that selects
the first ready host. The remaining A42 connection semantics — IDLE-start with
connect-on-pick, queuing while CONNECTING, the TRANSIENT_FAILURE-aware walk,
weight-proportional rings, and aggregated-connectivity-state rules — are gated
on the load balancer's connection model and deferred. The picker is not yet
selected by lb_policy (default-wired in a later change).
Tests: 16 picker unit tests + 1 LoadBalancer member-tracking integration test.
f9b2dcc to
575ebed
Compare
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.
Summary
Adds the gRFC A42 ring-hash load-balancing picker to the loadbalance stack, giving consistent-hash request affinity: requests carrying the same hash key are routed to the same backend.
What's included
Behavior notes
Testing
Added UTs.
cargo fmt, clippy, and cargo test -p tonic-xds all clean.
##nPlan (A42 series)