xds: implement least_request load balancing policy#8739
xds: implement least_request load balancing policy#8739ejona86 merged 17 commits intogrpc:masterfrom
Conversation
Implements least_request as defined by [A48](https://github.com/grpc/proposal/blob/master/A48-xds-least-request-lb-policy.md)
Forgot to make this package private from the start
These tests are mostly just a copy of RoundRobinLoadBalancerTest. The main difference is currently in the pickerLeastRequest test case. All other tests should be the same.
| public void handleResolvedAddresses(ResolvedAddresses resolvedAddresses) { | ||
| LeastRequestConfig config = | ||
| (LeastRequestConfig) resolvedAddresses.getLoadBalancingPolicyConfig(); | ||
| // Config may be null if least_request is used outside xDS |
There was a problem hiding this comment.
Is that so? I guess it may be if it becomes the default LB? We may want to fix that in gRPC.
There was a problem hiding this comment.
When trying this LB implementation together with a custom dns-based resolver it ended up being null here.
I haven't dug into exactly why this is the case however the custom resolver never sets any service config in the resolution result and also loadBalancingPolicyConfig is marked with @Nullable here which also is a reason to do a null check.
…actory Needed since InternalLimitedInfoFactory was removed in: grpc#8768
This keeps behavior completely consistent with now when least request is disabled. That is, fail clients with an error that LEAST_REQUEST isn't supported. Also introduce a system property to enable. This allows enablement through Java code.
|
@ejona86 This is ready for another pass when you have time. |
This change contains a few various fixes: * Fixes bug in ReadyPicker equality implementation that prevented runtime updates to choiceCount in some cases * Adds additional test and testing logic to ensure the ReadyPicker is created with the correct args * Replaces FakeRandom with a normal mock instead * Move the inFlights increment into the streamCreated hook instead
|
Could someone help with triggering kokoro and merge (unless there aren't any other reviewers) |
|
Thanks, @erikjoh! That was more involved than I had hoped. Thank you for the prompt iterations. @dapengzhang0, there was talk of backporting this to 1.44 to make it easier to try out. It is disabled by default, so seems reasonably safe. You think it makes sense? |
|
I think it's reasonably safe to backport too. |
Implements least_request_experimental as defined by [A48](https://github.com/grpc/proposal/blob/master/A48-xds-least-request-lb-policy.md) These tests are mostly just a copy of RoundRobinLoadBalancerTest. The main difference is currently in the pickerLeastRequest test case. All other tests should be the same.
Implements least_request_experimental as defined by [A48](https://github.com/grpc/proposal/blob/master/A48-xds-least-request-lb-policy.md) These tests are mostly just a copy of RoundRobinLoadBalancerTest. The main difference is currently in the pickerLeastRequest test case. All other tests should be the same.
Implements least_request as defined by
A48