]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: stick-table: move process_table_expire() to a single thread
authorWilly Tarreau <w@1wt.eu>
Wed, 10 Sep 2025 16:47:50 +0000 (18:47 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 10 Sep 2025 17:13:33 +0000 (19:13 +0200)
commite05afda249299cdd415268b7e24884ed963e3cdb
treede60c03c4b3586fc2f9c409374d21d799e7a601e
parent2831cb104fa4cb528f27240a33ba84d27d7449b8
MEDIUM: stick-table: move process_table_expire() to a single thread

A big deal of the task_queue() contention is caused by this function
because it's created using task_new_anywhere() and is subject to
heavy updates. Let's turn it to single thread by rotating the assigned
threads during initialization so that a table only runs on one thread
at a time.

However there's a trick: the function used to call task_queue() to
requeue the task if it had advanced its timer (may only happen when
learning an entry from a peer). We can't do that anymore since we can't
queue another thread's task. Thus instead of the task needs to be
scheduled earlier than previously planned, we simply perform a wakeup.
It will likely do nothing and will self-adjust its next wakeup timer.

Doing so halves the number of multi-thread task wakeups. In addition
the request rate at saturation increased by 12% with 16 peers and 40
tables on a 16 8-thread processes. This should improve the situation
described by Felipe in issues #3084 and #3101.

This should be backported to 3.2 after some extended checks.
src/stick_table.c