Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

nosql - Redis, CouchDB or Cassandra?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...