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

Read-Your-Writes Anomalies

Explore the classic problem where a user writes data but immediately reads stale data from another replica.

Read-Your-Writes Anomalies

What You'll Learn

You'll understand the frustrating scenario where a user writes data to a distributed system but immediately sees old data when reading it back—a common consistency problem in eventually consistent systems.

The Problem

In an eventually consistent system with multiple replicas, read-your-writes anomalies occur when a user successfully writes data to one replica, but their next read hits a different replica that hasn't yet received the update. The user sees stale data—even though they just wrote the new value.

Why This Happens

When you write data to a distributed system, the write might go to one replica (or a leader). Due to replication lag, other replicas haven't caught up yet. If your subsequent read request is routed to a lagging replica, you'll see the old value.

Real-World Example

Imagine updating your social media profile photo:

  1. You upload a new photo (write succeeds on Replica A)
  2. The system confirms "Photo updated!"
  3. You refresh your profile page
  4. Your read request hits Replica B (still has old photo)
  5. You see your old photo and think the update failed

This creates a terrible user experience—the system lied when it said the update succeeded!

The Consistency Gap

This anomaly violates an intuitive expectation: users assume they'll always see their own writes. In eventually consistent systems, this isn't guaranteed without special handling. The replicas will converge eventually (per convergence guarantees), but "eventually" might be seconds or minutes—too long for a good user experience.

Key Takeaway: Read-your-writes anomalies occur when users read stale data after their own writes due to replication lag between replicas, breaking the intuitive expectation that you always see your own updates immediately.