Notesdistributed🌱 seedling

Consistency Model

Also: Consistency Guarantee · Data Consistency Model · Consistency Level

The contract that says which results a read may return while replicas disagree. It's a safety property over histories (who issued what, and what they got back), so it can be tested by recording a history and checking it.

Also in: Consistency Models › The ladder of models

Why it exists

Replicated data is always briefly inconsistent: writes are in flight, replicas lag, partitions cut regions off. Programmers need to know what they can rely on during that window. "Strongly consistent" is not a spec; a named model is.

How it works

Models nest: each allows every history the stronger one allows, and more.

Trade-offs

Stronger model Weaker model
fewer anomalies, simpler application code more anomalies to design around
coordination on every request (latency) answers locally
stops during a partition stays available

In practice

  • Many stores let you pick per request: DynamoDB strongly vs eventually consistent reads, Cassandra consistency levels, MongoDB read and write concerns, etcd's serializable flag.
  • Single-object models are distinct from transaction Isolation Levels; strict serializability combines linearizability with serializability.

Pitfalls

  • Trusting vendor labels. Jepsen has found many stores violating their own documented models.
  • Forgetting that the model only covers what goes through the store: side channels (queues, phone calls) create causality it can't see.

Recall

These cards are also in your review deck, scheduled with spaced repetition.