The Wayback Machine - https://web.archive.org/web/20261129131237/https://www.geeksforgeeks.org/system-design/consistency-in-system-design/

Consistency in System Design

Last Updated : 20 Nov, 2026

Consistency in system design defines when and how data updates become visible to clients and nodes in a distributed system.

  • Clients may temporarily observe different data versions depending on the consistency model.
  • The choice of consistency model affects latency, availability, and scalability.

Types of Consistency

Consistency models define the rules for reading and updating data across distributed systems.

frame_1000002514

1. Strong Consistency

Strong consistency provides strict guarantees about the visibility and ordering of operations. Linearizability, a strong consistency model, ensures that a read observes the latest completed write or a concurrent write according to a valid real-time ordering.

Example: When a user updates their bank balance, a subsequent strongly consistent read reflects the completed update.

2. Eventual Consistency

Eventual consistency allows replicas to temporarily contain different values. If no new updates occur and existing updates are successfully propagated and reconciled, all replicas eventually converge to the same state.

Example: After updating a social media profile picture, some users may temporarily see the previous picture until the update reaches all replicas.

3. Causal Consistency

Causal consistency ensures that operations with cause-and-effect relationships are observed in the correct order. Independent operations may be observed in different orders.

Example: A user must see a social media post before seeing a comment associated with that post.

4. Weak Consistency

Weak consistency provides limited guarantees about when updates become visible. Clients may read outdated values depending on the system's implementation.

Example: A distributed cache may return an older product price until its cached data is refreshed.

5. Read-Your-Writes Consistency

Read-Your-Writes consistency ensures that a client can observe its own completed updates in subsequent reads.

Example: After changing their username, a user immediately sees the updated username, even if other users temporarily see the previous one.

6. Monotonic Reads Consistency

Monotonic Reads Consistency ensures that once a client observes a data version, subsequent reads do not return an older version.

Example: If a user reads version 3 of a document, subsequent reads cannot return version 1 or version 2.

7. Monotonic Writes Consistency

Monotonic Writes Consistency ensures that writes from the same client are applied in the order in which they were issued.

Example: If a user performs updates A, B, and C sequentially, the system applies them in the same order.

Challenges in Maintaining Consistency

  • Coordination Overhead: Communication between distributed nodes increases resource consumption.
  • Network Partitions: Communication failures can prevent replicas from coordinating updates.
  • Latency: Waiting for coordination or acknowledgments can increase response time.
  • Concurrent Updates: Multiple clients modifying the same data can introduce conflicts.
  • Replication Delays: Asynchronous replication can cause temporary differences between replicas.

Strategies for Achieving Consistency

Different techniques help distributed systems maintain their required consistency guarantees.

  • Single Source of Truth: Maintain an authoritative source for critical data.
  • Quorum-Based Operations: Coordinate reads and writes using a required subset of replicas.
  • Consensus Algorithms: Use protocols such as Raft or Paxos to establish agreement among distributed nodes.
  • Idempotency: Prevent retries from introducing duplicate effects.
  • Versioning: Track data versions to identify outdated or conflicting updates.
  • Last-Writer-Wins (LWW): Resolve conflicts by selecting the latest update according to a defined ordering rule.
  • Merge Strategies: Combine conflicting updates using application-specific rules.
Comment

Explore