Back to roadmap
Module 3 · Consistency & ReplicationDay 02325 min

Read-Your-Writes, Monotonic, Causal

Useful 'middle' consistency models that match user expectations cheaply.

Day 023

Read-Your-Writes, Monotonic, Causal

User
client
Write→Leader
service
Read
service
Replica
datastore
Signal path
Session consistency via version tokens
User
client
flow
Write→Leader
service
User
client
flow
Read
service
Read
service
flow
Replica
datastore
Memory hook

Read-Your-Writes, Monotonic, Causal: useful 'middle' consistency models that match user expecta...

Mental model

choose the failure mode you can explain

Design lens

Sticky routing is simple but uneven load.

Recall anchors
Read-your-writesMonotonic readsCausal

Why it matters

Between linearizable and eventual sit useful guarantees: read-your-writes (you see your own write), monotonic reads (no time travel backwards), and causal consistency (effects follow causes). They're cheap and they fix most user-visible 'why is my edit gone' bugs.

Deep dive

Read-your-writes: route the same user's reads to the replica that has their writes, or use a version token.

Monotonic reads: pin sticky-replica or pass max-seen version.

Causal: track 'happens-before' (vector clocks, lamport timestamps); rare in app code, common in some stores.

Demo / scenario

User edits profile but next page-load shows old data.

  1. Cause: write went to leader; read went to lagging replica.
  2. Fix: include LSN/version on write response.
  3. Client sends version on read; replica waits or routes to newer node.
  4. Stale read disappears; cost is small extra header.

Tradeoffs

  • Sticky routing is simple but uneven load.
  • Version tokens are cleaner but require app cooperation.
  • Causal tracking is the most general but adds metadata.

Diagram

User
Write→Leader
v=42
Read
needs v≥42
Replica
Session consistency via version tokens.

Mind map

Check yourself

Loading quiz…

Sources & further reading