BUG/MEDIUM: checks: don't needlessly take the server lock in health_adjust()
authorWilly Tarreau <w@1wt.eu>
Wed, 17 Feb 2021 14:20:19 +0000 (15:20 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 22 Feb 2021 09:23:25 +0000 (10:23 +0100)
commit93da4dc1fd81ca9424e561dd986af7e046180371
tree67c92ff6d878b225d7a238a1cf4ec9404cc550ae
parent4d45917e6e57c29e9cc7f1a3cb05f6e4212ee842
BUG/MEDIUM: checks: don't needlessly take the server lock in health_adjust()

The server lock was taken preventively for anything in health_adjust(),
including the static config checks needed to detect that the lock was not
needed, while the function is always called on the response path to update
a server's status. This was responsible for huge contention causing a
performance drop of about 17% on 16 threads. Let's move the lock only
where it should be, i.e. inside the function around the critical sections
only. By doing this, a 16-thread process jumped back from 575 to 675 krps.

This should be backported to 2.3 as the situation degraded there, and
maybe later to 2.2.

(cherry picked from commit 4e9df2737dde3f6d1d171fa17e2594c4c765c00c)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
include/haproxy/check.h
src/check.c