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:
- You upload a new photo (write succeeds on Replica A)
- The system confirms "Photo updated!"
- You refresh your profile page
- Your read request hits Replica B (still has old photo)
- 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.