-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
xds/internal/xdsclient: Add least request support in xDS #6517
Conversation
Tests are still unhappy. |
cf9e1f5
to
e5f50f2
Compare
I think should be good to review. Sorry for missing that haha. |
Got to all comments. Thanks for the pass :D. |
c031b2f
to
8684203
Compare
Could you please resolve the conflicts before I take another pass. Thanks. |
8684203
to
b8ac621
Compare
Done. The thing that created conflicts was the deexperimentalization of pick first. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor nits, LGTM modulo those.
ChoiceCount: wrapperspb.UInt32(2), | ||
}), | ||
// Least request's randomness of indexes to sample (unary RPCs which | ||
// don't persist so never any actual RPC counts over iterations) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something is incomplete in this sentence:
unary RPCs which don't persist so never any actual RPC counts over iterations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to "The test performs a Unary RPC, and blocks until the RPC returns, and then makes the next RPC. Thus, over iterations, no RPC counts are present. This causes Least request's randomness of indexes to sample to converge onto a round robin distribution per locality. Thus, expect the same distribution as round robin above."
// "The configuration for the Least Request LB policy is the | ||
// least_request_lb_config field. The field is optional; if not present, | ||
// defaults will be assumed for all of its values." - A48 | ||
var choiceCount uint32 = defaultLeastRequestChoiceCount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not asking you to change, but just FYI choiceCount := uint32(defaultLeastRequestChoiceCount)
is shorter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched. I feel like throughout the codebase and my years on the team, x := y vs. var x type = y has always been preferred for local vars declaration to a non zero value. Noted for future.
if test.lrDisabled { | ||
defer func(old bool) { envconfig.LeastRequestLB = old }(envconfig.LeastRequestLB) | ||
envconfig.LeastRequestLB = false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default value of envconfig.LeastRequestLB
is already false
. You are setting it to true for the duration of the test at the top, and then setting it to false here again.
Why not have a lrEnabled
field which is set to true only for tests that require it, and here, you can check for if test.lrEnabled { // set the env var to true }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done :). Good suggestion.
if cc := lr.GetChoiceCount(); cc != nil { | ||
choiceCount = cc.GetValue() | ||
} | ||
// nack if it's < 2, and also add test for it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the also add test for it
part of it.
And probably quote the relevant language from the gRFC if that makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched comment to: // "If choice_count < 2, the config will be rejected." - A48
This PR adds least request support plumbed through xDS.
RELEASE NOTES: