CAP Theorem

The CAP theorem describes the trade-offs you can face when designing distributed systems.

CAP stands for three basic properties that a distributed system can have:

Consistency - All servers have the same data at the same time. When there’s a change in data on one server, the other servers should see and have that change as well.

Availability - The system always responds to requests, whether it’s a success or a failure. However, the response might not always have the most up-to-date information.

Partition Tolerance - The system continues to work even if some servers can’t communicate with each other due to network issues. The system will still function, even if some parts of it are not connected.

CAP theorem

According to the CAP theorem, you can guarantee only 2 out of 3 properties at the same time:

CA (Consistency and Availability) - You can’t guarantee Partition Tolerance in this case. If there are network issues, some servers may become unavailable or may respond with outdated information.

CP (Consistency and Partition Tolerance) - You might face situations where system isn’t always available because all servers need to sync before providing a response.

AP (Availability and Partition Tolerance) - There may be times when some of your servers don’t have the same data, which leads to inconsistencies.


Find this post helpful? Subscribe and get notified when I post something new!