Better server selection client code?
sgrimm at facebook.com
Mon Nov 6 17:49:11 UTC 2006
Jeetendra Mirchandani wrote:
> Consistent hashing has a shortcoming of not distributing load evenly.
> Some cases require the number of servers to be a power of 2 always to
> have perfect distribution of load!
> The paper mentions of keeping more than one copy to counter this. But
> then, keeping more copies is equivalent to loosing half my machines :-O
The paper suggests putting each server in a number of random locations
around the unit circle to counter that problem. If you have two servers
and each one has, say, 50 positions on the unit circle, then you will
get load distribution that's just as good as if you had 100 servers each
with one position on the circle.
Brad's sample implementation does that, with the added twist of
replacing "random" with "deterministic based on the server address"
which of course is necessary because each client will be computing its
own unit circle and they all need to match.
More information about the memcached