The Cheeky Monkey Media Blog

A few words from the apes, monkeys, and various primates that make up the Cheeky Monkey Super Squad.

Memcached VS Redis banner

Memcached and Redis are in-memory key-value pair storing system, or in short, a “caching” system. Both of them open-sourced.

First a bit of history.

Memcached

Originally developed by Brad Fitzpatrick at Danda interactive for their website LiveJournal, which was very popular in 2003. It was written in Perl at first, then written in C by Anatoly Vorobey (who was also employed at LiveJournal because of his work).

Now in 2015, this program has continuously proved its capabilities and is used by a lot of top websites such as:

  • Youtube
  • Reddit
  • Facebook
  • Twitter
  • Tumblr
  • Wikipedia

Redis

Development began in early 2009 by an Italian developer called Salvatore Sanfilippo. It was originally created to enhance performance of LLOOGG(Web Analytic Product). In the summer of 2009, Redis was ready for launch and added to their LLOOGG production environment and stopped using the MySQL system. Over the next year, Redis gained a lot of attention. Salvatore added new features and errors reports were handled.

Later, VMWare hired Salvatore and Pieter Noordhuis full time to work on Redis to get a faster development.

Now Memcached and Redis are both Cached software. Let’s see what resemblance they have:

  • They have NoSQL mechanism.
  • They store their data in RAM.
  • Are build on same key-value data model

And with regards to performance, the two software are almost indistinguishable. They are both great performers.

Now let’s cut to the chase.

What is better?

First, Memcached is older and more stable because it is way less “sophisticated” than Redis. Translation – Memcached has far lesser bugs.

Second, If you’re building a small website that will only store a small amount of data and HTML code, Memcached’s system is more effective because it uses less memory for metadata. There is only one data type used by Memcached which is String. They are simple to store and require no additional processing. And finally, Memcached is easy to scale.

Now for Redis.

Redis is a powerhouse compared to Memcached. It uses more advanced procedures to memory management eviction candidate selection.

With Redis, you can set key names and values to be 512MB each, compared to Memcached’s 250 bytes for key names and limits value to 1MB with only plain strings.

For cache eviction, is has 6 different methods that it uses to properly evict what you want. It is very transparent with its server too, with almost 200 handy commands to manipulate the data the way you want through server-side scripting. And finally, when failure occurs and the server needs to reboot, the data from the previous session is saved and stored. This is important because if the cache is cleared completely, it takes a longer time to warm-up back to its original state.

All in all, if you want simplicity and stability, go for Memcached, and if you want full control to manipulate your cache, then go for Redis. Both are awesome, open-source software that is used by every good web server.