From: Valentine Krasnobaeva Date: Tue, 17 Jun 2025 13:33:12 +0000 (+0000) Subject: DOC: config: prefer-last-server: add notes for non-deterministic algorithms X-Git-Tag: v3.1.9~132 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=db39526525ec1124f8742410c573a621311c0ce3;p=haproxy-3.1.git DOC: config: prefer-last-server: add notes for non-deterministic algorithms Add some notes which load-balancing algorithm can be considered as deterministic or non-deterministic and add some examples for each type. This was asked via mailing list to clarify the usage of prefer-last-server option. This can be backported to all stable versions. (cherry picked from commit cdb2f8d780a27778cc23669693a9910e07135e8a) Signed-off-by: Willy Tarreau (cherry picked from commit d6ca14b764039ed1c5d21d2fa83706996fd0a717) Signed-off-by: Christopher Faulet --- diff --git a/doc/configuration.txt b/doc/configuration.txt index 88dd479..aebc8d4 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -10813,8 +10813,23 @@ no option prefer-last-server desirable in these environments as well, to avoid redistributing the traffic after every other response. - If this option has been enabled in a "defaults" section, it can be disabled - in a specific instance by prepending the "no" keyword before it. + It may be useful to precise here, which load balancing algorithms are + considered deterministic. Deterministic algorithms will always select the same + server for a given client data, assuming the set of available servers has not + changed. In general, deterministic algorithms involve hasing or lookups on the + incoming requests to choose the target server. However, this is not always the + case; "static-rr", for example, can be also considered as deterministic because + the server choice is based on the server's static weight, making the selection + predictable. "sticky" algorithm provides deterministic routing for the + returning clients. + + As for non-deterministic algorithms, these algorithms select a server based on + dynamic server state or simple rotation, so two consecutive requests are not + guaranteed to land on the same server. option prefer-last-server is designed + specifically for these. roundrobin, leastconn are examples of such algorithms. + + If this option has been enabled in a "defaults" section, it can be + disabled in a specific instance by prepending the "no" keyword before it. See also: "option http-keep-alive"