envoyproxy/envoy

Make WRR LB thread aware

Open

#3,278 opened on May 3, 2018

View on GitHub
 (3 comments) (0 reactions) (0 assignees)C++ (5,373 forks)batch import
area/perfenhancementhelp wanted

Repository metrics

Stars
 (27,997 stars)
PR merge metrics
 (Avg merge 8d) (378 merged PRs in 30d)

Description

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.

Contributor guide