Server Selection

Ivan Krstic krstic at
Tue Dec 6 05:23:59 UTC 2005

Lee Kemp wrote:
> Yeah, so say if i had one webserver that has
> [...]
> set as there memcached server ips, will this cause issue with  duplicate
> items in my cache etc..? or would the hash still work out ok?

This is solely dependent on the client implementation. You mentioned you
were using the Java API, and from my one-minute glance at its source, it
 looks like servers are internally placed into buckets in the order
given at instantiation, and the cache key's CRC is transformed directly
to a bucket array index, so you can't have servers listed in different
orders in your clients if you don't want useless copies of the information.

This should be easily solved by patching SockIOPool to sort the given
server list before transforming it to a bucket array. If any of your
clients has a server list whose length differs from any other's,
however, you're bound to get unnecessary duplication, and there's no
easy way around that.

Greg Whalin, the JAVA memcached API author, is on the list, so he'll
correct me if I misread his code.

Ivan Krstic <krstic at> | 0x147C722D

More information about the memcached mailing list