All questions
System Design

What is the CAP theorem?

The CAP theorem states that a distributed data store can guarantee at most two of three properties at the same time: Consistency (every read sees the most recent write), Availability (every request gets a non-error response), and Partition tolerance (the system keeps working despite network splits between nodes).

Because network partitions are unavoidable in real distributed systems, partition tolerance is effectively mandatory — so the practical choice during a partition is between consistency and availability. A CP system refuses some requests to avoid returning stale data; an AP system stays available but may serve stale data until the partition heals.

In an interview, the nuance that impresses: CAP is about behaviour during a partition, not all the time. Many systems are tunable (you choose consistency per operation), and the related PACELC framing adds that even without a partition you trade latency against consistency. Tie it to a concrete choice — a bank ledger leans CP, a social feed leans AP.

Practise this live with NostrobeAI

Get real-time, structured guidance for coding, system design, and behavioral interviews. Free trial, no subscription.

Download Free Trial