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

Make WRR LB thread aware #3278

Open
htuch opened this issue May 3, 2018 · 3 comments
Open

Make WRR LB thread aware #3278

htuch opened this issue May 3, 2018 · 3 comments
Labels
area/perf enhancement Feature requests. Not bugs or questions. help wanted Needs help!

Comments

@htuch
Copy link
Member

htuch commented May 3, 2018

The existing WRR LB uses a per-thread EDF scheduler. This makes memory usage O(m * n) where m is the number of hosts and n the number of endpoints. We can shrink this to O(n * w), where w is the weight range, if we precompute the schedule on the main thread (as we do for consistent hash balancers) and just maintain an index that we rotate around the shared schedule for WRR. This comes at the downside of increased memory use when we have a wide range of weights, but as long as we maintain a limited set of weights (which we need to do anyway to sanely support locality weighting with the consistent hash balancers), this should be reasonable.

@htuch
Copy link
Member Author

htuch commented May 3, 2018

Somewhat related to #2874.

@htuch htuch added enhancement Feature requests. Not bugs or questions. area/perf help wanted Needs help! labels May 3, 2018
@htuch
Copy link
Member Author

htuch commented May 3, 2018

@alyssawilk points out that this might not do brilliantly as the number of hosts scales if we want the full range of weights preserved, and that what we do today with the consistent hash schemes is also problematic. We should explore these tradeoffs more thoroughly before committing to a specific implementation path here.

@htuch
Copy link
Member Author

htuch commented May 16, 2018

FWIW, gRPC-LB (https://grpc.io/blog/loadbalancing) effectively works with a fully precomputed static schedule for WRR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/perf enhancement Feature requests. Not bugs or questions. help wanted Needs help!
Projects
None yet
Development

No branches or pull requests

1 participant