Skip to content
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

loadbalancer-experimental: remove random-subsetting API from LoadBala… #3132

Merged
merged 3 commits into from
Dec 10, 2024

Conversation

bryce-anderson
Copy link
Contributor

…ncerBuilder

Motivation:

There are many forms of subsetting and I don't think we have sorted out the best way to make that configurable from an API perspective. As we make the LoadBalancerBuilder API non-experimental, we don't want to yet commit to the existing API.

Modifications:

  • Remove the configuration from LoadBalancerBuilder
  • Extract the random subsetting logic into it's own abstraction to prep for future subsetting strategies
  • Add some independent unit tests for RandomSubsetter

Result:

  • Smaller API commitments
  • More flexibility to experiment internally

…ncerBuilder

Motivation:

There are many forms of subsetting and I don't think we have sorted out
the best way to make that configurable from an API perspective. As we
make the LoadBalancerBuilder API non-experimental, we don't want to yet
commit to the existing API.

Modifications:

- Remove the configuration from LoadBalancerBuilder
- Extract the random subsetting logic into it's own abstraction to prep for future subsetting strategies

Result:

- Smaller API commitments
- More flexibility to experiment internally
@@ -167,7 +156,7 @@ public LoadBalancer<C> newLoadBalancer(
new XdsOutlierDetector<>(executor, outlierDetectorConfig, lbDescription);
}
return new DefaultLoadBalancer<>(id, targetResource, eventPublisher,
DefaultHostPriorityStrategy::new, loadBalancingPolicy, subsetSize,
DefaultHostPriorityStrategy::new, loadBalancingPolicy, new RandomSubsetter(Integer.MAX_VALUE),
Copy link
Member

Choose a reason for hiding this comment

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

If we are not going to use a subsetter now, will it make sense to create a NoopSubsetter implementation that will simply return hosts as-is? It will be less code to execute inside LB if there is no need.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could, but it would be symbolic: RandomSubsetter checks if the desired subset is larger than the host set size and if so, it's a no-op. I'd like to keep that behavior even if we introduce a truly no-op subsetter.

Copy link
Member

Choose a reason for hiding this comment

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

You are right, I think I misinterpreted the first if condition inside RandomSubsetter. All good.

Copy link
Member

@idelpivnitskiy idelpivnitskiy left a comment

Choose a reason for hiding this comment

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

Look like you forgot to push a commit for the other 2 nits, everything else lgtm, thanks!

@@ -167,7 +156,7 @@ public LoadBalancer<C> newLoadBalancer(
new XdsOutlierDetector<>(executor, outlierDetectorConfig, lbDescription);
}
return new DefaultLoadBalancer<>(id, targetResource, eventPublisher,
DefaultHostPriorityStrategy::new, loadBalancingPolicy, subsetSize,
DefaultHostPriorityStrategy::new, loadBalancingPolicy, new RandomSubsetter(Integer.MAX_VALUE),
Copy link
Member

Choose a reason for hiding this comment

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

You are right, I think I misinterpreted the first if condition inside RandomSubsetter. All good.

@bryce-anderson
Copy link
Contributor Author

Look like you forgot to push a commit for the other 2 nits, everything else lgtm, thanks!

Doh, you're right. Pushed now.

@bryce-anderson bryce-anderson merged commit 7acafb9 into apple:main Dec 10, 2024
11 checks passed
@bryce-anderson bryce-anderson deleted the bl_anderson/Subsetter branch December 10, 2024 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants