CAP

Three attributes support a distributed system.

In a general case, we can only support two of the attributes of a system at most:

  • Consistency: Every read receives the most recent write or an error.
  • Availability: Every request receives a response, without guarantee that it contains the most recent version of the information.
  • Partition Tolerent: The system continues to operate despite arbitrary partitioning due to network failures.

However, the networks are unreliable. So in order to keep the system could continuously operate on a network system, we have to support the partiton tolerance to assure that sufficient individual system can operate while another one fails. We have a make a trade-off between Consistency and Availability.

CP(Consistency and Partition Tolerance)

Waiting for a response might have a timeout error. If the businesss needs require atomic reads and writes, CP is a good choice.

AP(Availability and Partition Tolerance)

Responses return the most readily available version of the data available on the node, which might not be the latest. Writes might take some time to propagate when the partition is resolved.