We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
4 system design questions lean on this idea. Each walks through the full answer.
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
It is easy and good
“It is really nice and good Please join the course”
Serializability guarantees that concurrent transactions produce the same result as some serial execution. Even though they run concurrently, the outcome is as if they ran one after another. Every concurrency anomaly, dirty reads, phantoms, write skew, is prevented.
The cost is performance. Achieving serializability requires pessimistic locking (2PL), optimistic validation (SSI), or deterministic execution (Calvin). Each trades for correctness.
Most applications do not need full serializability. Snapshot isolation handles the majority of workloads. But for financial systems and strict inventory limits, serializability is the right choice.
Two-Phase Locking (2PL), transactions acquire shared locks for reads and exclusive locks for writes. A transaction holds all locks until it commits. Guarantees serializability but reduces concurrency because transactions block each other.
Serializable Snapshot Isolation (SSI), runs transactions under snapshot isolation but tracks read-write dependencies. If a conflict is detected at commit time, one transaction is aborted. PostgreSQL and CockroachDB use this.
Deterministic execution (Calvin), order all transactions first, then execute them in that order across all replicas. No coordination needed during execution because the order is predetermined.
| Approach | Concurrency | Abort Rate | Used By |
|---|---|---|---|
| 2PL | Low (blocking) | Low | MySQL InnoDB |
| SSI | High (optimistic) | Higher under contention | PostgreSQL, CockroachDB |
| Calvin | High (predetermined) | None | FaunaDB |