Monday, November 08, 2010

Summary on MongoDB, CouchDB and Redis

A few days ago I've read up on MongoDB, CouchDB and Redis just to get the idea and understand the difference between them. Here is my summary:

MongoDB – a great, very fast and scalable document-oriented storage written in C++. Queries are similar to SQL queries, grouping and aggregation are supported by MapReduce functions written in JavaScript. It supports atomic in-place updates, which means that revisions of documents are not stored. MongoDB provides native drivers for different languages that use a special protocol over TCP/IP. MongoDB uses BSON (binary JSON) to store the data. It doesn't support transactions and it's recommended to have at least two servers to unsure durability (however, the v1.8 release will have single server durability.) MongoDB handles horizontal scalability via auto-sharding across multiple nodes. The only thing is that it's recommended to have a replica of each node for failover. In my opinion, MongoDB is a great replacement for relational databases, except for the cases where transactions are essential.

CouchDB – a similar to MongoDB document-oriented storage written in Erlang, but according to some tests is a bit slower, probably due to using JSON to store the data (MongoDB uses BSON), and because all requests go throw HTTP. CouchDB works according to the non-in-place updates model – it always stores all revisions of documents. CouchDB doesn't support traditional dynamic queries, all queries must be prepared as views using MapReduce in JavaScript. The good thing about this is that the results of all views are precomputed and are automatically updated in case of any changes in the data with logarithmic complexity. CouchDB can store JavaScript functions, which can be called in queries. All this makes it possible to work with the database directly from a frontend (for example web interface) using HTTP without implementing a backend, which is probably a very nice feature for some use cases. It supports horizontal scaling using the Master-Master model and doesn't require a double-server setup for durability.

Redis – an in-memory key-value storage (the values can be lists, sets, sorted sets and hashes) written in ANSI C. Redis supports the ability to save the data to a disk from time to time. A good easily scalable replacement for memcached with comparable performance and advanced features. Interesting, that some tests showed that MongoDB can even beat Redis in terms of performance. And the authors of MongoDB say that normally you wouldn't need an additional in-memory cache when using MongoDB :)

I'm looking forward to trying MongoDB in some application :)


Unknown said...

Надо же я тоже на днях писал про Монго :) Если интересно можно чтонть придумать.

yvolk said...

Looks like people coming here wait for the new stories about Australia, in Russian ;-)
Me also :-)
...Oh, and of course, they wait for the stories about _you_ in Australia.

Anton said...

Thanks for your interest! I'll think about writing something new :)

labhrasjabien said...

Slot Game: RTP and Variance at Casinos - JTHub
Slot Game: RTP and Variance at Casinos If you think you can beat the house 대구광역 출장안마 and win at 정읍 출장샵 slots like RTPs then 계룡 출장마사지 here's what the game 포항 출장샵 is 구리 출장샵

Post a Comment