Course contentsShow
← System Design
Lesson 542 of 1,91915. Consistency ModelsFree lesson

Read-Your-Writes Consistency

Guaranteeing that a client always sees their own writes immediately after they're acknowledged.

Read-Your-Writes Consistency

What you'll learn: How to guarantee users always see their own updates immediately, even in distributed systems.

The Core Problem

In distributed systems with replication, when you write data to one node, it takes time to propagate to others. If you immediately read from a different replica, you might see stale data—missing your own update. This creates a jarring user experience: you hit "save" but then refresh and see the old version.

Read-Your-Writes Consistency solves this by guaranteeing that once a client writes data, any subsequent reads by that same client will reflect that write (or a newer version).

How It Works

Think of it like leaving yourself a note: you always remember what you just wrote, even if your roommates haven't seen it yet. Similarly, the system ensures you see your writes, while other users might temporarily see older data.

Common Implementation Strategies

  • Read from the leader: For data a user modified, always route their reads to the primary replica (which has the latest write).
  • Track client writes: The client remembers the timestamp/version of its last write and only reads from replicas caught up to at least that point.
  • Session stickiness: Pin a user's session to one replica that has their writes.

Why It Matters

Without read-your-writes, users lose trust: "I just posted that comment—where did it go?" This consistency model provides a personalized consistency guarantee while allowing the system to remain eventually consistent for other users.

Key Takeaway: Read-Your-Writes Consistency ensures users always see the effects of their own actions immediately, preventing confusion while still allowing eventual consistency across the broader system.