Intermediate → Advanced20 min read· Topic 6.5

Consistency patterns

Linearizability, sequential consistency, causal consistency, eventual consistency

🔒Key Takeaways

  • 1
    Linearizability: strongest — operations appear instantaneous and globally ordered (as if single copy)
  • 2
    Sequential consistency: operations appear in some consistent total order respecting per-process order
  • 3
    Causal consistency: causally related operations are ordered; concurrent operations may appear in any order
  • 4
    Eventual consistency: weakest but fastest — all replicas converge given sufficient time and no new updates

The Consistency Spectrum

Consistency models define what guarantees a distributed system provides about the order and visibility of operations. Stronger consistency = easier to program against but slower and less available. Weaker consistency = faster but requires application-level handling of anomalies.

Consistency Models Ranked

ModelGuaranteeLatencyExample Systems
LinearizableReads always return latest write globallyHighest (requires coordination)Spanner, CockroachDB, ZooKeeper
SequentialAll processes see same order of operationsHighZooKeeper (for writes)
CausalCause → effect ordering is preservedMediumMongoDB (causal sessions)
Read-your-writesYou always see your own writesMediumMost web apps (session-based)
EventualReplicas converge eventuallyLowestDynamoDB, Cassandra, DNS
Practical Advice
Most applications need linearizability only for critical operations (payments, inventory) and can use eventual consistency for everything else (user profiles, activity feeds, analytics). Design per-operation, not per-system.

Advantages

  • Strong models simplify application logic
  • Weak models enable highest performance
  • Per-operation consistency lets you optimize intelligently

Disadvantages

  • Strong consistency always costs latency
  • Eventual consistency creates anomalies developers must handle
  • Choosing the wrong model causes either performance or correctness issues

🧪 Test Your Understanding

Knowledge Check1/1

Which consistency model is 'cheapest' (lowest latency)?