Lesson 8 / 32
CAP Theorem
Under a partition, choose consistency or availability.
The three letters
Consistency: every read sees the latest write. Availability: every request gets a response. Partition 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.