UDP load balancing
UDP load balancing reference
The UDP module uses the following directives for configuration:
accepted-payload-size
Jump to heading
Syntax:
text
accepted-payload-size <number>
text
accepted-payload-size <number>
Maximum UDP datagram payload size (in bytes). The default is 1472
. The maximum allowed is 65507
.
balance
Jump to heading
Syntax:
text
balance <algorithm>`
text
balance <algorithm>`
The load balancing algorithm. The UDP module supports the following:
static-rr
roundrobin
leastconn
first
source
random
default-server
Jump to heading
Syntax:
text
default-server [param*]
text
default-server [param*]
The default-server
directive sets default parameters that will apply to all server
lines within the same section. For a list of supported parameters, see default-server options.
dgram-bind
Jump to heading
Syntax:
text
dgram-bind <addr> [param*]
text
dgram-bind <addr> [param*]
Configures a datagram listener to receive messages to forward. Addresses must be in IPv4 or IPv6 form, optionally followed by a port. dgram-bind
supports these bind parameters:
maxconn
namespace
nice
shards
thread
transparent
log
Jump to heading
Available since
- HAProxy Enterprise 3.0r1
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>]]
Enable 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.
log global
Jump to heading
Available since
- HAProxy Enterprise 3.0r1
Syntax:
text
log global
text
log global
Should be used to set the instance’s logging parameters to be the same as the global ones.
log-tag
Jump to heading
Available since
- HAProxy Enterprise 3.0r1
Syntax:
text
log-tag <string>
text
log-tag <string>
Set the log tag string to use for all outgoing logs.
maxconn
Jump to heading
Syntax:
text
maxconn <maxconn>
text
maxconn <maxconn>
Maximum number of concurrent connections. Once the limit is reached, all datagrams received initiating new UDP connection will be dropped.
option tcp-check
Jump to heading
Syntax:
text
option tcp-check
text
option tcp-check
Perform health checks using TCP connection attempts.
option udp-check
Jump to heading
Syntax:
text
option udp-check
text
option udp-check
Perform health checks via ICMP.
proxy-requests
Jump to heading
Syntax:
text
proxy-requests <number>
text
proxy-requests <number>
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.
proxy-responses
Jump to heading
Syntax:
text
proxy-responses <number>
text
proxy-responses <number>
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.
server
Jump to heading
Syntax:
text
server <name> <address>[:[port]] [param*]
text
server <name> <address>[:[port]] [param*]
Configures a target server.
source
Jump to heading
Syntax for setting source address:
text
source <addr>[:<port>] [usesrc { <addr2>[:<port2>] | client | clientip } ]
text
source <addr>[:<port>] [usesrc { <addr2>[:<port2>] | client | clientip } ]
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 interface name:
text
source <addr>[:<port>] [interface <name>]
text
source <addr>[:<port>] [interface <name>]
Sets the interface <name>
for binding on outgoing connections.
tcp-check
Jump to heading
Syntax:
text
tcp-check <option> [param*]
text
tcp-check <option> [param*]
Configure TCP health check using supported options:
comment
connect
send
send-lf
send-binary
send-binary-lf
expect
set-var
set-var-fmt
unset-var
timeout client
Jump to heading
Syntax:
text
timeout client <timeout>
text
timeout client <timeout>
Maximum inactivity time on the client side.
timeout server
Jump to heading
Syntax:
text
timeout server <timeout>
text
timeout server <timeout>
Maximum inactivity time on the server side.
Do you have any suggestions on how we can improve the content of this page?