Distributed Systems in One Lesson
The foundation of any robust distributed systems architecture rests on understanding that the network is not reliable. If you assume latency is zero and bandwidth is infinite, your system will fail catastrophically during a network partition.
"The difference between a bad programmer and a good programmer is whether he considers his code or his data structures more important. Bad programmers worry about the code. Good programmers worry about data structures and their relationships."
At Amazon, we often rely on eventual consistency for highly available services like inventory views, while strongly consistent reads are reserved for checkout ledgers. Trade-offs govern everything.
- Availability: The system remains operational.
- Consistency: All nodes see the same data at the same time.
- Partition Tolerance: The system continues to operate despite network drops.
You can only pick two, and in a distributed network, Partition Tolerance is non-negotiable. Therefore, the architectural choice is always between CP and AP.