Question

In the memcached overview here

It says:

Memcached servers are generally unaware of each other. There is no crosstalk, no syncronization, no broadcasting. The lack of interconnections means adding more servers will usually add more capacity as you expect. There might be exceptions to this rule, but they are exceptions and carefully regarded. 

I am thinking how it can be a distributed system without synchronizing across nodes in a cluster? If I write to the cache on node 1 from my program and my next request goes to node2, then i am reading from a stale cache.

Was it helpful?

Solution

Memcache provides no features related to key sharding, hashing, replication, HA, redundancy, or failover.

It's the client libraries that leverage some type of hashing algorithm to distribute keys across a cluster of memcached servers, but that functionality is completely independent from memcached itself.

There's lots of client libraries depending on your target language, just pick one that provides the hashing features you need and you're good to go:
http://code.google.com/p/memcached/wiki/Clients

OTHER TIPS

If you ask memcache to write to the cache for a key X, it sends traffic to shard h(X) where h maps an item to the node it lives on. If you want to read from the cache for a key X, similarly the traffic goes to shard h(X), similarly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top