]> git.ipfire.org Git - thirdparty/haproxy.git/commit
[MEDIUM] backend: implement consistent hashing variation
authorWilly Tarreau <w@1wt.eu>
Thu, 1 Oct 2009 05:52:15 +0000 (07:52 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 9 Oct 2009 05:17:58 +0000 (07:17 +0200)
commit6b2e11be1ef15da16003a66d7f0fc10d256205e9
tree34314c2143d4b80876269474b8f893b1fd72662d
parent4cdd8314e949f1c31f86331a1122c3ec9ff7c233
[MEDIUM] backend: implement consistent hashing variation

Consistent hashing provides some interesting advantages over common
hashing. It avoids full redistribution in case of a server failure,
or when expanding the farm. This has a cost however, the hashing is
far from being perfect, as we associate a server to a request by
searching the server with the closest key in a tree. Since servers
appear multiple times based on their weights, it is recommended to
use weights larger than approximately 10-20 in order to smoothen
the distribution a bit.

In some cases, playing with weights will be the only solution to
make a server appear more often and increase chances of being picked,
so stats are very important with consistent hashing.

In order to indicate the type of hashing, use :

   hash-type map-based      (default, old one)
   hash-type consistent     (new one)

Consistent hashing can make sense in a cache farm, in order not
to redistribute everyone when a cache changes state. It could also
probably be used for long sessions such as terminal sessions, though
that has not be attempted yet.

More details on this method of hashing here :
  http://www.spiteful.com/2008/03/17/programmers-toolbox-part-3-consistent-hashing/
Makefile
Makefile.bsd
Makefile.osx
doc/configuration.txt
include/proto/lb_chash.h [new file with mode: 0644]
include/types/backend.h
include/types/lb_chash.h [new file with mode: 0644]
include/types/server.h
src/backend.c
src/cfgparse.c
src/lb_chash.c [new file with mode: 0644]