PACELC Theorem

Background

In a distributed system, we cannot avoid partition. So as per the CAP theorem, the system should choose between consistency or availability.

So ACID databases (such as RDBMSs like MySQL, Oracle) would choose consistency & consequently refuse to respond if they cannot connect with node/peers who are part of the system.

On the other hand, BASE (such as MongoDB, Cassandra) databases choose availability & respond with local data without ensuring it is the latest with its nodes/peers.

But what happens when there is no partition? CAP theorem doesn’t state anything about it.

PACELC builds on the CAP theorem. Both theorems describe how distributed databases have limitations and tradeoffs regarding consistency, availability, and partition tolerance.

PACELC theorem states that:

if Partition then Availability or Consistency Else + Latency or Consistency

In a distributed system where data is replicated -

if there is a partition then the system can trade-off between consistency & availability.

else there is no partition then the system can trade-off between latency & consistency

The first part of theorem i.e. PAC is same as CAP and ELC is extension

Examples

  • Dynamo and Cassandra are PA/EL systems: They choose availability over consistency when a partition occurs; otherwise, they choose lower latency.
  • BigTable and HBase are PC/EC systems: They will always choose consistency, giving up availability and lower latency.
  • MongoDB can be considered PA/EC: MongoDB works in a primary/secondary configuration. In the default configuration, all writes and reads are performed on the primary. As all replication is done asynchronously (from primary to secondaries) when there is a network partition in which primary is lost or becomes isolated on the minority side, there is a chance of losing data that is unreplicated to secondaries, hence there is a loss of consistency during partitions. Therefore it can be concluded that in the case of a network partition, MongoDB chooses availability, but otherwise guarantees consistency. Alternately, when MongoDB is configured to write on majority replicas and read from the primary, it could be categorized as PC/EC.

Keywords & References :

ACID — Atomicity + Consistency +Isolation +Durability

BASE — Basically Available + Soft State +Eventual Consistency

Further reading - https://en.wikipedia.org/wiki/PACELC_theorem

--

--

--

Tech Enthusiast, fascinated by the power of internet. exCTO @HalaPlayDotCom, exTech-Lead @MoEngage.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

$25K Instagram Almost XSS Filter Link — Facebook Bug Bounty

Why We Invested in ArGo

How to setup a Mail server on Mailgems

Mailgems Dashboard Screenshot

You’re reading this for one of a few reasons.

What the hell is a Bloom Filter?

My first Web Page (HTML + C

Python web scraping tutorial — Getting a website’s title.

Streaming system tutorial with Flink and Kafka

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Shubhanshu Singh

Shubhanshu Singh

Tech Enthusiast, fascinated by the power of internet. exCTO @HalaPlayDotCom, exTech-Lead @MoEngage.

More from Medium

Low-Level Data Design Part 4: Stream Processing

Building robust distributed systems

An overview of Google File System (GFS)

System Design 2.0