Distributed Systems. 11. Consensus: Paxos. Paul Krzyzanowski. Rutgers University. Fall 2015

Similar documents
Fast Paxos (Leslie Lamport) Yuxin Liu, Hua Zhu EECS 591 Distributed systems

Quorums. Christian Plattner, Gustavo Alonso Exercises for Verteilte Systeme WS05/06 Swiss Federal Institute of Technology (ETH), Zürich

DPaxos: Managing Data Closer to Users for Low-Latency and Mobile Applications

The Stellar Consensus Protocol (SCP)

What can happen if two quorums try to lock their nodes at the same time?

The Stellar Consensus Protocol

Bigdata High Availability Quorum Design

IN a distributed database system, data is

Adaptable Recovery Using Dynamic Quorum Assignments *

The Stellar Consensus Protocol (SCP) draft-mazieres-dinrg-scp-00

P2P Content Distribution BitTorrent and Spotify

SPIRARE 3 Installation Guide

BYLAWS OF CALVARY CHURCH Pueblo, Colorado

TRINITY EVANGELICAL FREE CHURCH

Volusia Community Organizations Active in Disaster Bylaws. As Updated November 19, 2014

Quran Revolution Terms & Conditions:

First Baptist Church, Bonham Facilities Key Policy and Procedures February 12, Key Policy

Probabilistic Quorum-Based Accounting for Peer-to-Peer Systems

2018 Unit Charter Renewal Guide

CONSTITUTION of the Open Door Baptist Church of Columbia, Missouri

Attachment C-4 Appendix C Manual of Operations. Ending Ministry Well

Grids: Why, How, and What Next

A Model for Small Groups at Scarborough Community Alliance Church

UFMCC BYLAW AMENDMENT PROPOSAL Instructions Lay House & Clergy House

Diocese of Saginaw Parish Finance Council Norms

Q-OPT: Self-tuning Quorum System for Strongly Consistent Software Defined Storage

RootsWizard User Guide Version 6.3.0

Guideline: Parish Pastoral Council Guidelines Related Policy: Parish Governance Policy

Summary of Registration Changes

Emory Course of Study School COS 423 Missions

Northfield Methodist Church

OUTREACH/MINISTRY SUPPORT FUNDING REQUEST

Parish: Address: Audit Period (corresponds to fiscal year):

In groups of 3 ID the 4 key principles about rights and the purpose of government that are given in this section from the Declaration of Independence.

Outline. Uninformed Search. Problem-solving by searching. Requirements for searching. Problem-solving by searching Uninformed search techniques

55 North 3 rd St., Bangor, PA HOPE (4673)

CONSTITUTION AND BYLAWS THE FIRST CONGREGATIONAL CHURCH OF SHELBURNE, MASSACHUSETTS, UNITED CHURCH OF CHRIST

Online Mission Office Database Software

TEST # 1 CUT PATHS FROM HOST TO IOGRP0:

VITALCONGREGATIONS INITIATIVE2016

CITY OF UMATILLA AGENDA ITEM STAFF REPORT

MIDDLEBURY CONGREGATIONAL CHURCH BYLAWS

CONSTITUTION AND BYLAWS THE FIRST CONGREGATIONAL CHURCH OF SHELBURNE, MASSACHUSETTS, UNITED CHURCH OF CHRIST

Data Sharing and Synchronization using Dropbox

SAMPLE BYLAWS. Used with permission from DOVE Christian Fellowship International

HOW TO USE OUR APP. A brief guide to using the urbi app on any smartphone. How to use our app on any smartphone

ARTICLE I PURPOSE ARTICLE II STRUCTURE

Proposed BYLAWS January 2018 Christian and Missionary Alliance Church of Paradise 6491 Clark Road Paradise, California INTRODUCTION

Slots - online casinos A perfect package for enthusiastic players!

// ADMISSIONS POLICY // Salesian School. A Catholic School in the Diocese of Arundel and Brighton

Allreduce for Parallel Learning. John Langford, Microsoft Resarch, NYC

Where to get help. There are many ways you can get help as you gather family history information

We demonstrate our commitment to CHRIST and our desire to follow in HIS steps with heads that think, hearts that love, and mouths that pray.

CONGREGATIONAL PROFILE

Waukesha Bible Church Constitution

Counterfactuals, belief changes, and equilibrium refinements

Doug Swanney Connexional Secretary Graeme Hodge CEO of All We Can

A NARRATIVE SUMMARY OF THE NEW IN CARE : A COVENANT OF DISCERNMENT AND FORMATION

Pastor of Student Ministries Ministry Position Description

ACCEPTANCE LETTER. NW ACDA Childrens Honor Choir 2014 Seattle, WA March 13-16, 2014

Entry Level Certificate

BYLAWS OF THE BETHEL EVANGELICAL FREE CHURCH

How You Can Start A Successful Video Production Company?

USF MASTERS OF SOCIAL WORK PROGRAM ASSESSMENT OF FOUNDATION STUDENT LEARNING OUTCOMES LAST COMPLETED ON 4/30/17

Diocese of Derby Clergy File (Blue File) Storage and Access Policy.

SPIRITUAL LIFE SURVEY REPORT. One Life Church. September 2011

Priesthood Restoration Site Visitor Center Water Systems

Islam Revision Notes Religious Studies Ce Rs

Diocese of Orlando. Guidelines for the Use of Video Projection in Liturgical Celebrations. Introduction

Preamble ARTICLE II. Name and Purpose. Parishioners

Your information will be scanned on-line by yourself or apply to education to produce an electronic application package.

Stratford School Academy Schemes of Work

1.1.1 The name of this congregation shall be Christ s Church of the Valley abbreviated as CCV.

Remarks by Bani Dugal

Lutheran CORE Constitution Adopted February 23, 2015

Annual Returns Help and Guidance

Southside Baptist Church of Jacksonville, Florida Bylaws

Constitution 01/29/2017 Revision

POLICY DOCUMENTS OF THE BAPTIST MISSIONS DEPARTMENT

Saint Mark Orthodox Church

This report is organized in four sections. The first section discusses the sample design. The next

PWRDF Partnership Policy Final INTRODUCTION

TOWN COUNCIL STAFF REPORT

Revised June, 2012 THE CONSTITUTION AND BYLAWS CHERRY LOG CHRISTIAN CHURCH (DISCIPLES OF CHRIST) CHERRY LOG, GEORGIA PREAMBLE

Welcome to Breeze Fairview Baptist s Church Management Software

CONSTITUTION AND BY-LAWS Cornerstone Church Myrtle Beach

2018 Consolidated Charge Conference Form

Office Manager (Part-time)

BYLAWS OF WHITE ROCK BAPTIST CHURCH

An Efficient Indexing Approach to Find Quranic Symbols in Large Texts

Holy Trinity Greek Orthodox Church of Biloxi Mississippi. Bylaws. February 8, Preamble

Parish Pastoral Council 1. Introduction 2. Purpose 3. Scope

Preamble. Article I: Name. Article II: Statement of Faith. Article III: Affiliation

Members Present: Marvin Kaplansky

Identifying Anaphoric and Non- Anaphoric Noun Phrases to Improve Coreference Resolution

LCC CONSTITUTION. Puyallup, Washington September 1992

DUBLIN Thick Whois Policy Implementation - IRT Meeting

Principles of Distributed Computing. Burcu Canakci. Lorenzo Alvisi Cornell University. Natacha Crooks. Cong Ding

Frequently Asked Questions

KNIGHTS OF COLUMBUS HOLY ROSARY COUNCIL #4483

Transcription:

Distributed Systems 11. Consensus: Paxos Paul Krzyzanowski Rutgers University Fall 2015 1

Consensus Goal Allow a group of processes to agree on a result All processes must agree on the same value The value must be one that was submitted by at least one process (the consensus algorithm cannot just make up a value) 2

We saw versions of this Mutual exclusion Agree on who gets a resource or who becomes a coordinator Election algorithms Agree on who is in charge Other uses of consensus: Manage group membership Synchronize state to manage replicas: make sure every group member agrees on a (key, value) set Distributed transaction commit General consensus problem: How do we get unanimous agreement on a given value? 3

Achieving consensus seems easy! Designate a system-wide coordinator to determine outcome BUT this assumes there are no failures or we are willing to wait indefinitely for recovery 4

Consensus algorithm goal Create a fault-tolerant consensus algorithm that does not block if a majority of processes are working Goal: agree on one result among a group of participants Processors may fail (some may need stable storage) Messages may be lost, out of order, or duplicated If delivered, messages are not corrupted 5

Consensus requirements Validity Only proposed values may be selected Uniform agreement No two nodes may select different values Integrity A node can select only a single value Termination (Progress) Every node will eventually decide on a value 6

Consensus: Paxos 7

Paxos Fault-tolerant distributed consensus algorithm Does not block if a majority of processes are working The algorithm needs a majority (2P+1) of processors survive the simultaneous failure of P processors Goal: provide a consistent ordering of events from multiple clients All machines running the algorithm agree on a proposed value from a client The value will be associated with an event or action Paxos ensures that no other machine associates the value with another event Abortable consensus A client s request may be rejected It then has to re-issue the request 8

A Programmer s View Process Submit(R) accepted Consensus algorithm Send results (total order) while (submit_request(r)!= ACCEPTED) ; Think of R as a key:value pair in a database 9

These different roles are usually part of the same system Paxos players : makes a request s: Get a request from a client and run the protocol Leader: elected coordinator among the proposers (not necessary but simplifies message numbering and ensures no contention) we don t need to rely on the presence of a single leader s: Multiple processes that remember the state of the protocol Quorum = any majority of acceptors Learners: When agreement has been reached by acceptors, a Learner executes the request and/or sends a response back to the client 10

What Paxos does Paxos ensures a consistent ordering in a cluster of machines Events are ordered by sequential event IDs (N) wants to log an event: sends request to a E.g., value, v = add $100 to my checking account Increments the latest event ID it knows about ID = sequence number Asks all the acceptors to reserve that event ID s A majority of acceptors have to accept the requested event ID 11

Proposal Numbers Each proposal has a number (created by proposer) Must be unique (e.g., <sequence#>.<process_id>) Newer proposals take precedence over older ones Each acceptor Keeps track of the largest number it has seen so far Lower proposal numbers get rejected sends back the {number, value} of the currently accepted proposal has to play fair : It will ask the acceptors to accept the {number, value} Either its own or the one it got from the acceptor 12

Paxos in action Goal: have all acceptors agree to a value v associated with a proposal One of the proposers is chosen to be a leader: it gets all the requests Paxos nodes: one machine may serve several roles Leader Quorum Learner Learner 13

Paxos in action: Phase 0 sends a request to a proposer request(v) Quorum Learner 14

Paxos in action: Phase 1a PREPARE : creates a proposal #N (N acts like a Lamport time stamp), where N is greater than any previous proposal number used by this proposer Send to Quorum of s (however many you can reach but a majority) Quorum Prepare(N) N = < seq#. process_id > Learner 15

Paxos in action: Phase 1b PROMISE : if proposer s ID > any previous proposal promise to ignore all requests with IDs < N reply with info about highest accepted proposal, if there is one: { N, value } else Reject the proposal Promise(N, v) Quorum This step: (a) Tells proposers about any value that has already been accepted. (b) Rejects older proposals. Learner Promise to ignore all proposals < N Promise contains the previous N 16

Paxos in action: Phase 2a : if proposer receives promises from the quorum (majority): Attach a value v to the proposal (the event). Send Accept to quorum with the chosen value If promise was for another {N, v}, proposer MUST accept that instead Quorum Accept (N, v) If the acceptor returned any (N, v) sets then the proposer must agree to accept one of those values intead of the value it proposed. It picks the v for the highest N. Learner Promise to ignore all proposals < N 17

Paxos in action: Phase 2b : if the promise still holds, then announce the value v Send Accepted message to and every Learner else ignore the message (or send NACK) Quorum Accepted(N) Accepted Announce(N, v) Learners 18

Paxos in action: Phase 3 Learner: Respond to client and/or take action on the request Quorum Announce(N, v) Learners Promise to ignore all proposals < N Server Server Server 19

Paxos: A Simple Example All Good 20

Paxos in action: Phase 0 sends a request to a proposer Request( e ) Quorum Learner Think of the request as an update to a specific {key, value} set, such as a field in a database that may be propagated to multiple instances of that database. Our value of e here might be something like a request to set name= e 21

Paxos in action: Phase 1a PREPARE : picks a sequence number: 5 Send to Quorum of s Quorum Prepare(5: e ) Learner 22

Paxos in action: Phase 1b PROMISE : Suppose 5 is the highest sequence # any acceptor has seen Each acceptor PROMISES not to accept any lower numbers Promise(5: e ) Quorum Promise to ignore all proposals < 5 Learner 23

Paxos in action: Phase 2a ACCEPT : receives the promise from a majority of acceptors must accept that <seq, value> Quorum Accept(5, e ) Promise to ignore all proposals < N Learner 24

Paxos in action: Phase 2b ANNOUNCE : s state that they accepted the request Quorum Accepted(5, e ) Accepted Announce(5, e ) Learners Announce(5, e ) 25

Paxos: A Simple Example Higher Offer 26

Paxos in action: Phase 0 sends a request to a proposer Request( e ) Quorum Learner 27

Paxos in action: Phase 1a PREPARE : picks a sequence number: 5 Send to Quorum of s One acceptor receives a higher offer BEFORE it gets this PREPARE message Prepare(7: g ) Quorum Prepare(5: e ) Learner 28

Paxos in action: Phase 1b PROMISE : Suppose 5 is the highest sequence # any acceptor has seen Each acceptor PROMISES not to accept any lower numbers Promise(5: e ) Quorum Promise(5: e ) Promise(7: g ) Learner 29

Paxos in action: Phase 2a ACCEPT : receives the higher # offer and MUST change its mind and accept the highest offer that it received from any acceptor. Quorum Accept(7, g ) Promise to ignore all proposals < N Learner 30

Paxos in action: Phase 2b ANNOUNCE : s state that they accepted the request. A learner can propagate this information Quorum Accepted(7, g ) Announce(7, g ) Accepted Learners Announce(7, g ) 31

Paxos: Keep trying if you need to A proposal N may fail because The acceptor may have made a new promise to ignore all proposals less than some value M >N A proposer does not receive a quorum of responses: either promise (phase 1b) or accept (phase 2b) Algorithm then has to be restarted with a higher proposal # 32

Paxos summary Paxos allows us to ensure consistent (total) ordering over a set of events in a group of machines Events = commands, actions, state updates Each machine will have the latest state or a previous version of the state Paxos used in: Cassandra lightweight transactions Google Chubby lock manager / name server Google Spanner, Megastore Microsoft Autopilot cluster management service from Bing VMware NSX Controller Amazon Web Services 33

Paxos summary To make a change to the system: Tell the proposer (leader) the event/command you want to add Note: these requests may occur concurrently Leader = one elected proposer. Not necessary for Paxos algorithm but an optimization to ensure a single, increasing stream of proposal numbers. Cuts down on rejections and retries. The proposer picks its next highest event ID and asks all the acceptors to reserve that event ID If any acceptor sees has seen a higher event ID, it rejects the proposal & returns that higher event ID The proposer will have to try again with another event ID When the majority of acceptors accept the proposal, accepted events are sent to learners, which can act on them (e.g., update system state) Fault tolerant: need 2k+1 servers for k fault tolerance 34

The End 35