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
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

How are you handling the data revolution? We want your take on what's real, what's hype, and what's next in the world of data engineering.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

SBOMs are essential to circumventing software supply chain attacks, and they provide visibility into various software components.

Related

  • Architecture and Code Design, Pt. 1: Relational Persistence Insights to Use Today and On the Upcoming Years
  • What Are SpeedUp and ScaleUp in DBMS?
  • Non-blocking Database Migrations
  • Kafka Connect: Strategies To Handle Updates and Deletes

Trending

  • CORS Misconfigurations: The Simple API Header That Took Down Our Frontend
  • Self-Supervised Learning Techniques
  • Kubernetes Admission Controllers: Your First Line of Defense
  • How Predictive Analytics Became a Key Enabler for the Future of QA
  1. DZone
  2. Data Engineering
  3. Databases
  4. Better explaining the CAP Theorem

Better explaining the CAP Theorem

By 
Lior Messinger user avatar
Lior Messinger
·
Feb. 17, 13 · Interview
Likes (18)
Comment
Save
Tweet
Share
138.1K Views

Join the DZone community and get the full member experience.

Join For Free

today, i thought a lot about how to examine different databases. choosing a database is often a daunting task. there's a lot of confusion, a 'theorem', and more than all, the immortal proverb 'not one size fits all'. as if it helps.

one of the first things that you realize, when examining nosql distributed databases (and how could you not)is that these days databases are like cars: they're all good. old fashioned sql databases can scale in and out, horizontally sharded over several machines to achieve high availability. nosql systems claim to be consistent. what difference then does it make what database would you choose?
the availability and consistency that i mentioned comes, of course, from the misunderstood cap theorem , that - so people say - states that you can only choose 2 out of the 3
  • consistency: every read would get you the most recent write
  • availability: every node (if not failed) always executes queries
  • partition-tolerance: even if the connections between nodes are down, the other two (a & c) promises, are kept.
usually its depicted in a nicely equilaterl triangle, as this one from ofirm :

there's a nice proof and explanation of it in this 4 minute video here . but if we think about it, and also see some of brewer's (the theorem author) later remarks , we'll see that the 2 out of 3 is really 1 out of 2:

it's really just a vs c!

and this is simply because:
  1. availability is achieved by replicating the data across different machines
  2. consistency is achieved by updating several nodes before allowing further reads
  3. total partitioning, meaning failure of part of the system is rare. however, we could look at a delay, a latency, of the update between nodes, as a temporary partitioning . it will then cause a temporary decision between a and c:
    1. on systems that allow reads before updating all the nodes, we will get high availability
    2. on systems that lock all the nodes before allowing reads, we will get consistency
that's it! and since this decision is temporary, it exists only for the duration of the delay, some may say that we are really contrasting latency (another word for availability) against consistency.

by the way, there's no distributed system that wants to live with "paritioning" - if it does, it's not distributed. that is why putting sql in this triangle may lead to confusion.

Database Theorem IT Machine sql NoSQL Data (computing) Task (computing) Lock (computer science)

Opinions expressed by DZone contributors are their own.

Related

  • Architecture and Code Design, Pt. 1: Relational Persistence Insights to Use Today and On the Upcoming Years
  • What Are SpeedUp and ScaleUp in DBMS?
  • Non-blocking Database Migrations
  • Kafka Connect: Strategies To Handle Updates and Deletes

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • 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
  • [email protected]

Let's be friends: