We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
System Design Masterclass · Consistency Models
Free preview: the first 2 parts of this 8-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 Consistency Models
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
Linearizability guarantees two things: (1) every read returns the most recent write, and (2) every operation appears to take effect at a single instant between its invocation and completion.
This is what clients intuitively expect from a correct system. When you write a value and read it, you see what you wrote. When two people check a seat reservation simultaneously, at most one succeeds.
The cost is coordination. Every write needs majority acknowledgment. Every read must check the latest committed value. Across data centers with 100ms round-trip, that is 100-200ms per operation. Google Spanner achieves global linearizability using TrueTime atomic clocks, custom hardware in every data center.
Understanding when you actually need linearizability versus when a weaker model suffices is one of the most impactful architectural decisions in distributed systems.
Read, must return the value of the most recently completed write. Not the value on the local replica. Not a cached value. The latest globally committed value.
Write, must be visible to all subsequent reads by any client on any node. Once the write returns success, it is durably committed and visible.
Compare-and-swap (CAS), atomically check a value and modify it if it matches. Essential for distributed locks and leader election.
| Operation | Requirement | Cost |
|---|---|---|
| Linearizable read | Contact majority or leader | ~1 RTT |
| Linearizable write | Majority acknowledgment | ~1 RTT |
| Linearizable CAS | Leader-coordinated | ~1-2 RTT |
etcd provides linearizable reads and writes. By default, reads go through the Raft leader to ensure freshness. You can opt for serializable reads (from any node, might be stale) for lower .
Google Spanner provides global linearizability using TrueTime. Each operation is assigned a timestamp with bounded uncertainty. The system waits for uncertainty to resolve before committing, ensuring correct global ordering.
It is easy and good
“It is really nice and good Please join the course”