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
It is easy and good
“It is really nice and good Please join the course”
Alice posts "I got the job!" Bob replies "Congratulations!" Carol sees the reply but not the original post. That makes no sense, the reply references something Carol has not seen yet.
Causal consistency prevents this. If event B was caused by event A, anyone who sees B also sees A. The causal relationship is tracked (often with vector clocks) and the system ensures causally related events are observed in order.
Causal sits between eventual (too weak) and sequential (too strong). It is the sweet spot for many applications.
Causal consistency requires tracking which events depend on which. The common mechanisms:
Vector clocks, each node maintains a vector of logical timestamps. Events are causally ordered by comparing vectors.
Dependency tracking, each write carries metadata about which writes it depends on. A node only makes a write visible once all its dependencies are visible.
Explicit causal chains, application-level tracking. A reply carries the ID of the post it replies to. The system ensures the post is visible before the reply.
| Mechanism | Overhead | Precision | Used By |
|---|---|---|---|
| Vector clocks | O(N) per event | Exact | Riak, academic systems |
| Dependency metadata | Per-write metadata | Exact | COPS |
| Explicit chains | Application logic | Domain-specific | Most web apps |