UDP load balancing
UDP load balancing reference
The UDP module uses the following directives for configuration:
The UDP module uses the following directives for configuration:
accepted-payload-size Jump to heading
Sets the maximum UDP datagram payload size (in bytes). The default is 1472
. The maximum allowed is 65507
.
Syntax:
text
accepted-payload-size <number>
text
accepted-payload-size <number>
balance Jump to heading
Sets the load balancing algorithm.
Syntax:
text
balance <algorithm>`
text
balance <algorithm>`
The UDP module supports the following values for balance
:
static-rr
roundrobin
leastconn
first
source
random
default-server Jump to heading
Sets default parameters that will apply to all server
lines within the same section. For a list of supported parameters, see default-server options.
Syntax:
text
default-server [param*]
text
default-server [param*]
dgram-bind Jump to heading
Configures a datagram listener to receive messages to forward. Addresses must be in IPv4 or IPv6 form, optionally followed by a port.
Syntax:
text
dgram-bind <addr> [param*]
text
dgram-bind <addr> [param*]
The dgram-bind
directive supports these bind parameters:
maxconn
namespace
nice
shards
thread
transparent
hash-balance-factor Jump to heading
This section applies to:
- HAProxy ALOHA 17.0 and newer
- HAProxy Enterprise 3.1r1 and newer
Specifies the balancing factor for bounded-load consistent hashing. Please refer to hash-balance-factor for more details.
Syntax:
text
hash-balance-factor <factor>
text
hash-balance-factor <factor>
hash-type Jump to heading
This section applies to:
- HAProxy ALOHA 17.0 and newer
- HAProxy Enterprise 3.1r1 and newer
Specifies a method to use for mapping hashes to servers. Please refer to the hash-type for more details.
Syntax:
text
hash-type <method> <function> <modifier>
text
hash-type <method> <function> <modifier>
log Jump to heading
This section applies to:
- HAProxy ALOHA 17.0 and newer
- HAProxy Enterprise 3.0r1 and newer
Enables per-instance logging of events. For requests, the source is the IP/port of the client, and the destination is the IP/port of the listener. For responses, the source is the listener, and the destination is the client.
For details, see log reference.
Syntax:
text
log <target> [len <length>] [format <format>] [sample <ranges>:<sample_size>] <facility> [<level> [<minlevel>]]
text
log <target> [len <length>] [format <format>] [sample <ranges>:<sample_size>] <facility> [<level> [<minlevel>]]
log global Jump to heading
This section applies to:
- HAProxy ALOHA 17.0 and newer
- HAProxy Enterprise 3.0r1 and newer
Sets the instance’s logging parameters to be the same as the global ones.
Syntax:
text
log global
text
log global
log-tag Jump to heading
This section applies to:
- HAProxy ALOHA 17.0 and newer
- HAProxy Enterprise 3.0r1 and newer
Sets the log tag string to use for all outgoing logs.
Syntax:
text
log-tag <string>
text
log-tag <string>
maxconn Jump to heading
Sets the maximum number of concurrent connections. Once the limit is reached, all datagrams received initiating new UDP connection will be dropped.
Syntax:
text
maxconn <maxconn>
text
maxconn <maxconn>
option tcp-check Jump to heading
Performs health checks using TCP connection attempts.
Syntax:
text
option tcp-check
text
option tcp-check
option udp-check Jump to heading
Performs health checks via ICMP.
Syntax:
text
option udp-check
text
option udp-check
proxy-requests Jump to heading
Sets the number of expected datagrams per client session. Since UDP is not a connection-oriented protocol, the UDP module must keep track of a client’s session such that it can route the response datagrams from an upstream server back to the correct client. Each session is indexed by the 4-tuple consisting of source IP/port and destination IP/port corresponding to the datagram.
-
If this option is not set, then the load balancer will forward all datagrams from the client to the same backend server as long as the client is considered alive. If the client becomes inactive, their session expires and the next time they send a datagram, the load balancer will again choose a server based on the load balancing algorithm.
-
If this option is set to a value greater than 0, then session stickiness is disabled and the load balancer will choose the backend server on every
<number>
datagrams received. For example, ifproxy-requests 1
then a destination server will be rotated after each datagram received from the client.
Syntax:
text
proxy-requests <number>
text
proxy-requests <number>
proxy-responses Jump to heading
Sets the number of expected responses from the server. Sessions last until the timeout is reached or the expected number of responses has been received. If zero value is specified, all responses from the server will be ignored and not forwarded back to the client. If a value is not specified, the number of expected responses is set to unlimited.
Syntax:
text
proxy-responses <number>
text
proxy-responses <number>
server Jump to heading
Configures a target server.
Syntax:
text
server <name> <address>[:[port]] [param*]
text
server <name> <address>[:[port]] [param*]
source Jump to heading
Sets the source address for outgoing connections. The <addr>
and optional <port>
will be used for binding before connecting to the server. The <addr2>
and <port2>
are presented to the server when connections are forwarded in full transparent proxy mode. If client
or clientip
is set, the load balancer will present the client’s IP address and port, or the client’s IP address only.
Syntax for setting source address:
text
source <addr>[:<port>] [usesrc { <addr2>[:<port2>] | client | clientip } ]
text
source <addr>[:<port>] [usesrc { <addr2>[:<port2>] | client | clientip } ]
Syntax for setting interface name:
text
source <addr>[:<port>] [interface <name>]
text
source <addr>[:<port>] [interface <name>]
tcp-check Jump to heading
Configures TCP health checking.
Syntax:
text
tcp-check <option> [param*]
text
tcp-check <option> [param*]
Supported options are:
comment
connect
send
send-lf
send-binary
send-binary-lf
expect
set-var
set-var-fmt
unset-var
timeout client Jump to heading
Sets the maximum inactivity time on the client side. If you define this value, you must define it in the udp-lb
section. It is not inherited from the defaults
section of the load balancer configuration.
The default is 10 seconds, but the ideal setting depends on your traffic and application. For example, if you have a large amount of traffic and a large number of client IP addresses and ports, you could lower the value in order to avoid tracking a high number of connections unnecessarily.
Syntax:
text
timeout client <timeout>
text
timeout client <timeout>
timeout server Jump to heading
Sets the maximum inactivity time on the server side. If you define this value, you must define it in the udp-lb
section. It is not inherited from the defaults
section of the load balancer configuration.
Syntax:
text
timeout server <timeout>
text
timeout server <timeout>
Do you have any suggestions on how we can improve the content of this page?