]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: server: make it possible to kill last idle connections
authorWilly Tarreau <w@1wt.eu>
Thu, 5 Nov 2020 08:12:20 +0000 (09:12 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 5 Nov 2020 08:12:20 +0000 (09:12 +0100)
commit21b9ff59b2423601673494e4b72dbb5fb0fd4094
treef253e8212ba0b56bb2f5efd7b0ebf6bb6dfabde6
parentf9bc6e496857500157b48ef55894c7fcbecf6eaf
BUG/MEDIUM: server: make it possible to kill last idle connections

In issue #933, @jaroslawr provided a report indicating that when using
many threads and many servers, it's very difficult to terminate the last
idle connections on each server. The issue has two causes in fact. The
first one is that during the calculation of the estimate of needed
connections, we round the computation up while in previous round it was
already rounded up, so we end up adding 1 to 1 which once divided by 2
remains 1. The second issue is that servers are not woken up anymore for
purging their connections if they don't have activity. The only reason
that was there to wake them up again was in case insufficient connections
were purged. And even then the purge task itself was not woken up. But
that is not enough for getting rid of the long tail of old connections
nor updating est_need_conns.

This patch makes sure to properly wake up as long as at least one idle
connection remains, and not to round up the needed connections anymore.

Prior to this patch, a test involving many connections which suddenly
stopped would keep many idle connections, now they're effectively halved
every pool-purge-delay.

This needs to be backported to 2.2.
src/server.c