From 3ca2a83fc0564b16d3586a6361d7fd77b83733db Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 28 Jan 2026 10:38:22 +0000 Subject: [PATCH] OPTIM: server: move queueslength in server struct This field is shared by all threads and must be in the shared area instead, because where it's placed, it slows down access to other fields of the struct by false sharing. Just moving this field gives a steady 2% gain on the request rate (1.93 to 1.96 Mrps) on a 64-core EPYC. --- include/haproxy/server-t.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/haproxy/server-t.h b/include/haproxy/server-t.h index 8164cea8e..325361767 100644 --- a/include/haproxy/server-t.h +++ b/include/haproxy/server-t.h @@ -383,7 +383,6 @@ struct server { unsigned next_eweight; /* next pending eweight to commit */ unsigned cumulative_weight; /* weight of servers prior to this one in the same group, for chash balancing */ int maxqueue; /* maximum number of pending connections allowed */ - unsigned int queueslength; /* Sum of the length of each queue */ int shard; /* shard (in peers protocol context only) */ int log_bufsize; /* implicit ring bufsize (for log server only - in log backend) */ @@ -406,6 +405,7 @@ struct server { unsigned int max_used_conns; /* Max number of used connections (the counter is reset at each connection purges */ unsigned int est_need_conns; /* Estimate on the number of needed connections (max of curr and previous max_used) */ unsigned int curr_sess_idle_conns; /* Current number of idle connections attached to a session instead of idle/safe trees. */ + unsigned int queueslength; /* Sum of the length of each queue */ /* elements only used during boot, do not perturb and plug the hole */ struct guid_node guid; /* GUID global tree node */ -- 2.47.3