Distributed Consistency Models

Difficulty
Importance

The problem

'Consistent' isn't one single guarantee — different applications need different, precisely specified promises about when a write becomes visible to other readers, and choosing too strong a guarantee costs performance while choosing too weak a one causes real, user-visible bugs.

Why now

The CAP theorem established that consistency is a spectrum you trade against availability, but treated 'consistency' as one thing; this topic breaks it into the actual named models engineers choose between, and ACID's isolation levels already hinted that consistency itself has gradations even on a single machine.

Mental model

Strong consistency promises every reader sees the latest write immediately, as if there were only one copy of the data — expensive to guarantee across a network. Eventual consistency promises only that, absent new writes, all copies will eventually agree — cheap and highly available, but a reader can briefly see stale data. Most real systems pick a middle point (like 'read-your-own-writes') that's stronger than pure eventual consistency but cheaper than global strong consistency.

Requires

Unlocks

Used in

Projects

  • Simulate eventual consistency with two local data stores syncing on a delay, and demonstrate a stale read during the sync window
  • Design a 'read-your-own-writes' guarantee on top of an eventually consistent store, ensuring a user always sees their own recent changes even if others don't yet

Examples

  • A user posting a comment and immediately refreshing to not see it, then seeing it seconds later, is a visible eventual-consistency lag
  • DynamoDB lets you choose 'strongly consistent' or 'eventually consistent' reads per request, trading latency and cost directly for the guarantee

Resources

Mastery checklist