Paxos history
The Paxos algorithm proposed by Leslie Lamport is an important basic technology in modern distributed system, which has been widely used.
The entire development process of Paxos can be divided into three stages:
The first stage: the germination period, roughly 1988-1996 years. Liskov and others on the PODC published viewstamped replication:a New Primary Copy Method to support highly-available distributed Systems, proposed a A master-slave backup algorithm that still works in the event of a replica outage, the algorithm is consistent with Paxos in nature (the ABCD's of Paxos).
Phase II: 1996-2007. The emergence of a number of different versions of Paxos, these Paxos variants from different sides to improve the basic Paxos algorithm, improve its performance. Liskov and others in 1999 proposed PBFT (practical Byzantine fault-tolerant algorithm), which is actually a variant of Paxos, was Lampson called Byzantine Paxos, the algorithm of the basic Paxos has been improved so that it can handle Byzantine errors.
The Byzantine general question (Byzantine failures) is the basic problem in point-to-point communication proposed by Leslie Lambert. The implication is that it is not possible to attempt to achieve consistency in a message-passing way on an unreliable channel where the message is lost.
Located in Istanbul, now Turkey, Byzantium is the capital of the Eastern Roman Empire. Because of the vast territory of the Byzantine Empire at that time, for the purpose of defence, each army was separated very far, the general and the general can only rely on Messenger to preach news. At the time of the war, all generals and lieutenants in the Byzantine army had to agree on the possibility of winning and attacking the enemy's camp. However, there may be traitors and enemy spies in the army, and the decisions of the Generals disturb the order of the whole army. In the consensus, the results do not represent the views of the majority. At this time, in the case of known members of the rebellion, the rest of the loyal generals without the influence of the traitor how to reach a unanimous agreement, the Byzantine issue formed.
The Byzantine hypothesis is the modelling of the real world, where computers and networks can behave unpredictably due to hardware errors, network congestion or disconnection, and malicious attacks. The Byzantine fault-tolerant protocol must handle these failures, and these protocols also meet the specifications for the problem requirements to be addressed.
Eli Gafni and Lamport introduced disk Paxos in 2000, which can be considered a Paxos-based version to support persistence.
Phase III: this stage. Paxos began to be widely used in industry. Since 2006, Google has two influential papers published on OSDI, one is "bigtable:a distributed Storage System for Structured Data", and the other "the Chubby lock Service for Loosely-coupled distributed Systems ". Two papers could be said to be the prelude to big Data management, while Paxos plays an extremely important role in the core technology (fault tolerance) of big data management.
Algorithm principle
Paxos algorithm Wikipedia https://en.wikipedia.org/wiki/Paxos_ (computer_science)
Paxos algorithm is one of the most effective algorithms to solve the distributed consistency problem, which is based on the message-passing and highly fault-tolerant consistency algorithm. However, the Paxos algorithm is notorious for its arcane and obscure knowledge.
The context in which the problem arises
In common distributed systems, there will always be situations such as machine downtime or network anomalies (including message latency, loss, duplication, chaos, and network partitioning). The problem that the Paxos algorithm needs to solve is how to agree the value of a data within the cluster quickly and correctly in a distributed system where the above anomalies occur, and ensure that no matter what happens above, it will not compromise the consistency of the whole system.
Related concepts
In the Paxos algorithm, there are four types of roles:
- Client: The person who created the issue
- Proposer: proposed by
- Acceptor (voters): Decision maker (voter)
- Learner: The final decision Learner, the executor.
of the above 4 roles, the proponents and decision makers are very important, the other 2 roles in the entire algorithm should be counted as soy sauce, proposer like the messenger of the client, Proposer Messenger holding the topic of the client to acceptor proposal, let acceptor to make decisions.
- Proposer took the client's topic to acceptor proposal, let acceptor to make decision.
- Proposer raised the issue, acceptor preliminary acceptance or acceptor initially unacceptable.
- Acceptor preliminary acceptance proposer again to acceptor confirm whether the final acceptance.
- Acceptor final acceptance or acceptor ultimately not accepted.
- Learner Ultimate Learning goal is to learn from all acceptor, if a majority of Acceptor finally accepted a proposal, then the final result, the purpose of the algorithm has been achieved.
Problem description
Suppose there is a set of processes that can present (propose) value (value in the proposal proposal). A consistency algorithm needs to ensure that so much of the value is raised that only one value is selected (chosen). If no value is raised, no value should be selected. If a value is selected, then all processes should be able to learn (learn) to this selected value. For the consistency algorithm, the security (Safaty) requirements are as follows:
- Only the value presented can be selected.
- Only one value is selected, and
- If a process considers a value to be selected, then this value must be the one that is really selected.
The goal of Paxos is to ensure that eventually a value is selected, and the process can eventually get to the selected value when value is selected.
Algorithm Description Paxos algorithm is divided into two stages. Specific as follows:
Phase One:
(a) Proposer selects a proposal number N and then sends a prepare request with a number of N to more than half of the acceptor.
(b) If a acceptor receives a prepare request with a number n, and N is greater than the number of all prepare requests that the acceptor has already responded to, then it responds back to proposer with the largest number of proposals it has accepted (if any). , and the acceptor promised not to accept any proposal with a number less than N.
Stage Two:
(a) If proposer receives more than half of the acceptor's response to a prepare request with the number N issued, it sends an accept request for the [N,V] proposal to more than half of the acceptor. Note: V is the value of the proposal with the largest number in the received response, and if no proposal is included in the response, then V is determined by proposer itself.
(b) If Acceptor receives an accept request for a proposal of number N, it accepts the proposal as long as the acceptor has not responded to a prepare request with a number greater than N.
eg.
Learner Learning the selected value
Learner Learning (Acquisition) The selected value has the following three scenarios:
Paxos Development, Algorithm principle