# CAP Theorem — System Design

Source: https://www.geekswithgeeks.com/en/system-design/sd-cap

> Under a partition, choose consistency or availability.

## The three letters

**C**onsistency: every read sees the latest write. **A**vailability: every request gets a response. **P**artition tolerance: the system works despite dropped messages between nodes.

## You must tolerate P

Networks fail, so partition tolerance isn't optional in a distributed system. The real choice during a partition is **CP** (reject requests to stay correct) or **AP** (answer with possibly stale data).

## It's per-operation

Real systems mix both: a bank balance is CP, a 'likes' count is AP. Decide per feature, not per company.
