-
Notifications
You must be signed in to change notification settings - Fork 4k
xds: use defaults for unspecified ring_hash_lb_config values #8237
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: use defaults for unspecified ring_hash_lb_config values #8237
Conversation
…r ring_hash LB policy if xDS provided values are 0.
| long minRingSize = lbConfig.getMinimumRingSize().getValue(); | ||
| long maxRingSize = lbConfig.getMaximumRingSize().getValue(); | ||
| if (lbConfig.getHashFunction() != RingHashLbConfig.HashFunction.XX_HASH | ||
| || minRingSize > maxRingSize) { |
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.
Your change in CdsLoadBalancer2.java seems to allow both minRingSize and maxRingSize to be zero, but here it is not allowed?
…ig generation, the received CdsUpdate will always have values set.
|
Updated how default values are applied. We want the XdsClient to do as much validation as possible and NACK invalid configurations earlier better than later. We need to know the default values in order to implement the full set of validations. For example, So we implement setting default values in XdsClient. However, there is another codepath we need to consider, which is the LB config parser. Currently, this part is dead code (and most LB policies except ring_hash do not implement it). It exists because ideally we would support pluggable LB policies with LB configs given by any name resolution mechanism. Therefore, we inevitably introduce some duplicated logic, just because the architecture is intended to be pluggable for each component. Same thing is happening in C-core: XdsClient parsing ring_hash LB config and the ring_hash LB policy's own config parser parses JSON config. I think we should do the same for circuit breaker's default (will send a PR for that after this one is resolved). |
dapengzhang0
left a comment
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.
LGTM
Envoy uses default parameters for ring hash LB config (min_ring_size = 1024, max_ring_size = 8M). grpc/proposal#239 is updated to use the same default as Envoy.
The change follows the way that C-core does this:
RingHashConfigdirectly./cc @apolcyn