]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MAJOR: config: disable support for nbproc and nbthread in parallel
authorWilly Tarreau <w@1wt.eu>
Sat, 2 Feb 2019 11:56:15 +0000 (12:56 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 27 Feb 2019 13:27:04 +0000 (14:27 +0100)
When 1.8 was released, we wanted to support both nbthread and nbproc to
observe how things would go. Since then it appeared obvious that the two
are never used together because of the pain to configure affinity in this
case, and instead of bringing benefits, it brings the limitations of both
models, and causes multiple threads to compete for the same CPU. In
addition, it costs a lot to support both in parallel, so let's get rid
of this once for all.

doc/configuration.txt
src/cfgparse.c

index 26683a5964c93566df20d86113db55a2f4e77ed3..1c42d065d9f8aeda947f957528b8e4e8a52cdcb9 100644 (file)
@@ -963,9 +963,12 @@ nbproc <number>
 
 nbthread <number>
   This setting is only available when support for threads was built in. It
-  creates <number> threads for each created processes. It means if HAProxy is
-  started in foreground, it only creates <number> threads for the first
-  process. See also "nbproc".
+  makes haproxy run on <number> threads. This is exclusive with "nbproc". While
+  "nbproc" historically used to be the only way to use multiple processors, it
+  also involved a number of shortcomings related to the lack of synchronization
+  between processes (health-checks, peers, stick-tables, stats, ...) which do
+  not affect threads. As such, any modern configuration is strongly encouraged
+  to migrate away from "nbproc" to "nbthread". See also "nbproc".
 
 pidfile <pidfile>
   Writes PIDs of all daemons into file <pidfile>. This option is equivalent to
index 4c8b1fea92fbd15264e7a04f1fbc1f70ad4cc776..85d8dd53aa01587872d92c4ecc89cb8af4bc9c5e 100644 (file)
@@ -2200,6 +2200,12 @@ int check_config_validity()
        if (!global.tune.requri_len)
                global.tune.requri_len = REQURI_LEN;
 
+       if (global.nbproc > 1 && global.nbthread > 1) {
+               ha_alert("config : cannot enable multiple processes if multiple threads are configured. Please use either nbproc or nbthread but not both.\n");
+               err_code |= ERR_ALERT | ERR_FATAL;
+               goto out;
+       }
+
        pool_head_requri = create_pool("requri", global.tune.requri_len , MEM_F_SHARED);
 
        pool_head_capture = create_pool("capture", global.tune.cookie_len, MEM_F_SHARED);