What is the CAP theorem and why does it matter

· Category: System Design

Short answer

The CAP theorem states that a distributed data store can only guarantee two of three properties: Consistency, Availability, and Partition Tolerance. Since network partitions are inevitable, designers choose between CP and AP systems. For database tradeoffs, see sql vs nosql for system design. For caching implications, see how caching improves system performance.

Steps

  1. Define your requirements for consistency versus availability
  2. Design for partition tolerance as a baseline
  3. Choose CP if strong consistency is critical (e.g., financial systems)
  4. Choose AP if uptime is more important (e.g., social feeds)
  5. Document failure modes and recovery procedures

Tips