From: Willy Tarreau Date: Wed, 3 Sep 2025 09:54:15 +0000 (+0200) Subject: OPTIM: stick-tables: exit expiry faster when the update lock is held X-Git-Tag: v3.3-dev8~26 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=46463d68502345976fd76fcd1d190cfe4ecb083c;p=thirdparty%2Fhaproxy.git OPTIM: stick-tables: exit expiry faster when the update lock is held It helps keep the contention level low: when we hold the update lock that we know other parts may be relying on (peers, track-sc etc), we decrease the remaining visit counters 4 times as fast to further reduce the contention. At this point no more warnings are seen during intense synchronization (2x64 cores, 1.5M req/s with a track-sc each, 5M entries in use). --- diff --git a/src/stick_table.c b/src/stick_table.c index e6dbe99a4..a73b30a95 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -936,7 +936,8 @@ struct task *process_table_expire(struct task *task, void *context, unsigned int goto out_unlock; } - to_visit--; + /* Let's quit earlier if we currently hold the update lock */ + to_visit -= 1 + 3 * updt_locked; /* timer looks expired, detach it from the queue */ ts = eb32_entry(eb, struct stksess, exp);