]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: listener: switch the default sharding to by-group
authorWilly Tarreau <w@1wt.eu>
Sat, 22 Apr 2023 22:51:59 +0000 (00:51 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 23 Apr 2023 08:18:16 +0000 (10:18 +0200)
Sharding by-group is exactly identical to by-process for a single
group, and will use the same number of file descriptors for more than
one group, while significantly lowering the kernel's locking overhead.

Now that all special listeners (cli, peers) are properly handled, and
that support for SO_REUSEPORT is detected at runtime per protocol, there
should be no more reason for now switching to by-group by default.

That's what this patch does. It does only this and nothing else so that
it's easy to revert, should any issue be raised.

Testing on an AMD EPYC 74F3 featuring 24 cores and 48 threads distributed
into 8 core complexes of 3 cores each, shows that configuring 8 groups
(one per CCX) is sufficient to simply double the forwarded connection
rate from 112k to 214k/s, reducing kernel locking from 71 to 55%.

doc/configuration.txt
src/haproxy.c

index 8fbe88a948b8f3fa114a4f8b9dd8f09726fc4def..3fc4ea092ab7a63cf550831558e53d32c4d1376f 100644 (file)
@@ -3045,7 +3045,8 @@ tune.listener.default-shards { by-process | by-thread | by-group }
   sockets on a same address. Note that "by-group" will remain equivalent to
   "by-process" for default configurations involving a single thread group, and
   will fall back to sharing the same socket on systems that do not support this
-  mechanism. As such, it is the recommended setting.
+  mechanism. The default is "by-group" with a fallback to "by-process" for
+  systems or socket families that do not support multiple bindings.
 
 tune.listener.multi-queue { on | fair | off }
   Enables ('on' / 'fair') or disables ('off') the listener's multi-queue accept
index 739183af8157fcefffb98f3dfcf5fb578706d570..6d155f362e8ea7cf3f82a87cc594649eee9de570 100644 (file)
@@ -205,7 +205,7 @@ struct global global = {
                .idle_timer = 1000, /* 1 second */
 #endif
                .nb_stk_ctr = MAX_SESS_STKCTR,
-               .default_shards = 1, /* "by-process" = one shard per listener */
+               .default_shards = -2, /* by-group */
 #ifdef USE_QUIC
                .quic_backend_max_idle_timeout = QUIC_TP_DFLT_BACK_MAX_IDLE_TIMEOUT,
                .quic_frontend_max_idle_timeout = QUIC_TP_DFLT_FRONT_MAX_IDLE_TIMEOUT,