Redis, CouchDB or Cassandra?

nornagon picture nornagon · Jan 18, 2011 · Viewed 28.5k times · Source

What are the strengths and weaknesses of the various NoSQL databases available?

In particular, it seems like Redis is weak when it comes to distributing write load over multiple servers. Is that the case? Is it a big problem? How big does a service have to grow before that could be a significant problem?

Answer

JasonSmith picture JasonSmith · Jan 18, 2011

The strengths and weaknesses of the NoSQL databases (and also SQL databases) is highly dependent on your use case. For very large projects, performance is king; but for brand new projects, or projects where time and money are limited, simplicity and time-to-market are probably the most important. For teaching yourself (broadening your perspective, becoming a better, more valuable programmer), perhaps the most important thing is simple, solid fundamental concepts.

What kind of project do you have in mind?

Some strengths and weaknesses, off the top of my head:

  • Redis
    • Very simple key-value "global variable server"
    • Very simple (some would say "non-existent") query system
    • Easily the fastest in this list
    • Transactions
    • Data set must fit in memory
    • Immature clustering, with unclear future (I'm sure it'll be great, but it's not yet decided.)
  • Cassandra
    • Arguably the most community momentum of the BigTable-like databases
    • Probably the easiest of this list to manage in big/growing clusters
    • Support for map/reduce, good for analytics, data warehousing
    • MUlti-datacenter replication
    • Tunable consistency/availability
    • No single point of failure
    • You must know what queries you will run early in the project, to prepare the data shape and indexes
  • CouchDB
    • Hands-down the best sync (replication) support, supporting master/slave, master/master, and more exotic architectures
    • HTTP protocol, browsers/apps can interact directly with the DB partially or entirely. (Sync is also done over HTTP)
    • After a brief learning curve, pretty sophisticated query system using Javascript and map/reduce
    • Clustered operation (no SPOF, tunable consistency/availability) is currently a significant fork (BigCouch). It will probably merge into Couch but there is no roadmap.
    • Similarly, clustering and multi-datacenter are theoretically possible (the "exotic" thing I mentioned) however you must write all that tooling yourself at this time.
    • Append only file format (both databases and indexes) consumes disk surprisingly quickly, and you must manually run compaction (vacuuming) which makes a full copy of all records in the database. The same is required for each index file. Again, you have to be your own toolsmith.