]> git.kaiwu.me - haproxy.git/commit
MAJOR: listener: use the multi-queue for multi-thread listeners
authorWilly Tarreau <w@1wt.eu>
Sun, 27 Jan 2019 14:37:19 +0000 (15:37 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 27 Feb 2019 13:27:07 +0000 (14:27 +0100)
commite0e9c48ab29cf9b37051f8b26c1a1c7f2a7ad0e9
tree3f129f832f61aca8725a81dc842b3b80a79d3cae
parent1efafce61f20b21841990af008b3b838244782e2
MAJOR: listener: use the multi-queue for multi-thread listeners

The idea is to redistribute an incoming connection to one of the
threads a bind_conf is bound to when there is more than one. We do this
using a random improved by the p2c algorithm : a random() call returns
two different thread numbers. We then compare their respective connection
count and the length of their accept queues, and pick the least loaded
one. We even use this deferred accept mechanism if the target thread
ends up being the local thread, because this maintains fairness between
all connections and tests show that it's about 1% faster this way,
likely due to cache locality. If the target thread's accept queue is
full, the connection is accepted synchronously by the current thread.
src/listener.c