]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: peers: move process_peer_sync() to a single thread
authorWilly Tarreau <w@1wt.eu>
Wed, 10 Sep 2025 16:52:56 +0000 (18:52 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 10 Sep 2025 17:14:05 +0000 (19:14 +0200)
commitded2110ec6be271ae7293dc536bedc1fd49d7314
tree6990effa22d36ec341a3c6b30f13a64c809cc962
parente05afda249299cdd415268b7e24884ed963e3cdb
MEDIUM: peers: move process_peer_sync() to a single thread

The remaining half of the task_queue() and task_wakeup() contention
is caused by this function when peers are in use, because just like
process_table_expire(), it's created using task_new_anywhere() and
is woken up for local 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.

Here we go backwards to assign the threads, so that on small setups
they don't end up on the same CPUs as the ones used by the stick-tables.
This way this will make an even better use of large machines. The
performance remains the same as with previous patch, even slightly
better (1-3% on avg).

At this point there's almost no multi-threaded task activity anymore
(only srv_cleanup_idle_server once in a while). 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/peers.c