Server Selection
Greg Whalin
gwhalin at meetup.com
Tue Dec 6 13:59:10 UTC 2005
Ivan Krstic wrote:
> 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.
This is 100% correct. I guess I had never envisioned people putting the
order in different. I would not feel comfortable re-sorting the list in
the event that the user intentionally set the order for some reason
(can't think of a very compelling one off the top of my head, but does
not mean there is not one).
gw
More information about the memcached
mailing list