CMD Guide
HomeSystem DesignMental Models & Systems Thinking

The Consistency Spectrum — Linearizable to Eventual (CAP/PACELC lens)

Consistency isn't yes/no — it's a dial

People say a system is "consistent" or "not," but consistency is a spectrum of guarantees, each trading correctness for coordination cost, latency, and availability. Knowing where on the dial your data needs to sit — per use case, not per system — is a core systems-design judgment.

A spectrum from Linearizable (strong, high coordination, CP) through Sequential and Causal to Eventual (weak, high availability, AP), with example use cases
A spectrum from Linearizable (strong, high coordination, CP) through Sequential and Causal to Eventual (weak, high availability, AP), with example use cases

The levels, strongest to weakest

CAP / PACELC as the lens

CAP: during a network partition, you must choose Consistency or Availability — not both. PACELC adds the everyday case: else (no partition), you still trade Latency vs Consistency.

So the design question is: "for this data, what's the cost of a stale or out-of-order read?" A wrong bank balance is unacceptable (linearizable); a like count off by 3 for a second is fine (eventual). The replication-lag anomalies (read-your-writes, monotonic reads) are exactly what weak consistency feels like — and the fixes (session pinning) are how you buy back just enough.

Concrete timeline: a stale read and how session guarantees repair it

Imagine a Twitter-like service with a leader in region A and a follower in region B. Replication lag is 200 ms.

TimeUser actionWhat the system doesWhat the user sees
t=0Alice posts "hello" from region AWrite goes to the leader in A
t=50 msAlice switches to region B and refreshes her feedRead is served by the follower in B, which has not yet received the postAlice's own post is missing
t=200 msAlice refreshes againFollower has now caught upPost appears

This is a read-your-writes anomaly under eventual consistency. Alice wrote the post; one refresh later she cannot see it. The fix is a session guarantee: for a short window after Alice's write, route her own reads to the leader (or to a follower that has already applied her write). The cost is slightly higher read latency for Alice's own requests and a tighter coupling between the write path and the read path; the win is that everyone else's reads can still be served from the cheap follower (DDIA ch. 9).

Buy back just enough consistency — per key, not per system

You rarely need one consistency level for a whole system. Real stores let you dial it per request or per key: DynamoDB defaults to eventually-consistent reads but exposes a ConsistentRead flag to force a strong read on the few paths that need it; Spanner offers bounded-staleness reads ("no older than 10 s") that serve from a nearby replica while capping how stale the answer can be. Reach for these before making every read linearizable.

One distinction to state explicitly under a hostile panel: ACID on a primary is not the same as CAP's "C" across replicas. A single node can be perfectly ACID and still serve non-linearizable reads from its async followers — CAP consistency is linearizability of the distributed object, not the local transaction's isolation level.

Takeaways


Re-authored for this guide; spectrum diagram hand-authored as SVG. Follows DDIA ch. 9, Abadi's PACELC, and Jepsen's consistency hierarchy. See also: CAP Theorem, PACELC, Replication Lag & Failover, Quorum.

🤖 Don't fully get this? Learn it with Claude

Stuck on The Consistency Spectrum — Linearizable to Eventual (CAP/PACELC lens)? Open Claude, copy a block below, and it'll teach you this exact concept — visually and interactively.

🎨 Explain it visually

Build the mental picture, not memorization.

I just read a lesson on **The Consistency Spectrum — Linearizable to Eventual (CAP/PACELC lens)** (System Design) and want to truly understand it. Explain The Consistency Spectrum — Linearizable to Eventual (CAP/PACELC lens) from first principles using ONE vivid real-world analogy and a visual mental model — draw it as ASCII art or a clear step-by-step diagram — with a concrete example using real numbers. Then ask me one question to check I got the mental picture, and wait for my reply. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🤔 Walk me through it (interactive)

Socratic — adapts to where you're stuck.

Teach me **The Consistency Spectrum — Linearizable to Eventual (CAP/PACELC lens)** interactively. Ask me ONE guiding question at a time, wait for my answer, and adapt to my confusion — build the idea with me step by step instead of explaining it all at once. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🧪 Quiz me & fix my gaps

Active recall exposes what you missed.

Quiz me on **The Consistency Spectrum — Linearizable to Eventual (CAP/PACELC lens)** with 5 questions, easy to tricky, ONE at a time. Tell me if each answer is right; at the end, explain clearly what I got wrong and why. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🧠 Make it stick

Intuition + hook + flashcards for long-term memory.

Help me remember **The Consistency Spectrum — Linearizable to Eventual (CAP/PACELC lens)** for the long term: give the one-sentence intuition, a memorable hook/mnemonic, a tiny worked example, and 3 active-recall flashcards (Q -> A). If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.

📝 My notes