Multi-Master Memcached Replication

dormando dormando at
Mon Apr 21 19:19:56 UTC 2008

> I would like to create the scenario where I have:
> 2 tomcat web servers
> 2 memcached servers
> 1 Postgresql database
> So that the memcached servers are staying in sync with each other, in a 
> multi-master fashion. I found the tool repcached, but it is 
> single-master, single slave. This will not work for my application. Any 
> ideas?

Be sure you're doing it right. The "normal" memcached pattern is to add 
servers to a cloud. So if you lose one server your hit ratio will be cut 
by 50% until that server comes back up or you add another one. If you 
have three memcached's and you lose one, the cache hit ratio will drop 
by 33%, and so on.

If you require master:master replication that will stunt your growth to 
two servers max. Among other issues...

There's another replication option which Brian just mentioned, where you 
may send multiple replicas of one cache item into the cloud. That 
approach doesn't stunt growth, but halves effective cache size. Since 
you're storing everything at least twice.

This is like RAID10'ing your drives. The cost becomes more obviously 
painful as you add servers. If you had 100 memcached's and one died 
you'd get a 1% hit to your hit ratio. If you're replicating you'd 
probably need 200 memcached's to get the same memory capacity, but avoid 
the 1% drop...

So you should weigh these options and do what makes the best sense for 
your project.


More information about the memcached mailing list