]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: stick-table: requeue the expiration task out of the exclusive lock
authorWilly Tarreau <w@1wt.eu>
Wed, 12 Oct 2022 09:45:36 +0000 (09:45 +0000)
committerWilly Tarreau <w@1wt.eu>
Wed, 12 Oct 2022 12:19:05 +0000 (14:19 +0200)
commite3f5ae895ac098c569e1e8dbc22db6900ba9737c
treec57d713c71d9d697211bca884fb8a7d27164bb3b
parente62885237c7515ae6284f54ea07cdb68c133231a
MEDIUM: stick-table: requeue the expiration task out of the exclusive lock

With 48 threads, a heavily loaded table with plenty of trackers and
rules and a short expiration timer of 10ms saturates the CPU at 232k
rps. By carefully using atomic ops we can make sure that t->exp_next
and t->task->expire converge to the earliest next expiration date and
that all of this can be performed under atomic ops without any lock.
That's what this patch is doing in stktable_touch_with_exp(). This is
sufficient to double the performance and reach 470k rps.

It's worth noting that __stktable_store() uses a mix of eb32_insert()
and task_queue, and that the second part of it could possibly benefit
from this, even though sometimes it's called under a lock that was
already held.
src/stick_table.c