We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
This idea carries a full system design question on its own. Each walks through the full answer.
System Design Masterclass · Distributed Systems Core
Free preview: the first 2 parts of this 10-part lesson.
Already bought the course? Sign in to read the whole lesson.
this lesson is part of
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design courseread the rest of this lesson in
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design coursein Distributed Systems Core
This lesson is part of the full System Design Masterclass. Unlock it along with 769 other lessons for a one-time payment.
One-time payment by card or PayPal
Get Lifetime AccessOne-time payment: UPI, card or netbanking
Get Lifetime Access18 Foundation lessons are free, no payment needed. Try them now
It is easy and good
“It is really nice and good Please join the course”
In the year 2000, Eric Brewer stood up at the ACM Symposium on Principles of Distributed Computing and made a conjecture that would reshape how every major tech company designs systems. Two years later, Seth Gilbert and Nancy Lynch proved it mathematically.
The conjecture was deceptively simple: a distributed data store cannot simultaneously provide more than two of three guarantees. Consistency, Availability, and Partition Tolerance.
Now, every blog post and interview prep site repeats that sentence. But most of them get the implications wrong. They treat it like a menu where you pick two items. "I'll take consistency and availability, hold the partition tolerance." That's not how it works. Not even close.
Here's the uncomfortable truth: network partitions will happen. Your data center will lose connectivity to another data center. A switch will fail. A cable will get cut. Partitions are not a theoretical concern, they are an operational certainty. So partition tolerance isn't optional. You must pick P. The actual choice is between C and A during a partition.
This lesson goes deep. Not the interview-prep version where you memorize "CP vs AP." The real version, where you understand why Google built Spanner, why Amazon built DynamoDB, and why the CAP theorem is simultaneously the most important and most misunderstood result in distributed systems.
Most explanations of CAP are hand-wavy. Let's be precise about what each property actually means, because the devil is entirely in the definitions.
Consistency (C). Every read receives the most recent write or an error. This is linearizability, the strongest form of consistency. If client A writes value "42" and the write completes successfully, then any subsequent read by any client, on any node, must return "42" or something newer. Not "42 eventually." Not "42 on most nodes." Every read, every node, immediately.
Availability (A). Every request received by a non-failing node must result in a response. Not "a response within 10 seconds." Not "a response from the primary." Every non-failing node must respond. If a node is up and receives a request, it cannot just sit there waiting for another node to come back online. It must respond.
Partition Tolerance (P). The system continues to operate despite an arbitrary number of messages being dropped or delayed between nodes. A network partition splits your cluster into two groups that can't communicate. The system must keep functioning in some capacity.
| Property | Formal Definition | Informal Definition |
|---|---|---|
| Consistency | Linearizability, all nodes see the same data at the same time | "Everyone agrees on the latest value" |
| Availability | Every non-failing node returns a response for every request | "The system always responds" |
| Partition Tolerance | System operates despite network message loss between nodes | "Works even when the network splits" |
Here's the critical insight most people miss: you don't choose between C, A, and P as a permanent architectural decision. You make this choice per operation and during partitions. When the network is healthy, you can have all three. The theorem only constrains you when a partition actually occurs.