Hi Rachel,

Question 3 needs to be split up, a memcached client needs first a hash
function such as CRC32, MD5, or FNV1a to transform string keys to uniform
evenly distributed integers, and it also needs a server selection algorithm
to map hashed keys to servers. For server selection there's basically only
two algorithms, the first is the naive version which works like this:

server(key) = servers[hash(key) % servers.length]

...and there's the "Ketama" algorithm, which, to confuse the issue is a
"consistent hashing algorithm". These two are independent, so you could have
two clients that use the same hash function, but different server selection
algorithms, and they would of course map keys differently.

For question 4, then no, you can assume that there is no interoperability
between different clients. There's also a third thing which differs between
clients and that is item serialization, i.e. how a client transforms an item
to be stored into a bytearray that can then be stored by memcached.
Obviously, an object in Java can't be serialized, stored in memcached,
fetched by a C# client, and then deserialized, but you will find that many
clients also choose to store simple datatypes differently.

If you want interoperability, you will have to ensure it yourself. Some
clients can be easily configured with a custom key transformer, server
selector, and item serializer, some clients are just hardcoded a certain way
and you would have to dig a bit deeper to change it.


/Henrik

On Fri, Mar 20, 2009 at 13:22, Rachel <rwill...@gmail.com> wrote:

>
> Thanks for your replies. So is this correct?
>
> 3. There is not a single hashing algorithm defined for use by a
> memcached client.
>
> so
>
> 4. There is no guarantee that two clients with the same configured set
> of servers, configured in the same order, will use the same server for
> the same key.
>
> Rachel

Reply via email to