How Consistent Is 'Consistent' Enough? A Practical Guide to Distributed Consistency Levels
This article explains why CAP theorem is insufficient for architecture decisions, critiques eventual consistency's vagueness, defines four session-based consistency models, details linearizability as the gold standard, and provides a decision chain for selecting consistency levels based on business needs and cost.
Step 1: Drop the Habit of Using CAP for Architecture Selection
Many believe CAP offers three combinations (CA, CP, AP), but this is a misconception. CAP actually states that during a network partition (P), you must choose between consistency (C) and availability (A) — P is unavoidable. Moreover, CAP's "C" refers specifically to linearizability, a very strong consistency level. In reality, there is a wide spectrum of consistency models between strong and eventual consistency. CAP oversimplifies dozens of models into a single "C", making it unsuitable for real architectural decisions.
Step 2: The Overhyped "Eventual Consistency" Is Less Useful Than You Think
Message queues and async architectures often claim "eventual consistency." To understand it, first define visibility: a write on node A becomes visible on node B after some time. "Consistent" means the write is visible on all nodes. "Eventual" borrows the mathematical limit at infinity: as time goes to infinity, the number of unsynced nodes approaches zero. However, "eventual" provides no concrete time bound — seconds? minutes? Without a defined deadline, this promise offers little guidance for production troubleshooting. Like CAP, it is too vague.
Step 3: Four Session-Based Consistency Levels That Are Practical
These four models are peer-level (no strict hierarchy) and revolve around a session — the user's unique identifier (a client-side concept). In disaster recovery, a user's requests may hit different nodes; the goal is to make it appear as if all requests were processed on a single node.
Monotonic Write Consistency : All nodes observe writes in the exact order they were issued.
Monotonic Read Consistency : A newer read operation must never return an older value. Once a value is read, subsequent reads return the same or a newer value.
Read Your Write Consistency : A client can read back every value it has previously written; none are lost.
Write Follows Read Consistency : This governs cross-session behavior. If you read a value written by another session, your subsequent write must be ordered after that write.
For typical single-session correctness, the trio of monotonic read, monotonic write, and read-your-write suffices. For cross-session correctness, add write-follows-read.
Step 4: The Most Critical Level in Distributed Systems — Linearizability
If you remember only one term, make it linearizability. It can be understood as "serializability in a distributed environment." Its verification follows a three-step reasoning process:
Adjust the timeline : Each operation has a start and end time. Adjust these times so that all concurrent operations become non-overlapping, appearing to execute sequentially.
Preserve original order : Operations that did not overlap in real time must keep their original relative order.
Validate against business logic : After reordering, verify the outcome matches business rules (e.g., money transfers, stack push/pop order). If no valid ordering exists, the system is not linearizable.
Above linearizability lies strict serializability — the combination of single-node serializability and distributed linearizability. It is the strongest guarantee but impractical due to performance costs.
Decision Chain: How to Choose the Right Level
Don't chase extreme consistency; select based on business requirements and economic cost. The decision chain:
Single-node? → Prefer snapshot isolation; serializability rarely needed.
Multi-node? → First address disaster recovery:
Low correctness requirement after DR → Use session guarantees: monotonic read + monotonic write + read-your-write for single session; add write-follows-read for multi-session.
High correctness requirement after DR → Adopt linearizability.
If sharding is needed → First ensure each shard's DR cluster provides linearizability (so each cluster behaves like a single node), then use TCC or 2PL for distributed transactions across shards.
In short: linearizability first makes a DR cluster appear as a single node; only then can distributed transactions be correct.
Conclusion: Consistency Is a Precise Knob, Not Mysticism
CAP and eventual consistency are "introductory toys"; session guarantees are "daily tools"; linearizability is the "load-bearing wall." Next time someone hides behind "we're eventually consistent," ask: "Eventual by when? Do you guarantee session consistency? Do you need linearizability?" Answering these three questions puts you ahead of most architects.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
