Consistency Models
Navigating absolute linearizability, casual ordering, session-guarantees, and eventual consistency boundaries.
What you'll learn
- Linearizability (Strong Consistency)
- Sequential Consistency
- Causal Consistency
- Read-Your-Writes (Session Consistency)
- Monotonic Reads
- Eventual Consistency
TL;DR
Navigating absolute linearizability, casual ordering, session-guarantees, and eventual consistency boundaries.
Visual System Topology
Consistency Models Execution Topology
Concept Overview
Consistency models define the guarantees a distributed system makes about the ordering and visibility of read and write operations across replicas. They form a spectrum from the strongest (linearizability) to the weakest (eventual consistency), with each level trading correctness guarantees for performance and availability.
Understanding consistency models is critical because the correct choice fundamentally changes your database selection, application code (conflict resolution logic), and user experience. Most distributed databases expose multiple consistency levels, letting you tune per-operation.
The models from strongest to weakest: Linearizability → Sequential Consistency → Causal Consistency → Read-Your-Writes (Session Consistency) → Monotonic Reads → Eventual Consistency.
Key Architectural Pillars
Linearizability (Strong Consistency)
The strictest model. Every operation appears to execute atomically at a single point in time, and all operations are globally ordered. Any read returns the most recent write, regardless of which replica is queried. Requires coordination between replicas on every operation.
Sequential Consistency
All operations appear to execute in some sequential order consistent with each process's program order. Slightly weaker than linearizability: there may not be a single real-time global order, but within each process, operations appear ordered.
Causal Consistency
Operations that are causally related must be seen by all processes in the same causal order. Concurrent (causally unrelated) operations may be seen in different orders by different processes. Much more practical than linearizability for geo-distributed systems.
Read-Your-Writes (Session Consistency)
A client always sees its own writes reflected in subsequent reads, even if the write hasn't propagated to all replicas yet. Critical for basic usability: after a user changes their profile, they should immediately see the change.
Monotonic Reads
If a client has seen a value at time T, it will never see an older value in subsequent reads. Reads may be stale but they don't go backward in time.
Eventual Consistency
The weakest model. If no new writes occur, all replicas will eventually converge to the same value. No guarantee on when convergence happens or what order reads reflect. Provides maximum availability and lowest latency.
