diff --git a/doc/configuration.txt b/doc/configuration.txt index 26683a596..1c42d065d 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 4c8b1fea9..85d8dd53a 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);