"Principle and Practice of Distributed Consistency from Paxos to ZooKeeper" Reading Notes

1. Distributed Architecture

1. Distributed characteristics

  • distribution
  • Equivalence. All computer nodes in a distributed system are peers
  • concurrency. Multiple nodes operate concurrently on some shared resources
  • Lack of global clock. Communication and coordination between nodes through message passing, because of the lack of a global clock, it is difficult to define which of the two events comes first
  • Failures always happen. When designing the system, any exceptions need to be taken into account

2. Various problems of distributed environment

  • Communication exception. Some nodes in a distributed system cannot communicate properly
  • network partition. Some nodes can communicate normally, and some cannot communicate normally. This phenomenon is called network partitioning, also known as "split brain"
  • Tri-state. There are three states for a communication between nodes: success, failure, timeout
  • Node failure. Node machine is down and loses response

3. ACID theory of traditional transactions.

  • Atomicity. All operations within a transaction either all succeed or all fail
  • Consistency. The execution of a transaction cannot break the consistency of the database. If the transaction execution stops halfway, part of the modifications are written to the database. At this time, the database is in an incorrect state, or an inconsistent state
  • Isolation. Multiple transactions execute concurrently without affecting each other. The isolation level of the transaction: read uncommitted (dirty reads, repeated reads, phantom reads may occur), read committed (repeat reads, phantom reads may occur), repeatable reads (phantom reads may occur), serialization. The higher the isolation level, the greater the impact on concurrency performance, and the more consistent the database can be guaranteed.
  • Durability. Once the transaction is successfully committed, its changes to the data are permanently saved

4. CAP theory and BASE theory of distributed transactions

  • CAP theory. Consistency, availability, and partition tolerance, in a distributed system, can only satisfy at most two of them.
  • BASE theory. Basicly Available, Soft state, Eventually consistent. Basic availability means that when the system fails, part of the availability is allowed to be lost, including the loss of response time and functional system degradation; soft state means that the communication between nodes is allowed to appear in an intermediate state; final consistency means that all data copies of the system are stored within a certain period of time. After synchronization, a consistent state can finally be reached

2. Consistency Agreement

1. 2PC. two-phase commit protocol

 

2. 3PC. Three-phase commit protocol

 

3. Paxos algorithm

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325165383&siteId=291194637