]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: server: Implement bounded-load hash algorithm
authorAndrew Rodland <andrewr@vimeo.com>
Tue, 25 Oct 2016 16:50:37 +0000 (12:50 -0400)
committerWilly Tarreau <w@1wt.eu>
Tue, 25 Oct 2016 18:21:32 +0000 (20:21 +0200)
commit4f88c636097bf5f7651c790700a8bf3fb82e5f67
treefbaa781fe7d9ea04ed406f53b972ba256c9af13a
parent13d5ebb91361c001286dd3ca91481d98d75ed031
MEDIUM: server: Implement bounded-load hash algorithm

The consistent hash lookup is done as normal, then if balancing is
enabled, we progress through the hash ring until we find a server that
doesn't have "too much" load. In the case of equal weights for all
servers, the allowed number of requests for a server is either the
floor or the ceil of (num_requests * hash-balance-factor / num_servers);
with unequal weights things are somewhat more complicated, but the
spirit is the same -- a server should not be able to go too far above
(its relative weight times) the average load. Using the hash ring to
make the second/third/etc. choice maintains as much locality as
possible given the load limit.

Signed-off-by: Andrew Rodland <andrewr@vimeo.com>
src/lb_chash.c