Schematic Paxos Conformance Protocol

Source: Internet
Author: User

http://blog.jobbole.com/106327/

Preface

The Paxos consistency protocol can be said to be a starting point for agreement research, and also known for its difficult to understand. In fact, the agreement itself is not much difficult to understand, its difficult to understand mainly reflected in: why the design of the agreement and how to prove its correctness. This paper attempts to explain the contents of the Protocol and the basic application process through the flowchart, which does not involve how to prove its correctness. Basic Concepts

Paxos can be divided into two types: Single-decree Paxos: Decision Single value Multi-paxos: Continuous decision multiple value, and ensure that the order on each node is exactly the same, many Paxos is often a colleague running multiple single Paxos The results of the joint implementation of the agreement.

This article only focuses on the principle of single Paxos, understand the single Paxos, multi-Paxos is not difficult to understand. three role proponents in the Paxos agreement (proposer): Proponents may propose (numerical or operational orders) for voting recipients (acceptor): The recipient may vote on the proposal made by the proponent, It is proposed that more than half of the recipients voted to be selected learners (learner): Learners do not have the right to vote, just from the recipient to learn which proposal is selected

In the protocol, each node can play more than one role at a time. Paxos features One or more nodes can propose that the system must agree on a proposal in all proposals (more than half of the recipients are selected) can only agree on a definite proposal. As long as the half of the nodes survive and communicate with each other, the system must be able to achieve a consistent state, That is to choose a definite proposal agreement diagram


Through the above process, if there are multiple nodes at the same time to propose their own, Paxos can be guaranteed to select a unique value to ensure the consistency of the distributed system. Example

Let's take an example to understand the actual application process of Paxos.

Assuming there is now a five-node distributed system, where a node intends to propose an X-value, the E-node intends to propose a Y-value, and the other nodes are not proposed.

Assuming that the A node now broadcasts its offer (which will also be sent to itself), only the A,b,c node is received due to network latency. Note that even if the A,e node's proposal reaches a node at the same time, it must have a sequential order, where "at the same time" is not the true meaning of "simultaneous".

After A,b,c received the offer, both Acceptedproposal and Acceptedvalue were empty since this was the first offer they received.

Because the A node has received over half of the node response, and the returned acceptedvalue is empty, that is, it can use X as the proposed value to take the Accept request, A,b,c received the request, the Acceptedvalue updated to X.

A,b,c will occur minproposal to a,a check that no more than 1 minproposal appears, at this point X has been selected. Wait, we're not forgetting the D,e node. Their acceptedvalue is not X, and the system is still in an inconsistent state. So far, the Paxos process is not over, we continue to look.

At this point the e-node select proposal ID 2 to send Prepare request, the result is not the same as above, because C node has accepted the proposal of a node, it will not half-hearted, so tell the e-node its choice, e-node is also very gentleman, since C chose a proposal, then I also Choose it. So, E initiates the Accept request and uses X as the proposed value, so that the entire distributed system is agreed, and everyone chooses X.

The above is a simple application of Paxos, and other complex scenes can be slowly deduced according to the flowchart, here is just a start.

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.