mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-23 23:45:37 +00:00
MINOR: config: automatically preset MAX_THREADS based on MAX_TGROUPS
MAX_THREADS was not changed when setting MAX_TGROUPS, which still limits some possibilities. Let's preset it to 4 * LONGBITS when MAX_TGROUPS is larger than 1, or LONGBITS when it's set to 1. This means that the new default value is 256 threads. The rationale behind this is that the main use of thread groups is mostly to address NUMA issues and that we don't necessarily need large thread counts when using many groups, and 256 threads is already plenty even on quite large systems. For now it's important not to go too far because some internal structs are arrays of MAX_THREADS entries, for example accept_queue_ring, which is around 8kB per thread. Such structures will need to become dynamic before defaulting to large thread counts (at 4096 threads max the accept queues would require 32 MB RAM alone).
This commit is contained in:
parent
c80bdb2da6
commit
693688e734
@ -34,10 +34,6 @@
|
||||
#define MAX_THREADS_PER_GROUP 1
|
||||
|
||||
#else
|
||||
/* threads enabled, max_threads defaults to long bits */
|
||||
#ifndef MAX_THREADS
|
||||
#define MAX_THREADS LONGBITS
|
||||
#endif
|
||||
|
||||
/* theoretical limit is 64, though we'd rather not push it too far for now
|
||||
* as some structures might be enlarged to be indexed per group. Let's start
|
||||
@ -48,9 +44,18 @@
|
||||
#ifndef MAX_TGROUPS
|
||||
#define MAX_TGROUPS 16
|
||||
#endif
|
||||
|
||||
#define MAX_THREADS_PER_GROUP LONGBITS
|
||||
|
||||
/* threads enabled, max_threads defaults to long bits for 1 tgroup or 4 times
|
||||
* long bits if more tgroups are enabled.
|
||||
*/
|
||||
#ifndef MAX_THREADS
|
||||
#define MAX_THREADS ((((MAX_TGROUPS) > 1) ? 4 : 1) * (MAX_THREADS_PER_GROUP))
|
||||
#endif
|
||||
|
||||
#endif // USE_THREAD
|
||||
|
||||
/*
|
||||
* BUFSIZE defines the size of a read and write buffer. It is the maximum
|
||||
* amount of bytes which can be stored by the proxy for each stream. However,
|
||||
|
Loading…
Reference in New Issue
Block a user