[MAJOR] implementation of the "leastconn" load balancing algorithm
authorWilly Tarreau <w@1wt.eu>
Mon, 10 Mar 2008 21:04:20 +0000 (22:04 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 10 Mar 2008 21:04:30 +0000 (22:04 +0100)
commit51406233bb2505b8b99d1fa8502abdaf82a67651
tree77b7006269acb971ad342e0da236df1eb4818316
parentf4cca45b5e6c6ed88a0062cf92ae57e01405ab12
[MAJOR] implementation of the "leastconn" load balancing algorithm

The new "leastconn" LB algorithm selects the server which has the
least established or pending connections. The weights are considered,
so that a server with a weight of 20 will get twice as many connections
as the server with a weight of 10.

The algorithm respects the minconn/maxconn settings, as well as the
slowstart since it is a dynamic algorithm. It also correctly supports
backup servers (one and all).

It is generally suited for protocols with long sessions (such as remote
terminals and databases), as it will ensure that upon restart, a server
with no connection will take all new ones until its load is balanced
with others.

A test configuration has been added in order to ease regression testing.
include/proto/backend.h
include/types/backend.h
include/types/proxy.h
src/backend.c
src/cfgparse.c
src/proto_http.c
tests/test-fwlc.cfg [new file with mode: 0644]