Distributed system-CAP, BASE principle and ACID

CAP theorem

consistency: all nodes see the same data at the same time.
available: Reads and writes always succeed.
Partition tolerance: the system continues to operate despite arbitrary message loss or failure of part of the system.

In a distributed system, the three characteristics of the CAP theorem can only guarantee two at the same time.

  1. Consistency: After the update operation is completed, the data of all nodes are consistent at the same time.
  2. Availability: The service is always available and its response time is within the normal range.
  3. Partition fault tolerance: When the distributed system encounters certain nodes or network errors, it can still provide services that meet the consistency or availability (that is, fault tolerance, which can ensure the normal operation of the system after some nodes are down) .
    CAP principle example reference

BASE theorem

BASE theory also has three characteristics, basic usability, soft state, and final consistency.

The BASE theory is an extension of the CAP theorem. Its core idea is that even if strong consistency cannot be achieved, an appropriate method must be used to achieve final consistency.

  1. Basic availability: When the system fails, part of the availability is allowed to be lost to ensure that the core is available.
  2. Soft state: Allow the system to have an intermediate state, and the intermediate state will not affect the overall availability of the system. (In distributed storage, there are generally three copies of a piece of data. Allowing the delay of copies between different nodes is a manifestation of soft state.)
  3. Eventual consistency: All copies in the system can finally achieve data consistency after a certain period of time. (Final consistency is a manifestation of weak consistency)

ACID

ACID is a traditional relational database design concept, pursuing a consistency model. BASE supports large-scale distributed systems and proposes to obtain high availability by sacrificing consistency.

ACID and BASE are two different design philosophies

System components have different requirements for consistency, sometimes ACID and BASE are used in combination


references

CAP principle (CAP theorem), BASE theory

CAP and BASE theory

Guess you like

Origin blog.csdn.net/qq_39378657/article/details/110549841