CLEANUP: thread: indicate when max-threads-per-group is ignored

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.
This commit is contained in:
Willy Tarreau 2026-05-28 17:19:44 +02:00
parent f5847d11f7
commit f91b1ce9af
2 changed files with 9 additions and 1 deletions

View 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 */
};

View 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 */