Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring 2006 1 Principles of Reliable Distributed Systems Recitation.

Slides:



Advertisements
Similar presentations
Consensus on Transaction Commit
Advertisements

Paxos Made Simple Leslie Lamport. Introduction ► Lock is the easiest way to manage concurrency  Mutex and semaphore.  Read and write locks in 2PL for.
CS 5204 – Operating Systems1 Paxos Student Presentation by Jeremy Trimble.
Paxos Lamport the archeologist and the “Part-time Parliament” of Paxos: – The Part-time Parliament, TOCS 1998 – Paxos Made Simple, ACM SIGACT News 2001.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Paxos Steve Ko Computer Sciences and Engineering University at Buffalo.
1 Indranil Gupta (Indy) Lecture 8 Paxos February 12, 2015 CS 525 Advanced Distributed Systems Spring 2015 All Slides © IG 1.
6.852: Distributed Algorithms Spring, 2008 Class 7.
Distributed Systems Overview Ali Ghodsi
Consensus Hao Li.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Paxos Steve Ko Computer Sciences and Engineering University at Buffalo.
Consensus Algorithms Willem Visser RW334. Why do we need consensus? Distributed Databases – Need to know others committed/aborted a transaction to avoid.
1 Principles of Reliable Distributed Systems Lectures 11: Authenticated Byzantine Consensus Spring 2005 Dr. Idit Keidar.
State Machine Replication Project Presentation Ido Zachevsky Marat Radan Supervisor: Ittay Eyal Winter Semester 2010.
 Idit Keidar, Principles of Reliable Distributed Systems, Technion EE, Spring Principles of Reliable Distributed Systems Lecture 9: Paxos Spring.
Paxos Made Simple Gene Pang. Paxos L. Lamport, The Part-Time Parliament, September 1989 Aegean island of Paxos A part-time parliament – Goal: determine.
Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Principles of Reliable Distributed Systems Recitation.
 Idit Keidar, Principles of Reliable Distributed Systems, Technion EE, Spring Principles of Reliable Distributed Systems Lecture 7: Failure Detectors.
 Idit Keidar, Principles of Reliable Distributed Systems, Technion EE, Spring Principles of Reliable Distributed Systems Lecture 10: SMR with Paxos.
Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Principles of Reliable Distributed Systems Recitation.
Aran Bergman Eddie Bortnikov, Principles of Reliable Distributed Systems, Technion EE, Spring Principles of Reliable Distributed Systems Recitation.
Eran Bergman & Eddie Bortnikov, Principles of Reliable Distributed Systems, Technion EE, Spring Principles of Reliable Distributed Systems Recitation.
Idit Keidar, Principles of Reliable Distributed Systems, Technion EE, Spring Principles of Reliable Distributed Systems Lecture 5: Synchronous Uniform.
 Idit Keidar, Principles of Reliable Distributed Systems, Technion EE, Spring Principles of Reliable Distributed Systems Lecture 9: SMR with Paxos.
Alex Shraer, Principles of Reliable Distributed Systems, Technion EE, Spring Principles of Reliable Distributed Systems Recitation 1: Introduction.
Eran Bergman & Eddie Bortnikov, Principles of Reliable Distributed Systems, Technion EE, Spring Principles of Reliable Distributed Systems Recitation.
Aran Bergman & Eddie Bortnikov & Alex Shraer, Principles of Reliable Distributed Systems, Spring Principles of Reliable Distributed Systems Recitation.
EEC 688/788 Secure and Dependable Computing Lecture 12 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Principles of Reliable Distributed Systems Recitation 5: Reliable.
CHUBBY and PAXOS Sergio Bernales 1Dennis Kafura – CS5204 – Operating Systems.
Chapter 6 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University Building Dependable Distributed Systems.
CS 425 / ECE 428 Distributed Systems Fall 2014 Indranil Gupta (Indy) Lecture 19: Paxos All slides © IG.
 Idit Keidar, Principles of Reliable Distributed Systems, Technion EE, Spring Principles of Reliable Distributed Systems Lecture 7: Failure Detectors.
1 Principles of Reliable Distributed Systems Recitation 7 Byz. Consensus without Authentication ◊S-based Consensus Spring 2008 Alex Shraer.
State Machines CS 614 Thursday, Feb 21, 2002 Bill McCloskey.
Election Algorithms. Topics r Issues r Detecting Failures r Bully algorithm r Ring algorithm.
Paxos Made Simple Jinghe Zhang. Introduction Lock is the easiest way to manage concurrency Mutex and semaphore. Read and write locks. In distributed system:
Bringing Paxos Consensus in Multi-agent Systems Andrei Mocanu Costin Bădică University of Craiova.
CSE 486/586, Spring 2014 CSE 486/586 Distributed Systems Paxos Steve Ko Computer Sciences and Engineering University at Buffalo.
Paxos A Consensus Algorithm for Fault Tolerant Replication.
Paxos: Agreement for Replicated State Machines Brad Karp UCL Computer Science CS GZ03 / M st, 23 rd October, 2008.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Paxos Steve Ko Computer Sciences and Engineering University at Buffalo.
CS425 / CSE424 / ECE428 — Distributed Systems — Fall Nikita Borisov - UIUC1 Some material derived from slides by Leslie Lamport.
CSE 486/586, Spring 2014 CSE 486/586 Distributed Systems Paxos Steve Ko Computer Sciences and Engineering University at Buffalo.
Detour: Distributed Systems Techniques
Consensus, impossibility results and Paxos Ken Birman.
The consensus problem in distributed systems
CS 525 Advanced Distributed Systems Spring 2013
Distributed Systems – Paxos
CSE 486/586 Distributed Systems Paxos
Distributed Systems CS
Implementing Consistency -- Paxos
CS 525 Advanced Distributed Systems Spring 2018
Fault-tolerance techniques RSM, Paxos
CS 425 / ECE 428 Distributed Systems Fall 2017 Indranil Gupta (Indy)
EEC 688/788 Secure and Dependable Computing
EEC 688/788 Secure and Dependable Computing
Consensus, FLP, and Paxos
EEC 688/788 Secure and Dependable Computing
EECS 498 Introduction to Distributed Systems Fall 2017
EEC 688/788 Secure and Dependable Computing
Replicated state machine and Paxos
EEC 688/788 Secure and Dependable Computing
EEC 688/788 Secure and Dependable Computing
EEC 688/788 Secure and Dependable Computing
EEC 688/788 Secure and Dependable Computing
EEC 688/788 Secure and Dependable Computing
EEC 688/788 Secure and Dependable Computing
Paxos Made Simple.
Implementing Consistency -- Paxos
CSE 486/586 Distributed Systems Paxos
Presentation transcript:

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Principles of Reliable Distributed Systems Recitation 9: Paxos (  ) Made Simple Spring 2007 Alex Shraer

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Abstract “The Paxos algorithm, when presented in plain English, is very simple.”

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring The Model Asynchronous Benign failures (non-Byzantine) Processes may fail by stopping, and restart. –No limitation on number of failures. Messages can be duplicated and lost, but not corrupted.

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Agents Three classes: –proposers –acceptors –learners A single process may act as more than one agent.

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Our Goal – Understand Paxos Safety requirements: –A single value is chosen, –Only a value that has been proposed may be chosen, –A process never learns that a value has been chosen unless it actually has been. Liveness requirements (conditional): –Some proposed value is eventually chosen, and –If a value has been chosen, then a process can eventually learn the value.

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Choosing a value Take I: –Have a single acceptor agent. –All proposers send proposals to the acceptor. –Acceptor chooses first proposed value it receives. Where’s the problem?

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Choosing a value (cont’d) Take II: –Multiple acceptors –A proposer sends a proposal to a set of acceptors –An acceptor may accept the proposed value. –The value is chosen when a large enough set of acceptors have accepted it. How large is large enough?

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring When to choose? If there are no failures or message loss, we want a value to be chosen even if there is only one proposer: P1: An acceptor must accept the first proposal that it receives. What happens if several values are proposed by different proposers at about the same time?

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Two proposals v1 v2 v1 v2 v1 v2 v1

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Numbered Proposals P1 + “majority” requirement  –An acceptor must be allowed to accept >1 proposal. Keeping track of proposals: unique numbers –In fact, pairs: (counter, pid) Accepting a value: –A single proposal with the same number (and value) has been accepted by a majority.

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Maintaining Agreement We can allow multiple proposals to be chosen, but Must guarantee that all chosen proposals have the same value, so P2: If a proposal with value v is chosen, then every higher-numbered proposal that is chosen has value v.

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Maintaining Agreement (cont’d) To be chosen, a proposal must be accepted by at least one acceptor, so we can satisfy P2 by satisfying: P2a: If a proposal with value v is chosen, then every higher-numbered proposal accepted by any acceptor has value v.

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Worst Case Scenario 1, v1 2,v2 1, v1 Choose v1 2, v2 accept accept ! Does not hear any message (yet)

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Maintaining Agreement (cont’d) To guarantee P2a, we need to strengthen it P2b: If a proposal with value v is chosen, then every higher-numbered proposal issued by any proposer has value v. –Note: P2b  P2a  P2 How can P2b be enforced? –Hard to predict the future – easy to learn the past!

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Satisfying P2b P2c: If a proposal (n, v) is issued, then there exists a majority S of acceptors, such that: Either no acceptor in S has accepted any proposal numbered less than n Or v is the value of the highest-numbered proposal among all proposals numbered less than n accepted by the acceptors in S. Proof of P2b: induction on n

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Maintaining P2c (Prepare) Choose proposal number n Request from all acceptors –A promise to not accept any proposal numbered < n –The proposal with the highest number < n that has been accepted (if any) Await replies from majority thereof

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Issuing Proposals Issue a proposal (v,n) such that: –Either v is the value of the highest-numbered proposal, –Or v is any value if no proposals were reported Is it enough to get the response that no proposal < n was accepted from (only) a majority of acceptors?

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Acceptor’s Algorithm Can ignore any request without compromising safety. Should be allowed to respond (for progress) –Can always respond to prepare. –Can respond to accept only if it not promised not to. P1a: An acceptor can accept a proposal numbered n iff it has not responded to a prepare request having a number greater than n.

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Optimizations If an acceptor receives a prepare request numbered n, but already responded to a prepare request numbered > n… –No need to reply! A proposer can abandon a request if someone else is issue a higher-numbered one

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Acceptor State An acceptor must remember: –The highest-numbered proposal that it has ever accepted (aka AcceptNum) –The number of the highest-numbered prepare request to which it has responded (aka BallotNum) Need stable storage –Why? Homework question

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Putting it all together…Phase 1 Proposer: selects a proposal number n and sends a prepare request with n to a majority of acceptors. Acceptor: if a prepare request is received with number n > that of any prepare request to which it has already responded, it responds to the request with a promise not to accept any more proposals numbered less than n + with the highest-numbered proposal (if any) that it has accepted.

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Phase 2 Proposer: if receives a response to prepare(n) from a majority of acceptors  sends an accept(n,v) request to each of those acceptors –v is the value of the highest-numbered proposal among the responses, or any value if the responses reported no proposals. Acceptor: if receives an accept request for a proposal numbered n, it accepts the proposal unless it has already responded to a prepare request having a number greater than n.

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Progress Prepare(1) Ack(1,  ) Prepare(3) Ack(3,  ) Prepare(4)

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Progress (cont’d) A a distinguished proposer is required to guarantee progress –A leader –The only one allowed to issue proposals in stable state

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Learning a Chosen Value Multiple options (efficiency vs fault-tolerance): –All processes are learners  accepted value sent to everyone. –Distinguished learner(s)

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Putting it all Together 11 2 n (“accept”,  1,1 ,v 1 ) 1 2 n n (“prepare”,1) (“ack”,  1,1 ,r 0,  ) decide v 1 (“accept”,  1,1 ,v 1 ) 1.Failure-free run 2.Our  implementation always trusts process 1

Eddie Bortnikov & Aran Bergman, Principles of Reliable Distributed Systems, Technion EE, Spring Leslie Lamport “At the PODC 2001 conference, I got tired of everyone saying how difficult it was to understand the Paxos algorithm … The current version is 13 pages long, and contains no formula more complicated than n1 > n2 “