DB/Nosql

MongoDB vs Casandra

데먕 2019. 9. 30. 09:31

1. Overview

When it comes to NoSQL databases, MongoDB and Cassandra may seem similar but are quite different. Both have similar use cases but are not intended for transactional data (i.e., accounting systems)

2. Description

2.1 Comparison of Features

Feature MongoDB Cassandra
Development language C++ Java
Storage Type BSON files(Document-based) Column(Wide-columns)
Expressive object model Yes No
Protocol TCP/IP TCP/IP
Secondary Indexes Yes No
Transactions No or Yes(Support for multi-document ACID transactions was added to MongoDB with the General Availability of the 4.0 release) Local
Performance Provides faster query execution performance due to simple schema Provide high scalable and linear performance
Fault tolerance Master-slave model + failover, with no single point of failure High availability without a single point of failure
No downtime on node failure No Yes
Scalability Writing scalability is limited in MongoDB High scalability
Speed Not faster compared to Cassandra in terms of read operations Faster for queries of smaller scripts
Query Speed Reduces network speed while multi-query execution Multi-Query execution capacity
Read/Write capabilities Meets low latency requirements for reading requests, at low throughput Meets low latency requirement for write requests, at low throughput. Not engineered for reading performance
High write throughput No Yes
Sharding Sharding is built-in. But vs Cassandra, MongoDB shards are replications of multiple servers Auto-sharding, with a different effect on its replication. In Cassandra, each shard is a server, with its data replicated across other servers
Querying "Query by example" model. Mongo can execute complex, dynamic queries. but it's not necessarily the best fit for reporting-style workloads or complex transactions Predictable query performance, but being a key/value store it can be a bit more tricky than MongoDB. it allows querying by key or key range
Concurrency Instant update MVCC
Locks Yes Yes
Triggers No Yes
Replication Master-Slave. MongoDB's replication facility, called replica set, provides automatic failover and data redundancy. Replication needs to be set up, but Mongo has clear guidelines to help Multi-Master. Replication with Cassandra is very simple. It mostly takes care of it all for you. Just indicate how many nodes you want your data copied to and it automatically handles the rest.
CAP theorem Consistency, Partition tolerance Partition tolerance, High Availability
Operating System Linux, Mac OS, Windows Linux, Mac OS, Windows
Data storage Disc Disc
Characteristics Retains some SQL properties such as query and index A cross between BigTable and Dynamo. High availability
Hadoop support MongoDB Connector for Hadoop Native Hadoop support, including Hive and Pig
Data Integration Fast and Flexible with different applications and tools such as Big Data Fast and Flexible with different tools
Pricing Open source and depends on the implementation and has different licensed versions too Open source and depends on the implementation
Syntax Requires you learn a new query language CQL is easier to learn alike SQL than MongoDB
Areas of use CMS system, comment storage Banking, finance, logging

 

3. References

https://www.semanticscholar.org/paper/NoSQL-databases%3A-MongoDB-vs-cassandra-Abramova-Bernardino/a6d3ceea74deba7ba762ec051492d79794933e98/figure/1

https://www.upwork.com/hiring/development/mongodb-vs-cassandra/

https://scalegrid.io/blog/cassandra-vs-mongodb/

https://www.educba.com/mongodb-vs-cassandra/