Problem
Replicated and concurrent systems can return stale, reordered, or conflicting values. Without a named contract, clients cannot know which anomalies to expect or defend against.
Also known as: consistency-models, consistency-spectrum
Define the contract between a replicated data store and its clients about which values reads may return and in what order.
Replicated and concurrent systems can return stale, reordered, or conflicting values. Without a named contract, clients cannot know which anomalies to expect or defend against.
A consistency model is a promise about what reads can return given the history of writes. It is the interface between the storage system and the programmer: the stronger the promise, the simpler the application code and the more coordination the system must do.
Each step down the ladder removes a guarantee clients could otherwise rely on, but it also removes coordination that slows writes and blocks during failures. Knowing exactly which guarantee you hold is what lets you design correct clients.
Models form a rough hierarchy from strongest to weakest.
linearizable real-time order, single copy illusion
sequential one global order, respects per-process order
causal cause precedes effect everywhere
session read-your-writes, monotonic reads
eventual replicas converge if writes stop
Spanner offers external consistency using synchronized clocks and consensus; Dynamo-style systems offer eventual consistency with tunable quorums. Clients written against a weaker model run safely on stronger ones, but not the reverse. Tools such as Jepsen test real systems against their claimed model.
None: conceptual
Low: documentation
Medium: subtle semantics
Assuming linearizability when the store provides only eventual consistency
Confusing isolation levels with replica consistency
Relying on vendor labels instead of tested behavior