Hello, I did mean djb2, typo on my end, and it is the same as as hash_djbx33. I will take a look at 1.5 later today, and try to test it out
Here [1] is a short page on the 2 functions. The config we have in production uses consistent hashing on the host header, the function "get_server_hh" is invoked we have patches that update backend.c [2] from hash = *p + (hash << 6) + (hash << 16) - hash; to hash = (px->lbprm.func & BE_LB_HASH_DJB2) ? 5381 : 0; hash = *p + (hash << 5) + hash; (the equivalent changes where required), when the "hash-func" option is specified. The choice to use host header, was an application design. The choice of using DJB2 came about from testing load distribution on the backends. A little dated description is available at [3]. The number of haproxy, varnish and web nodes has grown substantially. I say this to make clear that this might be specific for larger deployments. [1] http://www.cse.yorku.ca/~oz/hash.html [2] http://haproxy.1wt.eu/git?p=haproxy-1.4.git;a=blob_plain;f=src/backend.c;hb=HEAD [3] http://highscalability.com/blog/2012/2/13/tumblr-architecture-15-billion-page-views-a-month-and-harder.html Thanks Bhaskar On Sun, Oct 20, 2013 at 2:30 AM, Willy Tarreau <[email protected]> wrote: > Hello, > > On Fri, Oct 18, 2013 at 06:54:40PM -0400, Bhaskar Maddala wrote: > > Hello, > > > > We have been using haproxy for load balancing requests across our > > backbends. We use consistent hashing, in experiments for the requests > > processed and specific to our architecture we found dbj2 providing a > better > > distribution over sdbm when the remainder of the configuration was left > > unchanged. > > > > We have a patched version of haproxy based on 1.4.24 that adds a config > > option of hash-func with values sdbm and dbj2, sdbm as default, we have > > been using dbj2 in production for a while now. I am writing to determine > > interest if any for this change before submitting a patch. > > I don't know these sdbm nor dbj2 functions. For the later I suspect you > meant "djb2" instead which is the same as hash_djbx33 in tests_hashes.c. > But sdbm I still don't know. > > In 1.5, an avalanche hash is always performed before applying the > consistent hash, which should provide a smoother distribution than > in 1.4. Could you please check if 1.5 still needs this ability to > change the hash function ? I'm not opposed to a new parameter, but > I'd prefer to avoid it if it's not necessary. > > Thanks, > Willy > >

