Simple Introduction to Paxos algorithm

Source: Internet
Author: User

A consistency algorithm based on message passing and highly fault-tolerant characteristics. Resolves the value of a data in a cluster where there are outages or network anomalies, and ensures that any of the above exceptions will not compromise the consistency of the entire system and is fault tolerant.

The Paxos algorithm realizes the consistency of data over multiple nodes of a distributed system, and the algorithm has the following characteristics

1. based on message passing, allowing message transmission to be lost, duplicated, disorderly, but not allowed to be changed

2. If the node is less than half of the failure of the case can still work normally, node failure can occur at any time without affecting the normal execution of the algorithm.

1.Paxos algorithm overview

in the Paxos algorithm, there are three kinds of roles:proposer acceptor learner, the three conditions that must be satisfied in the algorithm:

P1: Each acceptor must approve the first proposal it receives

P2: If the proposal with thevalue V0 is M0and the number is greater than M0 And the selected proposal has a value of V0

A: If the number is M0and the proposal withvalue V0 is approved, then the number is M0 and is acceptor the approved proposal has a value of V0

b: If the proposal with a value of V0 is M0, then all proposer Proposal submitted with a number greater than M0 , whose value is V0

C: for any mn with vn, if the proposal mn with vn is presented, Then there must be a set of more than half of the acceptor S, which satisfies one of the following two conditions:

1). There is no approved proposal for a number less than Mn in S acceptor

2). Select S in all Acceptor The approved number is less than Mn the proposal, which numbered the largest proposal of Value value is Vn .

2. the entire process

Proposer generate proposal:

1.prepare Request:proposer Select a new proposal number Mn, and then to more than half of the acceptor The acceptor Collection sends a request that asks the acceptor in the collection to respond as follows:

1). can no longer approve any number less than Mn the proposal

2). acceptor has approved any proposal, that to proposer Feedback the value of the proposal with the largest number in the proposal has been approved

2. if proposer received more than half of the acceptor The result of the response, it can produce a number of mn vn vn refers to the value of the proposal with the largest number in all responses. If more than half of the acceptor If no proposal has been approved, then vn proposer arbitrary selection

after the proposal is finalized,proposer will Send the proposal to the Acceptor collection again, calling the request an accept request.

Acceptor Approval phase:

Acceptor will receive Two requests from proposer:

Prepare Request:acceptor can respond to a Prepare request at any time

Accept Request: If acceptor in response to any request with a number greater than mn , then it can accept this number as mn the request.

Simple Introduction to Paxos algorithm

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.