liveBook · Manning

Chapter 9: Consistency

What you will learn in chapter 9 of Think Distributed Systems

The introduction contrasts database consistency with the multiple meanings of consistency in distributed systems and previews the chapter’s topics.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The introduction contrasts database consistency with the multiple meanings of consistency in distributed systems and previews the chapter’s topics.

Key terms: consistency, transaction, valid state, application-level constraints, consistency models, linearizability, eventual consistency, CAP conjecture and theorem

9.1 Consistency models

This section models operations and system histories so that consistency can be defined as satisfying a specific set of valid histories.

Key terms: process, object, operation, invocation, completion, history, invocation event, completion event, concurrent structure, consistency model

9.1.1 Common consistency models

The section connects application-specific correctness to consistency models: engineers choose acceptable histories, while common models provide established guarantees with different virtues and limitations.

Key terms: correctness, consistency models, histories, virtues and limitations

9.1.2 Virtues and limitations

This section explains how consistency models relate by the histories they allow and why choosing a stronger or weaker model trades availability and latency against predictable behavior.

Key terms: consistency models, valid histories, subset, superset, stronger, weaker, developer experience, coordination, availability, latency

9.2 Linearizability

Introduces linearizability as a strong consistency model that gives replicated objects a real-time recency guarantee and makes replication transparent.

Key terms: linearizability, atomic consistency, recency guarantee, replication transparency, real-time guarantee, single operations, single objects, object type, queue, stack

9.2.1 Queue and stack

The section defines correct queue and stack behavior through operation traces, then explains how linearizability carries those object semantics into a distributed setting.

Key terms: queue, stack, FIFO, FILO, enqueue, dequeue, correctness, object type, single-process, single-object setting, linearizability

9.2.2 Formal definition of linearizability

Defines linearizability for an operation history, illustrates a violation caused by replication lag, and distinguishes a linearizable history from a system-wide guarantee.

Key terms: history, sequential, concurrent, invocation, completion, linearizability, sequential equivalence, real-time ordering, nonconcurrent operations, replicated, distributed, increment-only counter

9.3 Eventual consistency

This section introduces eventual consistency as a weak model that guarantees eventual convergence, then points to the Amazon shopping cart as a practical example.

Key terms: eventual consistency, convergence guarantee, Werner Vogels, Amazon DynamoDB, Amazon shopping cart

9.3.1 The shopping cart

A shopping-cart example shows how a network partition creates conflicting replicas and why an eventual-consistency policy must choose which user actions to preserve.

Key terms: replicas, network partition, conflict, consistent state, retain items added, removed items resurrect, availability

9.3.2 Variants of eventual consistency

Defines basic and strong eventual consistency by their shared delivery guarantee and different convergence guarantees.

Key terms: basic eventual consistency, eventual delivery, weak convergence, strong eventual consistency, strong convergence

9.3.3 Implementation

This section explains how replicas reconcile concurrent updates under eventual consistency, contrasting application-specific rules with operation-based and state-based CRDTs.

Key terms: eventual consistency, application-specific reconciliation, algorithmic reconciliation, conflict-free replicated data types, CRDTs, operation-based CRDTs, commutative CRDTs, operations, commutative, state-based CRDTs

9.4 Consistency, availability, and partition tolerance

Introduces CAP as a framework for discussing precisely defined tradeoffs in replicated distributed systems and warns that it is often misunderstood.

Key terms: CAP, consistency, availability, partition tolerance, replicated, distributed systems

9.4.1 History

This section traces CAP from Brewer’s conjecture to a formally proved theorem and explains why inevitable network partitions make “pick two out of three” misleading.

Key terms: CAP conjecture, CAP theorem, consistency, availability, partition tolerance, pick two out of three, network partitions, CP, AP

9.4.2 Conjecture vs. theorem

This section gives the informal meanings of consistency, availability, and network partitions used to discuss the CAP conjecture and theorem.

Key terms: consistency, availability, safety property, liveness property, network partition, replicated system, conjecture, theorem

9.4.3 CAP theorem

This section presents Gilbert and Lynch’s CAP theorem through its system model and contradiction proof, then explains why the theorem should not be used as a blanket design argument.

Key terms: system model, asynchronous network, permanent network partition, C, N1, N2, proof by contradiction, consistency, availability, partition tolerance

9.5 Summary

The chapter summary contrasts consistency guarantees and their tradeoffs, from linearizability and eventual consistency to the limits imposed by network partitions.

Where this is used later

Concepts explained in this chapter

← Chapter 8: Replication Chapter 10: Distributed consensus →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.