Memcached hashing algorithm?

howard chen howachen at
Fri Nov 30 02:49:29 UTC 2007


Some questions about the hashing algorithm:

Currently, memcached use algorithm such as:

server = serverlist[hash(key)%serverlist.length];

What is the serverlist in fact?

1. The servers you specified?
2. The servers actually connected?

Is it up to the implementation of client?

For example, using Perl:

It said:

When a server goes down, this module does detect it, and re-hashes the
request to the remaining servers, but the way it does it isn't very
clean. The result may be that it gives up during its rehashing and
refuses to get/set something it could've, had it been done right.

So is it true that even some of my servers are up, the client might
choose to give up caching as it hit the down servers?


More information about the memcached mailing list