Consistency Models in Distributed Systems

Graduate Depth 66 in the knowledge graph I know this Set as goal
Unlocks 23 downstream topics
consistency correctness models

Core Idea

Consistency models define what values a read can return after a write in a replicated system. Strong models (linearizability, sequential consistency) provide intuitive semantics but require coordination overhead. Weaker models (eventual consistency, causal consistency) improve availability and latency by tolerating temporary disagreement and concurrent write conflicts.

Explainer

From your study of distributed systems, you know that replication — storing the same data on multiple nodes — is fundamental to fault tolerance and scalability. But replication introduces a problem: what happens when a client writes to one replica and reads from another? What value should the read return? Consistency models are the formal answer to this question. They define the contract between the system and its clients about which behaviors are observable.

The strongest commonly-used model is linearizability (sometimes called atomic consistency). It requires that every operation appear to execute instantaneously at a single point in time, and that this point respects real-world clock order. If a write completes before a read begins, the read must see the new value. This is the intuition most programmers have about a variable — you write 5, then you read 5. Achieving linearizability across replicas requires coordination: the system must ensure that before a read returns, it has contacted enough replicas to guarantee it has the latest value (typically a quorum).

Sequential consistency is slightly weaker. It requires that all clients observe operations in the same global order, but that order does not need to match wall-clock time. Client A's write might appear to happen "before" client B's write in the global sequence even if B's write completed earlier in real time. This relaxation removes the real-time constraint and can allow more efficient implementations, but the semantics are harder to reason about.

Eventual consistency is much weaker and much more practical for geographically distributed systems. It guarantees only that, if no new writes occur, all replicas will eventually converge to the same value. There is no bound on *when* — a read may see a stale value for seconds or minutes. This allows replicas to accept writes locally and synchronize asynchronously, yielding very low write latency. Systems like DNS and shopping cart databases often use eventual consistency.

Between these extremes, causal consistency offers a useful middle ground: if operation A causally precedes operation B (e.g., you read a message, then reply to it), then any client that sees B must also have seen A. This preserves the logical flow of causally related events without requiring global coordination. The choice of consistency model is ultimately an engineering tradeoff between correctness guarantees, latency, and availability — and it must match the actual requirements of the application.

Practice Questions 3 questions

Prerequisite Chain

Counting to 10Counting to 20Understanding ZeroThe Number ZeroCounting to FiveOne-to-One CorrespondenceCombining Small Groups Within 5Addition Within 10Addition Within 20Two-Digit Addition Without RegroupingTwo-Digit Addition with RegroupingAddition Within 100Repeated Addition as MultiplicationMultiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Two-Digit by One-Digit DivisionDivision with RemaindersRemainders and Quotients in DivisionDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueReading and Writing DecimalsComparing and Ordering DecimalsAdding and Subtracting DecimalsMultiplying DecimalsDividing DecimalsDividing FractionsMixed Number ArithmeticOrder of OperationsOperators and ExpressionsArithmetic Operators and Operator PrecedenceComparison Operators and Boolean TestsLogical Operators and Boolean AlgebraBoolean Algebra and Fundamental LawsCombinational Circuit DesignFlip-Flops and LatchesBinary Counters: Design and AnalysisBinary ArithmeticFixed-Point Number RepresentationTwo's Complement RepresentationOverflow and Underflow DetectionBinary Adders: Half-Adders and Full-AddersFull Adder and Carry PropagationCarry Lookahead Adder DesignHalf Adder Circuit DesignMultiplication Circuit DesignSequential Circuit DesignRegisters and Register FilesInstruction Set Architecture (ISA)Kernel Architecture and OS StructureSystem Calls and User/Kernel ModeProcesses and the Process Control BlockLogical Clocks and Event OrderingVector Clocks and Capturing CausalityHappened-Before Relation and Causal OrderingConsistency Models in Distributed Systems

Longest path: 67 steps · 241 total prerequisite topics

Prerequisites (2)

Leads To (8)