]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: thread: indicate when max-threads-per-group is ignored
authorWilly Tarreau <w@1wt.eu>
Thu, 28 May 2026 15:19:44 +0000 (17:19 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 28 May 2026 16:49:47 +0000 (18:49 +0200)
Since it's easy to get caught by some parameters being ignored, let's
detect when mtpg was explicitly set and report a notice if it is ignored
due to thread-groups being set. For this we need to avoid presetting
the value in the global section and only set it when entering function
thread_detect_count(), which is OK since the value cannot be used before.

src/haproxy.c
src/thread.c

index 1060fbc05522d2ffc3f8e68de9526d7ca72e5e5f..3f0e097bf5d825db142f21da1c5161b1602c8187 100644 (file)
@@ -210,7 +210,6 @@ struct global global = {
 #endif
        /* by default allow clients which use a privileged port for TCP only */
        .clt_privileged_ports = HA_PROTO_TCP,
-       .maxthrpertgroup = DEF_MAX_THREADS_PER_GROUP,
        /* others NULL OK */
 };
 
index bb733a6029eb9c82737f4b7c27422b922112ab5e..94b7b8dd74e540d9b26c3bd1c616929901fedcaf 100644 (file)
@@ -1682,8 +1682,17 @@ void thread_detect_count(void)
        if (global.nbtgroups) {
                grp_min = grp_max = global.nbtgroups;
                /* ignore max-threads-per-group if thread-groups is configured */
+               if (global.maxthrpertgroup)
+                       ha_notice("max-threads-per-group is used to automatically calculate the optimal number of thread groups. It is ignored when thread-groups is set.\n");
                global.maxthrpertgroup = MAX_THREADS_PER_GROUP;
        }
+       else {
+               /* set the default max-threads-per-group to calculate the
+                * optimal number of groups.
+                */
+               if (!global.maxthrpertgroup)
+                       global.maxthrpertgroup = DEF_MAX_THREADS_PER_GROUP;
+       }
 
 #if defined(USE_THREAD)
        /* Adjust to boot settings if not forced */