Course contentsShow
← Software Engineering
Lesson 1404 of 1,93341. Scalability and Distributed SystemsFree lesson

Consistency in Replicated Systems

Trade-offs between strong consistency, eventual consistency, and read-your-writes guarantees across replicas.

Consistency in Replicated Systems

You'll learn the trade-offs between different consistency models when data lives on multiple replica servers.

The Core Challenge

When you replicate data across multiple servers (as you learned in previous lessons), a fundamental question arises: what should clients see when data is updated? If a client writes to one replica, should all other clients immediately see that change? Or can we tolerate some delay?

Consistency Models

Strong Consistency

Every read sees the most recent write, always. It's like having a single source of truth—if you update your profile picture, everyone immediately sees the new one. This requires coordination between replicas (often blocking), which adds latency and reduces availability. If replicas can't communicate, writes may be rejected.

Eventual Consistency

Replicas may temporarily disagree, but will eventually converge to the same state. Think of Wikipedia edits propagating across mirror sites—there's a delay, but they sync up. This enables high availability and low latency, but clients might see stale data temporarily.

Read-Your-Writes Consistency

A middle ground: after you update something, you will always see your own changes, but others might not immediately. Like posting a comment and seeing it in your own view right away, even if it takes seconds to appear for others. This provides a good user experience without requiring full strong consistency.

The Trade-offs

These aren't right or wrong choices—they're engineering decisions based on your needs:

  • Strong consistency: Use when correctness is critical (banking, inventory)
  • Eventual consistency: Use when availability matters more (social feeds, analytics)
  • Read-your-writes: Use for user-facing features where personal consistency matters

Key Takeaway: Replicated systems force you to choose between consistency strength, availability, and latency—strong consistency guarantees correctness but costs performance, while eventual consistency maximizes availability at the cost of temporary inconsistencies.