The CAP Theorem & Consistency Models
Every distributed system eventually has to choose which guarantees to sacrifice under failure. CAP theorem is the framework for that conversation.
Consistency, Availability, Partition Tolerance
CAP theorem states that during a network partition, a distributed system can guarantee either consistency (every read gets the latest write) or availability (every request gets a response), but not both. Partition tolerance is generally non-negotiable in real distributed systems, so the real choice is CP vs AP.
CP vs AP in Practice
A banking ledger typically favors consistency — an unavailable system beats an incorrect balance. A social media feed typically favors availability — showing slightly stale content beats showing an error page.
Beyond CAP: Eventual Consistency
In practice, most large systems use eventual consistency for non-critical data — replicas converge to the same state over time, but may briefly disagree. Naming this explicitly, and identifying which parts of your system need strong consistency versus which can tolerate eventual consistency, is a strong interview signal.
A Concrete Example
A "like" count on a post can lag by a few seconds without anyone noticing — a good candidate for eventual consistency and heavy caching. A referral request's status, by contrast, needs to be accurate the moment a candidate checks it — a good candidate for strong consistency, even at some cost to availability during a partition.
Don't Overuse the Term
CAP theorem is a useful framework, not something to recite verbatim in every answer. Use it to justify a specific design decision — which data needs which guarantee — rather than as a standalone talking point disconnected from the system you're actually designing.
PACELC: The Extension Worth Knowing
CAP only describes behavior during a partition, but systems also make consistency/latency trade-offs when everything is healthy — this is what PACELC captures: if Partitioned, choose Availability or Consistency; Else, choose Latency or Consistency. Mentioning that the trade-off exists even in the normal, non-partitioned case shows a deeper understanding than CAP alone conveys.
Ready to put this into practice?
Upload your resume and get matched with a verified referrer today.
Get Started