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

What is Consistency in Distributed Systems?

Define consistency and why it matters when data is replicated across multiple nodes in a distributed system.

What is Consistency in Distributed Systems?

You'll learn: What consistency means when your data lives on multiple machines, and why it's crucial for building reliable distributed systems.

The Core Problem

When you replicate data across multiple nodes in a distributed system—say, copies of a customer's account balance on servers in New York, London, and Tokyo—those copies can temporarily diverge. Consistency defines the guarantees about what data a client sees when reading from any node, especially after writes occur.

Think of it like a shared whiteboard duplicated in three conference rooms. When someone updates the New York board, how quickly and reliably does that change appear in London and Tokyo? Can someone read an outdated value? Can different people see different values at the same time?

Why Consistency Matters

Without consistency guarantees, your distributed system becomes unpredictable:

  • Banking: Alice transfers $100 from savings to checking. If she immediately checks her balance from a different server, will she see the updated amounts, or could the money temporarily "disappear"?
  • Inventory: Two customers simultaneously buy the last item in stock from different data centers. Without consistency rules, both purchases might succeed, creating a negative inventory.
  • Social media: You update your profile picture, but friends see the old photo for minutes or hours—confusing and frustrating.

Consistency is about correctness: ensuring that despite having multiple copies of data, your system behaves predictably and meets user expectations.

The Spectrum

Consistency isn't binary. Systems offer different consistency levels—from "strong" (all nodes always agree) to "eventual" (nodes eventually agree, but may diverge temporarily)—each with different performance trade-offs.

Key Takeaway: Consistency in distributed systems defines what data values are visible to clients when reading from replicated nodes, ensuring predictable and correct behavior despite data being copied across multiple machines.