On Thu, Dec 11, 2008 at 16:11, Adam Allgaier <[EMAIL PROTECTED]> wrote:
> > I'm fairly new to memcached, so pardon my ignorance.... > > If you disable one of your N servers, won't that invalidate most of the > cache? > > Since the clients will hash the key against the list of servers, if you > change the number of servers, won't the clients map all the keys to > potentially new servers, effectively invalidating most of the cache? > > If that's true, then disabling a server (changing the server set) has a > much larger impact than simply continually missing 1/N of the cache queries. > That depends entirely on your key distribution algorithm. What you say above is true for the naive or simple one, where changing the server list causes almost every key to be invalidated (n-1/n to be specific, there's a 1/n random chance that a key stays on the same server) but if you use the ketama method, keys will "stick" to their server. If you remove a server, its keys will be evenly redistributed among the remaining, and if you add a server, it will get an even distribution of keys from the other servers. You can read more about ketama here: http://www.last.fm/user/RJ/journal/2007/04/10/rz_libketama_-_a_consistent_hashing_algo_for_memcache_clients /Henrik
