DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Migrate, Modernize and Build Java Web Apps on Azure: This live workshop will cover methods to enhance Java application development workflow.

Modern Digital Website Security: Prepare to face any form of malicious web activity and enable your sites to optimally serve your customers.

Kubernetes in the Enterprise: The latest expert insights on scaling, serverless, Kubernetes-powered AI, cluster security, FinOps, and more.

E-Commerce Development Essentials: Considering starting or working on an e-commerce business? Learn how to create a backend that scales.

Related

  • The Ultimate Guide on DB-Generated IDs in JPA Entities
  • Manage Hierarchical Data in MongoDB With Spring
  • Spring Data: Data Auditing Using JaVers and MongoDB
  • The Complete Tutorial on the Top 5 Ways to Query Your Relational Database in JavaScript - Part 2

Trending

  • Amazon EC2 Deep Dive: Optimizing Workloads With Hardware Insights
  • Data Ingestion for Batch/Near Real-Time Analytics
  • Virtual Threads: A Definite Advantage
  • A Comprehensive Guide to Cloud Monitoring Tools: Ensuring Optimal Performance and Security
  1. DZone
  2. Data Engineering
  3. Databases
  4. How to Choose the Right Database Among Cassandra, MongoDB, and MySQL for Your Applications

How to Choose the Right Database Among Cassandra, MongoDB, and MySQL for Your Applications

See how to choose the right database for your applications.

Gazanfur Ali Mohammed user avatar by
Gazanfur Ali Mohammed
·
Apr. 25, 19 · Opinion
Like (12)
Save
Tweet
Share
16.5K Views

Join the DZone community and get the full member experience.

Join For Free

In this article, I compared ACID properties, CAP attributes, and other features among Cassandra, MongoDB, and MySQL databases to help you choose the right database for your applications. Choosing the right database primarily depends on application needs. There are many factors that need to be considered while choosing the database, In this article, I mainly focused on the transactional aspect.

Cassandra: A key-value-store that stores data in a schema-less way.

MongoDB: A document database that expands on the basic idea of key-value-store.

Mysql: A relational database management system.

First, let’s looks at ACID supportability.

What Is ACID?

ACID: A set of properties that guarantees a database transaction is reliable. ACID stands for Atomicity, Consistency, Isolation, and Durability. ACID Properties are an essential part of the database.

Generally, most relational databases support all ACID properties. However, NoSQL databases have various levels of support for ACID. Cassandra and MongoDB are NoSQL databases whereas MySQL is a SQL database.

Database DB Type Atomicity Consistency Isolation Durability
Cassandra NoSQL Write operations are atomic at the partition level Eventual /Tunable Row Level Writes are durable
MongoDB NoSQL Supports single document atomicity Support Adjustable Supports multiple durability options
MySQL SQL InnoDB Storage Engine support transaction atomicity InnoDB uses a file flush technique called doublewrite Offers different levels of isolation Can be tuned using configurable parameters

What Is the CAP Theorem?

A theorem that describes how the laws of physics dictate that a distributed system MUST make a tradeoff among desirable characteristics.CAP stands for Consistency, Availability, and Partition tolerance.

Generally, most databases support two CAP attributes.

Image title

Some databases make an effort to support all three, but they still prioritize them in a certain way. For example, Cassandra provides high availability and partition tolerance, and it also supports consistency using eventual consistency. If you are looking for high availability and consistency, then MySQL could be the right choice. MongoDB supports Partition Tolerance and Consistency. MongoDB also supports availability to some extent.

Finally, Let’s compare other attributes

Properties Cassandra MongoDB MySQL
Transaction Rollback No Yes Yes
Faster Writes Yes Yes No
Locking Mechanism No Yes Yes
Table Joins No No Yes
Master Less Architecture Yes No No

Conclusion

The important thing is to understand the needs of your application. Then, check which database is closely matching to your requirements. Sometimes, you may not be able to find a comprehensive database that can support all your requirements. In that case, you may have to trade off something to fulfill your top priorities.

Database Relational database MySQL MongoDB application

Opinions expressed by DZone contributors are their own.

Related

  • The Ultimate Guide on DB-Generated IDs in JPA Entities
  • Manage Hierarchical Data in MongoDB With Spring
  • Spring Data: Data Auditing Using JaVers and MongoDB
  • The Complete Tutorial on the Top 5 Ways to Query Your Relational Database in JavaScript - Part 2

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: