System Design Basics : CAP Theorem

CAP stands for Consistency, Availability and Partition Tolerance. Let’s understand the three in brief.

  • Consistency
    Every participant in a distributed system, should always receive the same data for a query i.e., the most recent write.Even when multiple nodes of a data store are up and multiple writes are happening. The data returned for the same query for different participant should be the same.

  • Availability
    It states that for a non-failing instance of a participant in a distributed system. The response returned by it when requested upon should always return a non error response. It may or may not be consistent. Availability could also be understood as the ability of the system to keep functioning when one or more instance of the component in the system have failed.

  • Partition Tolerance
    The partition here refers to the network failure or break in communication between any component of the system.So, Partition Tolerance would be the ability of the system to continue to work even if there are partition in the system. The system must do so by either cancelling the operation or by proceeding the operation by using the replicated data to serve the operation.

The CAP theorem states that any distributed system can only provide either availability or consistency in case of network Partition. As we discussed earlier that in case of partition tolerance the system continues to function by using the replicated data which may result in an inconsistent state of the system as different instance of a service may receive different copies of the same data. If it decides to cancel the operation the system would not said to be available.

Leave a Reply