]> git.kaiwu.me - haproxy.git/commit
MINOR: server: support hash-key id32 for a cleaner distribution
authorWilly Tarreau <w@1wt.eu>
Tue, 19 May 2026 16:35:06 +0000 (18:35 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 19 May 2026 17:11:25 +0000 (19:11 +0200)
commita59e6e5efd01a30ed4b83310ca8ba127f56488d0
tree83e9918cf271cb0f5cfe3960a39d0d4f033faf15
parentcb5d98c495d21de9e45fc02a78a5ff06c0ac7b44
MINOR: server: support hash-key id32 for a cleaner distribution

The "id" hash-key scales the ID by a factor of 16 that tries to leave
room between the nodes on the 32-bit space to permit smooth weight
variations (e.g. during slowstart). However this does not deal well
with overlaps between server IDs. For example, assigning IDs that are
only multiples of 256 million to 16 servers yields traffic only on
one since in practice they all have the same 28 lower bits.

The new "id32" hash key bridges this gap by using the full 32-bit ID
of the server as the key. On the other hand, the user must be careful
not to switch the hash function to "none" when using incremental IDs
because in this case they might be very poorly distributed. But this
can be convenient for automated provisionning systems which assign
IDs themselves, as the full 32 bits are used now.
doc/configuration.txt
include/haproxy/server-t.h
src/lb_chash.c
src/server.c