Paxos Algorithm Summary __paxos

Source: Internet
Author: User
Tags prepare

The Paxos algorithm can be said to be one of the most famous algorithms in the field of consistency.
These days carefully read several times Leslie Lamport's thesis, "Paxos Made simple", can be said that the Paxos have a brief understanding of the lamport of the process of simple and clever, with his thesis abstract is: the Paxos Algorithm, when presented in plain 中文版, is very simple.

Interested friends are strongly recommended to read this essay. The following explanations may not be exactly the same as the paper ideas, there will be a bit of their own language and ideas in it. The process of proof will be omitted, because the purpose of this article is not to complete the process of proof clearly, is to make it easier for us to have a preliminary understanding of the Paxos algorithm. A friend who wants to see the proof process may wish to read this paper, after all, only 11 pages look very fast. The Problem

First we assume a scenario where there are a lot of processes that each process can propose (proposed) a value, and the consensus algorithm is to ensure that only one value is selected in many proposed value. If no process propose any value, then no value is selected at all. If a value is selected, then all processes should be able to know the value.

For this algorithm, there are three security requirements (given in English to prevent improper translation): Only one of the propose value can be selected (only a-value that has been proposed might by chosen). Only one value is selected (only a single value is chosen). It is only when a value is actually selected that the process will know (a process never learns that a value has been chosen unless it actually has).

The next step in the certification process is to introduce the following three types of roles: proposer, acceptor, and learner. Proposer's work is the propose value mentioned above, and the work sent to Acceptor;acceptor is to receive the information sent from proposer, giving feedback according to the situation. Learner's job is to know the value that has been selected.

The final aim is to ensure that the acceptor of over half (the majority set) selects the same value, and learner can be informed that the value is selected. Choosing a Value

In this part of the paper there is a detailed derivation of the process, we jump directly to the resulting part of the deduction. A new parameter was added: Each proposer sent a proposal (that is, a message sent to Acceptor to propose value), which includes two parameters. One proposal number to identify proposal, and the other is the proposed value. So proposal form like <proposal number, proposed value>. (in order to avoid confusion, the following uniform said proposal number is numbered)

After the derivation, the final proposer algorithm is as follows: Proposer Select a new number n (note is number, not proposal), send request to acceptor and ask them to reply to the following two points: (a). The commitment will not receive a numbered proposal smaller than N; (b). Reply to the one that has been received, the number is less than the number of all proposal in the N of the proposal. (Translated a little Raozui, give the original English: (b). The proposal with the highest number less than n so it has accepted, if any.)--Here we name this request prepare request if prop Oser received more than half of Accepter's reply, he can put forward a proposal. This proposal = <proposal number N, Value v>. where V is the value of the proposal that has the highest number in all responses (the number mentioned in B above). In the other case, if all the responses show that the acceptor have not received any proposal at the moment, then this proposer can choose a value to send to acceptor. --Here we call this request accept request.

Then the corresponding acceptor algorithm: If acceptor receives a new prepare request, and the number n is greater than any prepare request number it has ever replied to. Acceptor will reply that it will not receive any proposal with a number less than N, and reply to the largest number in the prepare request (if ever received). If you receive the accept request, and the number is N. Acceptor will accept this accept request without replying to a prepare request that has a larger number than N.

At this point, is the proposer and acceptor algorithm. The following further content is based on this. Learning a chosen Value

To see if a value has been chosen by the algorithm, learner needs to check if more than half of the acceptor have accepted a proposal. The simplest implementation must be that all acceptor send messages to all learner after receiving a proposal. In this case, all learner can find the chosen value the first time. But there is so much information to be done that it needs to be optimized.

So we can select a person in charge (distinguished learner) in all the learner, and all acceptor send the message to it, and then it forwards it to all the other learner. This method is highly efficient, but if the chosen person is fail, the system will never know the chosen value.

A more general realization is to elect a few principals, who work together on the above, though with a little bit more information, security is greatly improved. (two implementations are available later) Progress

There are a few problems to be solved, assuming that there are two proposer constantly issued proposal, each time is larger than the other 1. This will cause all the proposal of two people to be rejected (because it is easy to analyze the above algorithm).

In order to solve this problem, we need to also select a proposer in charge (distinguished proposer), so that only the person responsible for the proposal, so that can solve the above problems. The implementation

The above three sections have finished the whole Paxos algorithm.

So we assume that in this process system, the Paxos algorithm has a total of three roles: Proposer,acceptor and learner (each process can play multiple roles). It is also necessary to elect one or more leader to take charge (distinguished Proposer/learner).

But in the process of describing this algorithm there are many prerequisites or assumptions have been omitted, such as: Our system is customary asynchronous, Non-byzantine model. All roles operate at any speed and may encounter failure or reboots. All messages are received at any length of time and may be duplicated or even lost, but will not be corrupted.

So ashamed to say that I this article is very not rigorous, but the paper Paxos algorithm concise narrated out, if there are loopholes and even understand the wrong place, I hope we do not hesitate to enlighten.


https://zhuanlan.zhihu.com/p/25438477

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.