Tuesday, February 8, 2011

Benefits of multiple memcached instances

Is there any difference between having 4 .5GB memcache servers running or one 2GB instance?

Does running multiple instances offer any benifits?

  • High availability is nice, and memcached will automatically distribute your cache across the 4 servers. If one of those servers dies for some reason, you can handle that error by either just continuing as if the cache was blank, redirecting to a different server, or any sort of custom error handling you want. If your 1x 2gb server dies, then your options are pretty limited.

    The important thing to remember is that you do not have 4 copies of your cache, it is 1 cache, split amongst the 4 servers.

    The only downside is that it's easier to run out of 4x .5 than it is to run out of 1x 2gb memory.

    Alister Bulman : distributing entries across servers is the job of the client. There are a number of techniques to aid in that, which are laid out in the various memcached FAQs and clients.
  • If one instance fails, you're still get advantages of using the cache. This is especially true if you are using the Consistenthashing that will bring the same data to the same instance, rather than spreading new reads/writes among the machines that are still up.

    You may also elect to run servers on 32 bit operating systems, that cannot address more than around 3GB of memory.

    Check the FAQ: http://www.socialtext.net/memcached/ and http://www.danga.com/memcached/

  • I would also add that theoretically, in case of several machines, it might save you some performance, as if you have a lot of frontends doing a lot of heavy reads, it's much better to split them into different machines: you know, network capabilities and processing power of one machine can become an upper bound for you.

    This advantage is highly dependent on memcache utilization, however (sometimes it might be ways faster to fetch everything from one machine).

    From Anton

0 comments:

Post a Comment