]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: backend: don't always takeover from the same threads
authorWilly Tarreau <w@1wt.eu>
Wed, 1 Jul 2020 13:55:30 +0000 (15:55 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 1 Jul 2020 14:07:43 +0000 (16:07 +0200)
commit364f25a6883494b9bd814e80010ce7b654963874
tree8cb9877efdeac410863a7c1b310458fd40ae319c
parent0d587116c2b15a7d24ec93ac6069b0bdba57d7bd
MINOR: backend: don't always takeover from the same threads

The next thread walking algorithm in commit 566df309c ("MEDIUM:
connections: Attempt to get idle connections from other threads.")
proved to be sufficient for most cases, but it still has some rough
edges when threads are unevenly loaded. If one thread wakes up with
10 streams to process in a burst, it will mainly take over connections
from the next one until it doesn't have anymore.

This patch implements a rotating index that is stored into the server
list and that any thread taking over a connection is responsible for
updating. This way it starts mostly random and avoids always picking
from the same place. This results in a smoother distribution overall
and a slightly lower takeover rate.
include/haproxy/server-t.h
src/backend.c