When should you choose MongoDb, CouchDB or RavenDB?
Ideally, these three NoSQL document stores could be clearly positioned so that any user need would fall neatly into one of the three domains. But hey, this is real life. MongoDB, CouchDB and RavenDB have their strengths and weaknesses, but they also overlap in some situations. One reason for this is the functionality and features they share. Licensing is all Open Source. Each one is schema-free. None of them have SQL functionality or foreign keys for improved data consistency, although they all support secondary indexes for faster searching, as well as MapReduce. They also all support concurrency, durability (data persistency) and sharding.
The differences start with:
- Data typing and triggers (automatic procedures to be invoked automatically after certain database operations). MongoDB supports data typing, but not triggers. For CouchDB and RavenDB, it’s the exact opposite.
- Consistency and data replications. Couch DB and RavenDB offering eventual consistency and master-master replication, while MongoDB gives users the additional choice of immediate consistency with (logically) master-slave replication instead of master-master.
- Platforms and programming languages supported. Whereas CouchDB and MongoDB each support a variety of ‘major players’, RavenDB only works on MS Windows because it is based on .NET (and supports only the .NET programming language).
When should you choose MongoDB?
In absolute terms, MongoDB supports high write loads with possible sacrifices of transaction safety. It also provides instant and automatic recovery from node or even data center failure. The document store is architected to scale easily (its name comes from ‘Humongous’). It is well suited to location-based data needs with spatial functions for rapidly and accurately finding data from specific locations. While not being full SQL, it has Query and Index functions that let users do many of the things that SQL databases. Yet is does not impose the limitation of predefined schema. User feedback indicates that MongoDB may provide higher performance than RavenDB, both in terms of document inserts into the database and document deletion.
When should you choose CouchDB?
CouchDB scores highly for applications in which data is accumulated without any sizable requirements for modification. The 10 PB of data (1 PB is one US billion gigabytes) of data to be collected annually in the ‘Compact Muon Solenoid’ experiment at CERN, the European Organization for Nuclear Research, is one example of a choice made to use CouchDB. Its ‘views’ functionality then allows users to query a large amount of data rapidly. CouchDB also interfaces easily to other systems, such as Oracle databases. A further advantage of CouchDB is in its features for deployment on mobile computing devices. The data store runs on Android, as well as BSD, Linux, OS X, Solaris and Windows. Written in Erlang, CouchDB adapts well to different sizes of computing device. It also allows users to work offline and to sync up their version of the database again when the next network connection is made.
When should you choose RavenDB?
First of all, you’ll need to run Windows and .NET. If you meet those conditions, RavenDB then offers relatively carefree data creation, retrieval, update and deletion (CRUD) operations. This makes it eminently suited to OLTP applications. RavenDB can also be used in conjunction with other database applications, possibly as a front-end tool for rapidly viewing critical data pages or as the OLTP part of an OLTP/OLAP duo. Programmers appreciate RavenDB for the way its design makes their work easier and more foolproof. In particular, the data store fits well with test-driven development (TDD) environments, with features to prevent developers from trying to implement functions with any significant performance or usability penalties. As one developer put it, “it feels like the database is trying to help me, not trying to stop me.”
Operating system platforms aside, the three document stores can to some extent be interchanged in usage. Thus, MongoDB is used by Craigslist for storing over 2 billion documents, Credit Suisse uses CouchDB for internal online/offline commodity trading use, and MSNBC uses RavenDB for its ease of development and high performance. However, MongoDB was also chosen by CERN for its Large Hadron Collider data aggregation. CouchDB is used by the BBC (British Broadcasting Corporation) for its dynamic content platforms. And RavenDB is used by financial powerhouse Nomura for investment and financial services. As ever, analyze and test where possible before making any definitive deployment choices!