Skip to content

grpc-xds/load_balancing: WRR Locality LB implementation - #2950

Open
nathanielford wants to merge 16 commits into
grpc:masterfrom
nathanielford:feature/wrr-locality-lb
Open

nathanielford wants to merge 16 commits into
grpc:masterfrom
nathanielford:feature/wrr-locality-lb

Conversation

@nathanielford

@nathanielford nathanielford commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Implementation of xDS WRR Locality LB (#2763).

Solution

Leverages Child (from ChildManager, though it does not use the manager itself) to manage the weighted_target_experimental child policy. Carries functionality to parse xds_wrr_locality_experimental configuration, extract locality weights from endpoint ResolutionResult attributes, dynamically build the weighted_target_experimental child configuration per locality, and delegate updates and state management to the child policy.

Notes

Comment on lines +203 to +208
if targets.is_empty() {
return self.fail_update(
format!("{POLICY_NAME}: no localities with positive weight in resolver update"),
channel_controller,
);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All other implementations seem to send an empty config to the child LB instead of dropping it. This allows the child to either cache the children or drop them immediately. This also allows the child to set the picker. We can follow the same behaviour in rust.

@arjan-bal arjan-bal assigned nathanielford and unassigned arjan-bal Nov 4, 2026
@nathanielford

Copy link
Copy Markdown
Contributor Author

@arjan-bal I think everything has been addressed - let me know if you have any other concerns!

Comment on lines +452 to +453
// Update with an endpoint missing locality weight forwards empty targets
// to the child policy rather than dropping the child.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is true for the mock balancer being used here. Since weighted_target is merged, can we use the read weighted_target and verify that a failing picker is produced?

Can you also see if other tests can use the real weighted_target LB now?

impl WrrLocalityPolicy {
// Drops any active child policy, transitions the channel to
// TRANSIENT_FAILURE with a FailingPicker, and returns the error.
fn fail_update(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In the two callers, can you also include the resolution node from the resolver update so it's not lost?

Comment thread grpc-xds/src/resource/endpoint.rs Outdated
Comment on lines +68 to +70
// Formats the locality as `{region="<region>", zone="<zone>",
// sub_zone="<sub_zone>"}`: the name of the locality's child policy under
// `xds_wrr_locality`, and its metric label value (gRFC A78).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be a /// comment.

@arjan-bal arjan-bal assigned nathanielford and unassigned arjan-bal Nov 11, 2026
@nathanielford

Copy link
Copy Markdown
Contributor Author

I think everything is addressed - fixed the comment, carried through the note. I'm using the weighted_target in the tests where we don't need to look at weights or other items the mock covers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants