views:

71

answers:

1

Hi everyone,

I am trying to find good resources on best practices to data replication across memcache servers. What I want to accomplish is that if one of my servers in my pool goes down, the next server in line already has the info set.

I have found "repcached" but since I run a WIN32 test environment, I have been unable to install it.

So what's our alternatives on how to replicate data between servers?

Thanks,

+1  A: 

I've never bothered with this myself (memcache is just meant to be a cache after all, even if each instance was an exact copy of every other instance, you still can't guarantee that a value will always exist once you add it: it might be evicted due to the LRU policy, for example).

However, if I were to implement this as a feature, I would put it in the client and not as a patch to the server.

That is, instead of hashing a key to a single server, hash it to 2 or 3 servers and store the value on all of them. Then, when getting the value back again, try to get it from the first, if it's not there, try the second one and so on.

This has the added benefit of not replicating every value: you can replicate only those that you choose to.

Dean Harding
Hmmm you mean using something like flexihash? http://github.com/pda/flexihash
Industrial
Consistent hashing is slightly different. With consistent hashing, what happens is if a server is removed from (or added to) the pool, then the hashing is defined such that all other keys will still hash to the same server: you only invalidate the part of the cache that was held in the now-removed server. Without consistent hashing, if you removed a server then *all* keys would be invalidated.
Dean Harding
Thanks for your help, Codeka. It was really valuable and put us in the right direction!
Industrial