From: Willy Tarreau Date: Sat, 2 Feb 2019 11:56:15 +0000 (+0100) Subject: MAJOR: config: disable support for nbproc and nbthread in parallel X-Git-Tag: v2.0-dev2~166 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26f6ae12c;p=thirdparty%2Fhaproxy.git MAJOR: config: disable support for nbproc and nbthread in parallel 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. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index 26683a5964..1c42d065d9 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -963,9 +963,12 @@ nbproc nbthread This setting is only available when support for threads was built in. It - creates threads for each created processes. It means if HAProxy is - started in foreground, it only creates threads for the first - process. See also "nbproc". + makes haproxy run on 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 Writes PIDs of all daemons into file . This option is equivalent to diff --git a/src/cfgparse.c b/src/cfgparse.c index 4c8b1fea92..85d8dd53aa 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -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);