DOC: update references to process numbers in cpu-map and bind-process

Let's mention that cpu-map is limited to process 1 and that bind-process
is deprecated. Other minor adjustments were made to "process" on bind
lines.
This commit is contained in:
Willy Tarreau 2021-06-15 11:35:31 +02:00
parent e8422bf56b
commit 317804d288

View File

@ -1122,7 +1122,7 @@ chroot <jail dir>
empty and non-writable to anyone. empty and non-writable to anyone.
cpu-map [auto:]<process-set>[/<thread-set>] <cpu-set>... cpu-map [auto:]<process-set>[/<thread-set>] <cpu-set>...
On Linux 2.6 and above, it is possible to bind a process or a thread to a On some operating systems, it is possible to bind a process or a thread to a
specific CPU set. This means that the process or the thread will never run on specific CPU set. This means that the process or the thread will never run on
other CPUs. The "cpu-map" directive specifies CPU sets for process or thread other CPUs. The "cpu-map" directive specifies CPU sets for process or thread
sets. The first argument is a process set, eventually followed by a thread sets. The first argument is a process set, eventually followed by a thread
@ -1130,10 +1130,10 @@ cpu-map [auto:]<process-set>[/<thread-set>] <cpu-set>...
all | odd | even | number[-[number]] all | odd | even | number[-[number]]
<number>> must be a number between 1 and 32 or 64, depending on the machine's <number> must be a number between 1 and 32 or 64, depending on the machine's
word size. Any process IDs above nbproc and any thread IDs above nbthread are word size. Any process IDs above 1 and any thread IDs above nbthread are
ignored. It is possible to specify a range with two such number delimited by ignored. It is possible to specify a range with two such number delimited by
a dash ('-'). It also is possible to specify all processes at once using a dash ('-'). It also is possible to specify all thraeds at once using
"all", only odd numbers using "odd" or even numbers using "even", just like "all", only odd numbers using "odd" or even numbers using "even", just like
with the "bind-process" directive. The second and forthcoming arguments are with the "bind-process" directive. The second and forthcoming arguments are
CPU sets. Each CPU set is either a unique number starting at 0 for the first CPU sets. Each CPU set is either a unique number starting at 0 for the first
@ -1152,49 +1152,40 @@ cpu-map [auto:]<process-set>[/<thread-set>] <cpu-set>...
on the machine's word size. on the machine's word size.
The prefix "auto:" can be added before the process set to let HAProxy The prefix "auto:" can be added before the process set to let HAProxy
automatically bind a process or a thread to a CPU by incrementing automatically bind a process or a thread to a CPU by incrementing threads and
process/thread and CPU sets. To be valid, both sets must have the same CPU sets. To be valid, both sets must have the same size. No matter the
size. No matter the declaration order of the CPU sets, it will be bound from declaration order of the CPU sets, it will be bound from the lowest to the
the lowest to the highest bound. Having a process and a thread range with the highest bound. Having both a process and a thread range with the "auto:"
"auto:" prefix is not supported. Only one range is supported, the other one prefix is not supported. Only one range is supported, the other one must be
must be a fixed number. a fixed number.
Note that process ranges are supported for historical reasons. Nowadays, a
lone number designates a process and must be 1, and specifying a thread range
or number requires to prepend "1/" in front of it. Finally, "1" is strictly
equivalent to "1/all" and designates all threads on the process.
Examples: Examples:
cpu-map 1-4 0-3 # bind processes 1 to 4 on the first 4 CPUs
cpu-map 1/all 0-3 # bind all threads of the first process on the cpu-map 1/all 0-3 # bind all threads of the first process on the
# first 4 CPUs # first 4 CPUs
cpu-map 1- 0- # will be replaced by "cpu-map 1-64 0-63" cpu-map 1/1- 0- # will be replaced by "cpu-map 1/1-64 0-63"
# or "cpu-map 1-32 0-31" depending on the machine's # or "cpu-map 1/1-32 0-31" depending on the machine's
# word size. # word size.
# all these lines bind the process 1 to the cpu 0, the process 2 to cpu 1
# and so on.
cpu-map auto:1-4 0-3
cpu-map auto:1-4 0-1 2-3
cpu-map auto:1-4 3 2 1 0
# all these lines bind the thread 1 to the cpu 0, the thread 2 to cpu 1 # all these lines bind the thread 1 to the cpu 0, the thread 2 to cpu 1
# and so on. # and so on.
cpu-map auto:1/1-4 0-3 cpu-map auto:1/1-4 0-3
cpu-map auto:1/1-4 0-1 2-3 cpu-map auto:1/1-4 0-1 2-3
cpu-map auto:1/1-4 3 2 1 0 cpu-map auto:1/1-4 3 2 1 0
# bind each process to exactly one CPU using all/odd/even keyword # bind each thread to exactly one CPU using all/odd/even keyword
cpu-map auto:all 0-63 cpu-map auto:1/all 0-63
cpu-map auto:even 0-31 cpu-map auto:1/even 0-31
cpu-map auto:odd 32-63 cpu-map auto:1/odd 32-63
# invalid cpu-map because process and CPU sets have different sizes. # invalid cpu-map because thread and CPU sets have different sizes.
cpu-map auto:1-4 0 # invalid cpu-map auto:1/1-4 0 # invalid
cpu-map auto:1 0-3 # invalid cpu-map auto:1/1 0-3 # invalid
# invalid cpu-map because automatic binding is used with a process range
# and a thread range.
cpu-map auto:all/all 0 # invalid
cpu-map auto:all/1-4 0 # invalid
cpu-map auto:1-4/all 0 # invalid
crt-base <dir> crt-base <dir>
Assigns a default directory to fetch SSL certificates from when a relative Assigns a default directory to fetch SSL certificates from when a relative
@ -1627,8 +1618,8 @@ master-worker [no-exit-on-failure]
This mode will launch a "master" which will monitor the "workers". Using This mode will launch a "master" which will monitor the "workers". Using
this mode, you can reload HAProxy directly by sending a SIGUSR2 signal to this mode, you can reload HAProxy directly by sending a SIGUSR2 signal to
the master. The master-worker mode is compatible either with the foreground the master. The master-worker mode is compatible either with the foreground
or daemon mode. It is recommended to use this mode with multiprocess and or daemon mode.
systemd.
By default, if a worker exits with a bad return code, in the case of a By default, if a worker exits with a bad return code, in the case of a
segfault for example, all workers will be killed, and the master will leave. segfault for example, all workers will be killed, and the master will leave.
It is convenient to combine this behavior with Restart=on-failure in a It is convenient to combine this behavior with Restart=on-failure in a
@ -1701,17 +1692,9 @@ resetenv [<name> ...]
"setenv", "presetenv", and "unsetenv". "setenv", "presetenv", and "unsetenv".
stats bind-process [ all | odd | even | <process_num>[-[process_num>]] ] ... stats bind-process [ all | odd | even | <process_num>[-[process_num>]] ] ...
Limits the stats socket to a certain set of processes numbers. By default the Deprecated. Before threads were supported, this was used to force some stats
stats socket is bound to all processes, causing a warning to be emitted when instances on certain processes only. The default and only accepted value is
nbproc is greater than 1 because there is no way to select the target process "1" (along with "all" and "odd" which alias it). Do not use this setting.
when connecting. However, by using this setting, it becomes possible to pin
the stats socket to a specific set of processes, typically the first one. The
warning will automatically be disabled when this setting is used, whatever
the number of processes used. The maximum process ID depends on the machine's
word size (32 or 64). Ranges can be partially defined. The higher bound can
be omitted. In such case, it is replaced by the corresponding maximum
value. A better option consists in using the "process" setting of the "stats
socket" line to force the process on each line.
server-state-base <directory> server-state-base <directory>
Specifies the directory prefix to be prepended in front of all servers state Specifies the directory prefix to be prepended in front of all servers state
@ -4102,67 +4085,15 @@ bind /<path> [, ...] [param*]
bind-process [ all | odd | even | <process_num>[-[<process_num>]] ] ... bind-process [ all | odd | even | <process_num>[-[<process_num>]] ] ...
Limit visibility of an instance to a certain set of processes numbers.
May be used in sections : defaults | frontend | listen | backend May be used in sections : defaults | frontend | listen | backend
yes | yes | yes | yes yes | yes | yes | yes
Arguments :
all All process will see this instance. This is the default. It
may be used to override a default value.
odd This instance will be enabled on processes 1,3,5,...63. This Deprecated. Before threads were supported, this was used to force some
option may be combined with other numbers. frontends on certain processes only, or to adjust backends so that they
could match the frontends that used them. The default and only accepted
even This instance will be enabled on processes 2,4,6,...64. This value is "1" (along with "all" and "odd" which alias it). Do not use this
option may be combined with other numbers. Do not use it setting. Threads can still be bound per-socket using the "process" bind
with less than 2 processes otherwise some instances might be keyword.
missing from all processes.
process_num The instance will be enabled on this process number or range,
whose values must all be between 1 and 32 or 64 depending on
the machine's word size. Ranges can be partially defined. The
higher bound can be omitted. In such case, it is replaced by
the corresponding maximum value. If a proxy is bound to
process numbers greater than the configured global.nbproc, it
will either be forced to process #1 if a single process was
specified, or to all processes otherwise.
This keyword limits binding of certain instances to certain processes. This
is useful in order not to have too many processes listening to the same
ports. For instance, on a dual-core machine, it might make sense to set
'nbproc 2' in the global section, then distributes the listeners among 'odd'
and 'even' instances.
At the moment, it is not possible to reference more than 32 or 64 processes
using this keyword, but this should be more than enough for most setups.
Please note that 'all' really means all processes regardless of the machine's
word size, and is not limited to the first 32 or 64.
Each "bind" line may further be limited to a subset of the proxy's processes,
please consult the "process" bind keyword in section 5.1.
When a frontend has no explicit "bind-process" line, it tries to bind to all
the processes referenced by its "bind" lines. That means that frontends can
easily adapt to their listeners' processes.
If some backends are referenced by frontends bound to other processes, the
backend automatically inherits the frontend's processes.
Example :
listen app_ip1
bind 10.0.0.1:80
bind-process odd
listen app_ip2
bind 10.0.0.2:80
bind-process even
listen management
bind 10.0.0.3:80
bind-process 1 2 3 4
listen management
bind 10.0.0.4:80
bind-process 1-4
See also : "process" in section 5.1. See also : "process" in section 5.1.
@ -10507,9 +10438,8 @@ stats admin { if | unless } <cond>
stats http-request auth unless AUTH stats http-request auth unless AUTH
stats admin if AUTH_ADMIN stats admin if AUTH_ADMIN
See also : "stats enable", "stats auth", "stats http-request", See also : "stats enable", "stats auth", "stats http-request", section 3.4
"bind-process", section 3.4 about userlists and section 7 about about userlists and section 7 about ACL usage.
ACL usage.
stats auth <user>:<passwd> stats auth <user>:<passwd>
@ -10989,8 +10919,8 @@ stick match <pattern> [table <table>] [{if | unless} <cond>]
server s1 192.168.1.1:25 server s1 192.168.1.1:25
server s2 192.168.1.1:25 server s2 192.168.1.1:25
See also : "stick-table", "stick on", "bind-process" and section 7 See also : "stick-table", "stick on", and section 7 about ACLs and samples
about ACLs and samples fetching. fetching.
stick on <pattern> [table <table>] [{if | unless} <condition>] stick on <pattern> [table <table>] [{if | unless} <condition>]
@ -11030,7 +10960,7 @@ stick on <pattern> [table <table>] [{if | unless} <condition>]
server s1 192.168.1.1:443 server s1 192.168.1.1:443
server s2 192.168.1.1:443 server s2 192.168.1.1:443
See also : "stick match", "stick store-request" and "bind-process". See also : "stick match", "stick store-request".
stick store-request <pattern> [table <table>] [{if | unless} <condition>] stick store-request <pattern> [table <table>] [{if | unless} <condition>]
@ -11114,8 +11044,7 @@ stick store-request <pattern> [table <table>] [{if | unless} <condition>]
server s1 192.168.1.1:25 server s1 192.168.1.1:25
server s2 192.168.1.1:25 server s2 192.168.1.1:25
See also : "stick-table", "stick on", "bind-process" and section 7 See also : "stick-table", "stick on", about ACLs and sample fetching.
about ACLs and sample fetching.
stick-table type {ip | integer | string [len <length>] | binary [len <length>]} stick-table type {ip | integer | string [len <length>] | binary [len <length>]}
@ -11184,9 +11113,6 @@ stick-table type {ip | integer | string [len <length>] | binary [len <length>]}
automatically learned from the local peer (old process) during a automatically learned from the local peer (old process) during a
soft restart. soft restart.
NOTE : each peers section may be referenced only by tables
belonging to the same unique process.
<expire> defines the maximum duration of an entry in the table since it <expire> defines the maximum duration of an entry in the table since it
was last created, refreshed or matched. The expiration delay is was last created, refreshed or matched. The expiration delay is
defined using the standard time format, similarly as the various defined using the standard time format, similarly as the various
@ -13708,30 +13634,21 @@ prefer-client-ciphers
the client cipher list. the client cipher list.
process <process-set>[/<thread-set>] process <process-set>[/<thread-set>]
This restricts the list of processes or threads on which this listener is This restricts the list of threads on which this listener is allowed to run.
allowed to run. It does not enforce any process but eliminates those which do It does not enforce any of them but eliminates those which do not match. Note
not match. If the frontend uses a "bind-process" setting, the intersection that only process number 1 is permitted. If a thread set is specified, it
between the two is applied. If in the end the listener is not allowed to run limits the threads allowed to process incoming connections for this listener.
on any remaining process, a warning is emitted, and the listener will either For the unlikely case where several ranges are needed, this directive may be
run on the first process of the listener if a single process was specified, repeated. <process-set> and <thread-set> must use the format
or on all of its processes if multiple processes were specified. If a thread
set is specified, it limits the threads allowed to process incoming
connections for this listener, for the the process set. If multiple processes
and threads are configured, a warning is emitted, as it either results from a
configuration error or a misunderstanding of these models. For the unlikely
case where several ranges are needed, this directive may be repeated.
<process-set> and <thread-set> must use the format
all | odd | even | number[-[number]] all | odd | even | number[-[number]]
Ranges can be partially defined. The higher bound can be omitted. In such Ranges can be partially defined. The higher bound can be omitted. In such
case, it is replaced by the corresponding maximum value. The main purpose of case, it is replaced by the corresponding maximum value. The main purpose is
this directive is to be used with the stats sockets and have one different to have multiple bind lines sharing the same IP:port but not the same thread
socket per process. The second purpose is to have multiple bind lines sharing in a listener, so that the system can distribute the incoming connections
the same IP:port but not the same process in a listener, so that the system into multiple queues, bypassing haproxy's internal queue load balancing.
can distribute the incoming connections into multiple queues and allow a Currently Linux 3.9 and above is known for supporting this.
smoother inter-process load balancing. Currently Linux 3.9 and above is known
for supporting this. See also "bind-process".
proto <name> proto <name>
Forces the multiplexer's protocol to use for the incoming connections. It Forces the multiplexer's protocol to use for the incoming connections. It
@ -15155,8 +15072,8 @@ HAProxy provides a cache, which was designed to perform cache on small objects
(favicon, css...). This is a minimalist low-maintenance cache which runs in (favicon, css...). This is a minimalist low-maintenance cache which runs in
RAM. RAM.
The cache is based on a memory which is shared between processes and threads, The cache is based on a memory area shared between all threads, and split in 1kB
this memory is split in blocks of 1k. blocks.
If an object is not used anymore, it can be deleted to store a new object If an object is not used anymore, it can be deleted to store a new object
independently of its expiration date. The oldest objects are deleted first independently of its expiration date. The oldest objects are deleted first