Redis vs Riak vs Memcached vs DynamoDB – A NoSQL Comparison

 

When four key value data stores each claim well-known enterprises and organizations as users, it’s probably because they each have something to offer – and something different in each case. Choosing between them will depend on individual requirements or constraints.

The starting points are these:

  • Redis is in-memory with configurable trade-off between persistency and performance
  • Riak is a distributed, fault-tolerant key-value data store
  • Memcached is an in-memory data store without durability of data, and an emphasis on speed
  • DynamoDB is a key value data store service from Amazon.

Before diving into comparative detail, it’s worth listing the things that are common to all of them.

Redis, Riak, Memcached and DynamoDB each:

  • Support concurrent handling of data (concurrency)
  • Are schema-less
  • But do not support SQL
  • And do not offer foreign keys (i.e. referential integrity or avoiding entering inconsistent data).
  • The four key value stores differ in a number of other aspects. They include:
  • Licensing (DynamoDB is commercially licensed, the others are Open Source)
  • Data typing (only Riak) and secondary indexes (Riak and to some extent DynamoDB)
  • Server-side scripts (Redis and Riak) and triggers (Riak)
  • Types of APIs offered and programming languages supported
  • Consistency (DynamoDB for eventual and immediate, Riak for eventual)
  • MapReduce functionality (an option for DynamoDB, standard for Riak)
  • Suitability for transaction processing (Redis provides optimistic locking)
  • Durability or persistency of data (none for Memcached).

Reasons for Choosing Redis

As an in-memory solution, Redis is a good fit for storing transient data, such as tokens and protocol handshake data, as well as making a good base for a watchdog to limit system API usage. In all these cases, read and written data are short-lived, but occur with high volume and frequency. Latency can be kept low if a risk of data loss is acceptable. Redis also offers configurable mechanisms for persistency. However, increased persistency will tend to increase latency and decrease throughput. Redis supports five different data structures allowing it to handle entities such as sorted sets and time-series data. A further strength is in the variety of programming languages that are supported – typically these are all the languages supported by any of the other three key-value stores, and then a few more.

Reasons for Choosing Riak

Riak’s big advantage is its fault tolerance. If downtime is an issue, even when it’s only for seconds, Riak offers high read/write throughput and a zero downtime guarantee. This makes it suitable for applications such as point of sales data collection and factory control systems. It is also currently being used in at least one government agency (Denmark) disaster-proof medical data application. Operational simplicity is another plus for Riak, leading some users to switch from Redis or MongoDB when they compare the costs of operating such systems at scale. Cost reduction, flexible consistency and ease of scaling out often drive a decision to use Riak.

Reasons for Choosing Memcached

Memcached offers in-memory speed and simplicity, leading to quick deployment and easy development.  As an object caching system, it is designed to accelerate dynamic web applications by taking the load off the backend database. In particular, it has become widely used for scaling large websites (Facebook being one example). However, since Redis came onto the scene, the debate has raged about the relative merits of the two technologies. An advantage currently for Memcached is its ability to support clustering. Redis is however scheduled to have this in upcoming release 3.0. In-memory performance measures appear to favor Memcached or Redis according to the types of operations. Memcached excels at handling key/string combinations, making it a good choice for session storage for instance. 

Reasons for choosing DynamoDB

DynamoDB’s immediate difference is that it is a hosted service instead of being licensed as software. Besides removing the need for customers to set up their own servers, its PaaS (Platform as a Service) makes it immediately scalable. If you want to grow your data store, you just add data. Concurrent throughput is high and availability is assured via the multiple AWS (Amazon Web Services) data centers. Throughput is predictable, once you’ve understood the rules that DynamoDB works to. Amazon counts mobile media, online advertising and gaming among its star customer applications, with millions of users served. Other possible applications include click stream trackers in general (not just advertising), application user session storage, and intermediate data deduplication.

Conclusion

DynamoDB and Riak have a number of similarities – unsurprisingly perhaps, because they both draw on the principles laid down in Amazon’s earlier database offering, called (simply) Dynamo. Likewise, Memcached and Redis also share some design choices, even if Redis offers the choice of persistency that Memcached (exclusively in-memory) does not. It’s not for nothing that Redis has been described as ‘Memcached on steroids’. However, only analysis of needs and testing will confirm what should ultimately be the choice of a key value data store from these four possibilities.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>