System Design interview question

What is the CAP theorem?

Short answer

The CAP theorem says that when a network partition occurs, a distributed data store must choose between consistency — every read sees the latest write — and availability — every request gets a non-error response. Partition tolerance is not optional in real networks, so the practical choice is CP or AP behaviour during a partition.

What it does not say

CAP only describes behaviour during a partition. When the network is healthy, systems can offer both consistency and availability. The PACELC extension adds that, even without partitions, systems trade latency against consistency.

Examples

  • CP — reject or delay writes on the minority side of a partition to avoid divergence (for example, consensus-based stores).
  • AP — accept writes on both sides and reconcile later with eventual consistency.

How to answer it in an interview

  • Avoid “pick two of three”; explain the partition framing instead.
  • Tie the choice to the product: inventory counts vs social media likes.

Walk into your next interview prepared

Start free, install the Windows app and run a practice session today.