]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: stick-table: touch updates under an upgradable read lock
authorWilly Tarreau <w@1wt.eu>
Mon, 7 Aug 2023 19:03:24 +0000 (21:03 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 11 Aug 2023 17:03:35 +0000 (19:03 +0200)
commitcfeca3a3a3f61adaca4c76487054e5e1499f1ea1
tree0954a27ea8ffab0111005a11994229d951c7817a
parent87e072eea578211005a93add43953ba9fd906a14
MEDIUM: stick-table: touch updates under an upgradable read lock

Instead of taking the update's write lock in stktable_touch_with_exp(),
while most of the time under high load there is nothing to update because
the entry is touched before having been synchronized present, let's do
the check under a read lock and upgrade it to perform the update if
needed. These updates are rare and the contention is not expected to be
very high, so at the first failure to upgrade we retry directly with a
write lock.

By doing so the performance has almost doubled again, from 1140 to 2050k
with a peers section enabled. The contention is now on taking the read
lock itself, so there's little to be gained beyond this in this function.
src/stick_table.c