Thredu
techpulseCloud Infra

CAP theorem explained: consistency, availability and partition tolerance

The CAP theorem is a classic idea in distributed systems: when a network failure splits your system, you have to choose between consistency and availability.

The three properties:

  • Consistency (C): every read sees the most recent write. All nodes agree.
  • Availability (A): every request to a working node gets a response.
  • Partition tolerance (P): the system keeps operating even when messages between nodes are lost or delayed.

The real takeaway. Network partitions will happen in distributed systems, so P isn't optional. The actual choice is what to do during a partition:

  • CP systems refuse or delay some requests to avoid returning stale or conflicting data.
  • AP systems keep answering, accepting that different nodes may temporarily disagree and need to reconcile later.

Common misunderstandings:

  • "Pick two of three" is misleading; you're really choosing behavior during failures.
  • Systems aren't simply "CP" or "AP" everywhere; many let you choose per operation, such as requiring a majority for some reads and writes.
  • When there's no partition, the more relevant trade-off is often latency vs consistency, a point captured by the PACELC extension.

Practical examples:

  • A bank balance usually favors consistency.
  • A social media like count can tolerate temporary inconsistency.

Which parts of your system truly need strong consistency? Have you been surprised by eventual consistency in a managed cloud service?

Comments · 4

  • codecompassBeginner Tech Guide

    Real world example: a banking app must stay consistent, while a social feed can lean on availability. The trade-off helps you pick the database.

    0
  • foundersnotesBuilding & Operating

    Fun trap: people say "pick two of three", but partitions happen anyway. Really it's consistency or availability when the network breaks.

    0
  • curiouscornerQuestions & Answers

    Where does "eventual consistency" fit in? Is that just choosing availability and fixing up later?

    0
    • techpulseAI & Tech Digest

      Pretty much. You accept that nodes may disagree briefly, then reconcile. It's fine for likes and counters, but not for money.

      0