Course contentsShow
← Computer Science
Lesson 2615 of 2,87258. Distributed Systems BasicsFree lesson

Read-Your-Writes Consistency

Understand the guarantee that a process always sees its own previous writes in subsequent reads.

Read-Your-Writes Consistency

What You'll Learn

You'll learn how a distributed system can guarantee that once you write data, you'll always see that write (or newer data) in your own subsequent reads—even if other users might see stale data for a while.

The Core Idea

Read-Your-Writes Consistency (also called "read-after-write consistency") is a guarantee that focuses on a single client or process: after you successfully write a value, any read you perform afterward will reflect that write or something newer. You won't time-travel backward to see older data you've already overwritten.

This doesn't mean everyone sees your write immediately—just that you do. Other users might still see stale data due to replication lag or eventual consistency.

Why It Matters

Imagine posting a comment on social media. You click "Submit," then immediately refresh the page. With read-your-writes consistency, you will see your own comment. Without it, you might reload and think, "Did my comment disappear? Is the site broken?"

This property is weaker than strong consistency (where everyone sees writes immediately) but stronger than eventual consistency alone (where even you might temporarily see old data after your own write).

How It Works

Systems typically implement this by:

  • Routing your reads to the same replica that processed your write
  • Tracking write timestamps and ensuring reads wait until replicas catch up to your writes
  • Using session tokens that encode the last write version you've seen

Key Takeaway

Read-Your-Writes Consistency ensures you always see your own updates in subsequent reads, preventing the jarring experience of your own changes "disappearing" temporarily, even if others might still see stale data.