NoSQL - CouchDB and MongoDB
- ali@fuzzywireless.com
- Mar 4, 2022
- 3 min read
Big data is the primary driver behind NoSQL databases, which require storage of large volume with little or no structure, rapid development cycles, highly scalable and fault tolerant systems (MongoDB, 2018). In several read-only applications and storages that do not often change, like historical archives, NoSQL databases fits very well. Other examples are like write-intensive use cases where database is needed to capture logs, which are usually read at a later time. Eventual consistency is implemented in different way by databases. The performance gain is realized by NoSQL databases based on BASE (basically available, soft-state, eventually consistent) due to compromise on consistency but offer highly available and partition tolerant system. On the other hand, traditional relational database management systems based on ACID (atomicity, consistency, isolation, durability) are slowed down due to locks and semaphores, especially in large scale web like applications (2018). NoSQL databases utilize volatile memory from highly scalable architecture to serve the data to enhance the querying speed and reduce latency versus non-volatile memory (hard drive) used by some traditional RDBMS systems (Kabakus, A. & Kara, R., 2017).
CouchDB
CouchDB store document data in open-source JSON (JavaScript Object Notation) format, offers RESTful (Representational State transfer) application interface for editing, deleting, adding and reading database documents. Database document consists of fields, which can be numbers, text, Boolean, lists etc. and attachments. CouchdB utilize views, which are similar to indexes in SQL for filtering, retrieving, ordering, and representing relationship between documents. CouchDB utilize MapReduce to create key-value pairs after looking into all documents. Command line tool and library (CURL) can be used to query database using Hyper Text Transfer Protocol (HTTP). CouchDB supports both master-master and master-slave replication to allow low latency access regardless of location. With regards to CAP (Consistency, Availability and Partition tolerance) theorem, CouchDB favors availability and partition tolerance (Gorst, 2014).
CouchDB offers mobile platform support for Android and Apple iOS devices and is currently used by Akamai Technologies, Talend SA, Hothead Games Inc, GenCorp Technologies.
MongoDB
MongoDB offers open-source schema-free document storage database in BSON (Binary JSON) format with no predefined structure and columns can vary based on specific document in the collection. Indexes are preferred in MongoDB to speed up the read time. Syntax of MongoDB is similar to SQL, which makes it easier to learn for traditional SQL users. MongoDB offers single-master replication with auto-election support in case of database unavailability. With regards to CAP theorem, MongoDB favors consistency and partition tolerance (Gorst, 2014). MongoDB offers multiple replication, where each replica set can contain two or more copies of data which can be used in the event of failure (Kumar, Srividya, Mohanavalli, 2017). All read and write functions are performed on the master database. MongoDB utilize grid file system, which divide file into parts and stores separately; aggregation is performed by MapReduce similar to group by clause in SQL (2017).
MongoDB does not support mobile platform. It is actively used by Forbes, Under Armor, CERN Adobe, Department of Veteran Affairs.
References
Kumar, K., Srividya, Mohanavalli, S. (2017). A performance comparison of document oriented NoSQL database. 2017 International Conference on Computer, Communication and Signal Processing.
MongoDB, 2018. NoSQL databases explained. Retrieved from https://www.mongodb.com/nosql-explained
Kabakus, A. & Kara, R., 2017. A performance evaluation of in-memory databases. 2017 Journal of King Saud University – Computer and Information Sciences. 520-525
Gorst, D. (2014). MongoDB vs CouchDB. Retrieved from https://blog.scottlogic.com/2014/08/04/mongodb-vs-couchdb.html
Sarig, M. (2017). CouchDB vs MongoDB. Retrieved from https://blog.panoply.io/couchdb-vs-mongodb
コメント