]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: lb: make the leastconn algorithm more accurate
authorWilly Tarreau <w@1wt.eu>
Fri, 14 Dec 2018 07:33:28 +0000 (08:33 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 14 Dec 2018 07:33:28 +0000 (08:33 +0100)
commit1eb6c558083c2409588aa019fb8c90103b72d08a
treedd390b7d971ef8fe505d70bc6abb5e4ec09ca478
parent7b8d203876f210892ea476016b8d20748ef1a8a9
MINOR: lb: make the leastconn algorithm more accurate

The leastconn algorithm queues available servers based on their weighted
current load. But this results in an inaccurate load balancing when weights
differ and the load is very low, because what matters is not the load before
picking the server but the load resulting from picking the server. At the
very least, it must be granted that servers with the highest weight are
always picked first when no server has any connection.

This patch addresses this by simply adding one to the current connections
count when queuing the server, since this is the load the server will have
once picked. This finally allows to bridge the gap that existed between
the "leastconn" and the "first" algorithms.
src/lb_fwlc.c