]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
DOC: config: prefer-last-server: add notes for non-deterministic algorithms
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Tue, 17 Jun 2025 13:33:12 +0000 (13:33 +0000)
committerOlivier Houchard <cognet@oliviers-macbook-pro.home>
Tue, 17 Jun 2025 19:18:23 +0000 (21:18 +0200)
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.

doc/configuration.txt

index 4b4fc8c01e3d8f8100b2fb08f43d382d613faa90..77d309de4433d7c9cf0bc02e9bf95fa8f1870425 100644 (file)
@@ -10639,8 +10639,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"