]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
OPTIM: server: move queueslength in server struct
authorWilly Tarreau <w@1wt.eu>
Wed, 28 Jan 2026 10:38:22 +0000 (10:38 +0000)
committerWilly Tarreau <w@1wt.eu>
Wed, 28 Jan 2026 16:07:27 +0000 (16:07 +0000)
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

index 8164cea8ed50f60d83d9a17b1ca92426be978f9d..325361767ee28a99bec8b8fb7ee24a321e838b80 100644 (file)
@@ -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 */