Wednesday, September 7, 2016

MongoDB Vs Cassandra

MongoDB Vs Cassandra
=====================

Cassandra
---------------
 - Wide-column store based on ideas of BigTable and DynamoDB
 - Cassandra has decentralized architecture. Any node can perform any operation. It provides AP(Availability,Partition-Tolerance) from CAP theorem.
 - Cassandra has excellent single-row read performance as long as eventual consistency semantics are sufficient for the use-case.
 - Cassandra does not support Range based row-scans which may be limiting in certain use-cases. Cassandra is well suited for supporting single-row queries, or selecting multiple rows based on a Column-Value index.
 - Aggregations in Cassandra are not supported by the Cassandra nodes - client must provide aggregations.
 - Best used: When you need to store data so huge that it doesn't fit on server, but still want a friendly familiar interface to it.
 - For example: Web analytics, to count hits by hour, by browser, by IP, etc. Transaction logging. Data collection from huge sensor arrays.
 - Real Usages: Twitter
 - Key characteristics:
     * High availability
     * Incremental scalability
     * Eventually consistent
     * Trade-offs between consistency and latency
     * Minimal administration
     * No SPF (Single point of failure) – all nodes are the same in Cassandra
     * AP on CAP
 - Good for:
     * Simple setup, maintenance code
     * Fast random read/write
     * Flexible parsing/wide column requirement
     * No multiple secondary index needed
 - Not good for:
     * Secondary index
     * Relational data
     * Transactional operations (Rollback, Commit)
     * Primary & Financial record
     * Stringent and authorization needed on data
     * Dynamic queries/searching  on column data
     * Low latency

MongoDB
--------------
 - It is a document oriented database.All data in mongodb is treated in JSON/BSON format.
 - It is a schema less database which goes over tera bytes of data in database.
 - It also supports master slave replication methods for making multiple copies of data over servers making the integration of data in certain types of applications easier and faster.
 - MongoDB combines the best of relational databases with the innovations of NoSQL technologies, enabling engineers to build modern applications.
 - MongoDB maintains the most valuable features of relational databases: strong consistency, expressive query language and secondary indexes. As a result, developers can build highly functional applications faster than NoSQL databases.
 - MongoDB provides the data model flexibility, elastic scalability and high performance of NoSQL databases. As a result, engineers can continuously enhance applications, and deliver them at almost unlimited scale on commodity hardware.
 - Full index support for high performance.
 - Best used: If you need dynamic queries. If you prefer to define indexes, not map/reduce functions. If you need good performance on a big DB. If you wanted CouchDB, but your data changes too much, filling up disks.
 - For example: For most things that you would do with MySQL or PostgreSQL, but having predefined columns really holds you back.
 - Real Usages: Craigslist, Foursquare
 - Key characteristics:
     * Schemas to change as applications evolve (Schema-free)
     * Full index support for high performance
     * Replication and failover for high availability
     * Auto Sharding for easy Scalability
     * Rich document based queries for easy readability
     * Master-slave model
     * CP on CAP
 - Good for:
     * RDBMS replacement for web applications
     * Semi-structured content management
     * Real-time analytics and high-speed logging, caching and high scalability
     * Web 2.0, Media, SAAS, Gaming
 - Not good for:
     * Highly transactional system
     * Applications with traditional database requirements such as foreign key constraints.

References:
https://www.linkedin.com/pulse/real-comparison-nosql-databases-hbase-cassandra-mongodb-sahu
https://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis?

No comments:

Post a Comment