consistent hashing for upstreams

rmalayter nginx-forum at
Mon Mar 19 21:16:09 UTC 2012

Alexandr Gomoliako Wrote:
> Here's a simple approach on consistent hashing
> with embedded perl:

Interesting. Clearly one could generate the upstream blocks via script.

The only potential issues I foresee are:
    1) performance, as this perl will be called for 1000+ requests per
second, and there are going to be potentially many upstream blocks.
Maybe Digest::MurmurHash would help with performance instead of MD5
(it's supposedly 3x faster in Perl than Digest::MD5 while using far less
state). A native hash ring implementation in C would obviously be far
more performant.
    2) a single backup server is problematic, but that can be fixed by
adding more backups to the upstream blocks I think, or doing an error
location that hashes again to find a new upstream. Not sure if a server
being down would cause it to fail inside all upstream blocks it appears
though, which might mean some very slow responses when a server goes
   3) Perl module is still marked as experimental, which scares me

I will give it a good long-term load test though, it might just be good


Posted at Nginx Forum:,224038,224045#msg-224045

More information about the nginx mailing list