The CAP Theorem is a fundamental concept in distributed systems, stating that you can only guarantee two out of three properties: Consistency, Availability, and Partition Tolerance.
- Consistency: Every read receives the most recent write.
- Availability: Every request receives a (non-error) response, without guarantee of containing the most recent write.
- Partition Tolerance: The system continues to operate despite network failures.
In practice, network partitions are inevitable, so you must choose between Consistency and Availability. This trade-off is critical for designing scalable, reliable systems—and it's a must-know for system design interviews.
Remember: You can have CP (Consistency + Partition Tolerance), AP (Availability + Partition Tolerance), or CA (Consistency + Availability, but only in a non-partitioned network). No system can achieve all three simultaneously.