Software Engineer
hardcap-theorem
Explain the CAP theorem in distributed systems.
Answer
CAP says a distributed system can guarantee at most two of:
- **Consistency (C):** every read sees the latest write.
- **Availability (A):** every request gets a non-error response.
- **Partition tolerance (P):** the system works even when nodes can’t communicate.
Because partitions happen in real systems, you usually choose **CP** or **AP** behavior during failures.
**Interview tip:** Give examples: CP-like systems favor correctness; AP-like systems favor uptime with eventual consistency.
Related Topics
Distributed SystemsSystem Design