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.
This commit is contained in:
Willy Tarreau 2019-02-02 12:56:15 +01:00
parent c299e1e027
commit 26f6ae12c0
2 changed files with 12 additions and 3 deletions

View 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

View 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);