]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: conn: make conn_backend_get always scan the same group
authorWilly Tarreau <w@1wt.eu>
Thu, 7 Jul 2022 07:12:45 +0000 (09:12 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 15 Jul 2022 17:43:10 +0000 (19:43 +0200)
commit15c5500b6e7cb503f1feb23c38f48103444d06d4
tree2f5ceb9db2217ce513866f66ebd7d5aa5b9f95f7
parentd60269f93fe7c826fe28b9ba97747d568a8939db
MEDIUM: conn: make conn_backend_get always scan the same group

We don't want to pick idle connections from another thread group,
this would be very slow by forcing to share undesirable data.

This patch makes sure that we start seeking from the current thread
group's threads only and loops over that range exclusively.

It's worth noting that the next_takeover pointer remains per-server
and will bounce when multiple groups use it at the same time. But we
preserve the perturbation by applying a modulo when retrieving it,
so that when groups are of the same size (most common case), the
index will not even change. At this time it doesn't seem worth
storing one index per group in servers, but that might be an option
if any contention is detected later.
src/backend.c