Skip to content
About
Main content

Summary and key takeaways

Two axes, not one ladder

  • : many objects, one logical copy. They say which of transactions a reader may see.
  • : one object, many copies. They say how recent and how ordered a read is.
  • Serializability gives no recency. gives no multi-object atomicity. Their conjunction is (), the only cell with no anomalies left.

Isolation in five lines

  • Anomalies are shapes (cycles) in a of write-write, write-read and read-write edges.
  • A level is a set of prohibited shapes; the ANSI names are broken, and "" means at least three different things.
  • is fixed by commuting the operation (SET balance = balance - x), which moves the read-modify-write into one statement and shrinks the read-to-write by up to 10^4 (typically 10^3), or by a version check, which detects the conflict instead.
  • is a mismatch between the detector's unit (a row) and the 's unit (a set): fix by materializing the conflict or by .
  • is serializable minus every cycle with two or more edges.

The three pieces of arithmetic

ResultMeaning
r + w ≥ d ()Local reads and local writes together are impossible; the network delay is a conserved total.
read ≥ u/4, write ≥ u/2 (linearizability)You pay for uncertainty of delay, not delay itself.
anomalies in flight ≈ conflicting rate × windowThe window (lag, age, TTL) is the term you can attack.

Four ways to buy the fixed total: reads, or read-index, reads with write-back (), or local reads and writes (give up the model).

Distributed consistency in one table

ModelKindKey fact
LinearizabilityOne copy plus real time; it is local, so it composes. The universal primitive.
Sequential consistencysafetyOne agreed order, no recency; does not compose; what a replicated log gives.
safetyStrongest model with total ; metadata cost; blind to causality outside the system.
safetyImplemented by client tokens; broken by infrastructure changes.
safetyPrevents reply-before-message.
EventualVacuous under continuous writes; only the bound () is operable.
Strong eventualsafety + livenessSame updates delivered means same state.

Convergence has only two forms. (last-write-wins, loses writes, clock skew decides) or merge (a CRDT: , associative, idempotent). CRDTs are coordination-free only on the write path; the garbage collector needs global knowledge (). CRDTs give , not correctness.

Tunable consistency. R + W > N gives overlap only. Recency also needs version arbitration and a write-back round. Failed writes may reappear. remove the overlap exactly when failures occur. Per-request levels do not compose: the weakest pairing governs.

The unification

  • CAP: during a , linearizability and total availability cannot both hold. It is per operation, not "pick two", and says nothing about latency.
  • : the "else" branch (latency versus consistency) runs all the time; look at your p99 on a normal day.
  • : causal+ with is the strongest transactional guarantee with total availability. Snapshot isolation is not available, because is a coordination point.
  • I-confluence decides whether coordination is needed: uniqueness and upper bounds are not I-confluent; per-row checks, insert-only foreign keys and lower bounds that transactions only push up are.
  • CALM: coordination-free if and only if . Coordination points cluster at five places: uniqueness, aggregation barriers, sequencing, termination detection, garbage collection.
  • Partition the slack (escrow): coordination rate ≈ consumption rate / slack per , paid in .
  • External consistency is needed because of (people, queues, other services) faster than replication.
  • A vendor's level name is a hypothesis; test it with list-append histories and cycle search (Adya's G0, G1, G-single, G2 are the output vocabulary of the only black-box checker that works).

The ten principles that recur

  1. : costs move, never vanish.
  2. Mismatch rule: detector unit versus invariant unit; tracking unit versus need.
  3. Little's rule: anomalies = rate × window.
  4. : intractable exact tests get conservative approximations and false positives.
  5. Hidden-assumption rule: what does this guarantee assume that it cannot verify, and who pays?
  6. Immutable-substrate rule: no overwrite means an indirection layer and a collector (CRDT ).
  7. : restate the operation so order does not matter, and coordination becomes optional ( proves it).
  8. : cross-operation guarantees move to the client as a monotone handle.
  9. : cost depends on and distance, not on data volume.
  10. : "eventually" is useful only with a stated bound.

The decision procedure (stop at the first step that works)

  1. Can the operation commute? 2. Does the invariant fit in one row? 3. Is it I-confluent? 4. Can you ? 5. Is there an application read-modify-write (rules out Read Committed)? 6. Does a transaction check a set invariant and then write (rules out snapshot isolation)? 7. Is there an out-of-band channel faster than replication (needs external consistency)? 8. Only then choose a model, and state the staleness bound.

The story, in short. Anika's replica created anomalies without changing a write (observers). "Serializable" did not help with recency. She fixed lost update and write skew in the ledger, priced Singapore with r + w ≥ d, added session tokens and CRDT counters, replaced a "strong" quorum claim with an accurate one, gave away exactly 1,000 bonuses by partitioning the slack, and ended with one screen-by-screen table.

The question to carry forward: how many observers, how far apart, and what does each of them believe?