Consensus in Distributed Systems. Jeff Chase Duke University

Similar documents
Concepts. Techniques for masking faults. Failure Masking by Redundancy. CIS 505: Software Systems Lecture Note on Consensus

Transactions. CS 475, Spring 2018 Concurrent & Distributed Systems

Agreement and Consensus. SWE 622, Spring 2017 Distributed Software Engineering

The objective. Atomic Commit. The setup. Model. Preserve data consistency for distributed transactions in the presence of failures

EECS 591 DISTRIBUTED SYSTEMS

Distributed Systems Consensus

The challenges of non-stable predicates. The challenges of non-stable predicates. The challenges of non-stable predicates

Distributed Commit in Asynchronous Systems

To do. Consensus and related problems. q Failure. q Raft

CS 541 Database Systems. Three Phase Commit

Consensus, impossibility results and Paxos. Ken Birman

Distributed Transactions

Distributed systems. Lecture 6: distributed transactions, elections, consensus and replication. Malte Schwarzkopf

Beyond FLP. Acknowledgement for presentation material. Chapter 8: Distributed Systems Principles and Paradigms: Tanenbaum and Van Steen

Introduction to Distributed Systems Seif Haridi

Distributed Systems Fault Tolerance

Consensus and related problems

Parallel Data Types of Parallelism Replication (Multiple copies of the same data) Better throughput for read-only computations Data safety Partitionin

COMMENTS. AC-1: AC-1 does not require all processes to reach a decision It does not even require all correct processes to reach a decision

Assignment 12: Commit Protocols and Replication Solution

Consensus a classic problem. Consensus, impossibility results and Paxos. Distributed Consensus. Asynchronous networks.

EECS 591 DISTRIBUTED SYSTEMS. Manos Kapritsos Winter 2018

Fault Tolerance. Distributed Systems IT332

Recall our 2PC commit problem. Recall our 2PC commit problem. Doing failover correctly isn t easy. Consensus I. FLP Impossibility, Paxos

CSE 5306 Distributed Systems

Today: Fault Tolerance

CSE 5306 Distributed Systems. Fault Tolerance

Fault Tolerance. Basic Concepts

Fault Tolerance. Distributed Systems. September 2002

Last time. Distributed systems Lecture 6: Elections, distributed transactions, and replication. DrRobert N. M. Watson

Module 8 - Fault Tolerance

Exercise 12: Commit Protocols and Replication

CS505: Distributed Systems

Today: Fault Tolerance. Fault Tolerance

Consensus Problem. Pradipta De

CS5412: CONSENSUS AND THE FLP IMPOSSIBILITY RESULT

A Case Study of Agreement Problems in Distributed Systems : Non-Blocking Atomic Commitment

Fault Tolerance. o Basic Concepts o Process Resilience o Reliable Client-Server Communication o Reliable Group Communication. o Distributed Commit

Fault Tolerance. Distributed Software Systems. Definitions

Basic vs. Reliable Multicast

Today: Fault Tolerance. Failure Masking by Redundancy

Fault Tolerance. Goals: transparent: mask (i.e., completely recover from) all failures, or predictable: exhibit a well defined failure behavior

Control. CS432: Distributed Systems Spring 2017

Distributed Systems. coordination Johan Montelius ID2201. Distributed Systems ID2201

Today: Fault Tolerance. Replica Management

ATOMIC COMMITMENT Or: How to Implement Distributed Transactions in Sharded Databases

Distributed Algorithms Benoît Garbinato

Assignment 12: Commit Protocols and Replication

Failures, Elections, and Raft

Recovering from a Crash. Three-Phase Commit

DCOM CORBA EJB DCOM CORBA CORBA EJB DCOM EJB

Fault Tolerance Causes of failure: process failure machine failure network failure Goals: transparent: mask (i.e., completely recover from) all

EECS 498 Introduction to Distributed Systems

Distributed Systems 11. Consensus. Paul Krzyzanowski

CS October 2017

Distributed Data with ACID Transactions

Causal Consistency and Two-Phase Commit

Practical Byzantine Fault Tolerance. Miguel Castro and Barbara Liskov

Fault Tolerance Part I. CS403/534 Distributed Systems Erkay Savas Sabanci University

Viewstamped Replication to Practical Byzantine Fault Tolerance. Pradipta De

Distributed Systems. Fault Tolerance. Paul Krzyzanowski

Failure Tolerance. Distributed Systems Santa Clara University

Distributed Systems COMP 212. Lecture 19 Othon Michail

CprE Fault Tolerance. Dr. Yong Guan. Department of Electrical and Computer Engineering & Information Assurance Center Iowa State University

EMPIRICAL STUDY OF UNSTABLE LEADERS IN PAXOS LONG KAI THESIS

Paxos provides a highly available, redundant log of events

Basic concepts in fault tolerance Masking failure by redundancy Process resilience Reliable communication. Distributed commit.

Proseminar Distributed Systems Summer Semester Paxos algorithm. Stefan Resmerita

Transactions Between Distributed Ledgers

Consensus. Chapter Two Friends. 2.3 Impossibility of Consensus. 2.2 Consensus 16 CHAPTER 2. CONSENSUS

Global atomicity. Such distributed atomicity is called global atomicity A protocol designed to enforce global atomicity is called commit protocol

Module 8 Fault Tolerance CS655! 8-1!

Distributed Systems 8L for Part IB

FAULT TOLERANT LEADER ELECTION IN DISTRIBUTED SYSTEMS

Mastering Agreement Problems in Distributed Systems

Consensus. Chapter Two Friends. 8.3 Impossibility of Consensus. 8.2 Consensus 8.3. IMPOSSIBILITY OF CONSENSUS 55

Chapter 8 Fault Tolerance

Linearizability CMPT 401. Sequential Consistency. Passive Replication

6.033 Computer System Engineering

NONBLOCKING COMMIT PROTOCOLS

CS /15/16. Paul Krzyzanowski 1. Question 1. Distributed Systems 2016 Exam 2 Review. Question 3. Question 2. Question 5.

Distributed Systems Principles and Paradigms. Chapter 08: Fault Tolerance

CPS 512 midterm exam #1, 10/7/2016

TWO-PHASE COMMIT ATTRIBUTION 5/11/2018. George Porter May 9 and 11, 2018

Distributed System. Gang Wu. Spring,2018

Replication in Distributed Systems

Byzantine Consensus in Directed Graphs

Replications and Consensus

Dep. Systems Requirements

Distributed Systems 24. Fault Tolerance

Fault Tolerance 1/64

Verteilte Systeme/Distributed Systems Ch. 5: Various distributed algorithms

Distributed Consensus Protocols

Chapter 8 Fault Tolerance

Today: Fault Tolerance. Reliable One-One Communication

Transactions. Intel (TX memory): Transactional Synchronization Extensions (TSX) 2015 Donald Acton et al. Computer Science W2

Intuitive distributed algorithms. with F#

Yale University Department of Computer Science

Data Consistency and Blockchain. Bei Chun Zhou (BlockChainZ)

CSE 486/586 Distributed Systems

Transcription:

Consensus in Distributed Systems Jeff Chase Duke University

Consensus P 1 P 1 v 1 d 1 Unreliable multicast P 2 P 3 Consensus algorithm P 2 P 3 v 2 Step 1 Propose. v 3 d 2 Step 2 Decide. d 3 Generalizes to N nodes/processes.

Fischer-Lynch-Patterson (1985) No consensus can be guaranteed in an asynchronous communication system in the presence of any failures. Intuition: a failed process may just be slow, and can rise from the dead at exactly the wrong time. Consensus may occur recognizably on occasion, or often. e.g., if no inconveniently delayed messages FLP implies that no agreement can be guaranteed in an asynchronous system with byzantine failures either.

Consensus in Practice I What do these results mean in an asynchronous world? Unfortunately, the Internet is asynchronous, even if we believe that all faults are eventually repaired. Synchronized clocks and predictable execution times don t change this essential fact. Even a single faulty process can prevent consensus. The FLP impossibility result extends to: Reliable ordered multicast communication in groups Transaction commit for coordinated atomic updates Consistent replication These are practical necessities, so what are we to do?

Consensus in Practice II We can use some tricks to apply synchronous algorithms: Fault masking: assume that failed processes always recover, and define a way to reintegrate them into the group. If you haven t heard from a process, just keep waiting A round terminates when every expected message is received. Failure detectors: construct a failure detector that can determine if a process has failed. A round terminates when every expected message is received, or the failure detector reports that its sender has failed. But: protocols may block in pathological scenarios, and they may misbehave if a failure detector is wrong.

Consistency Three Properties You Want Pick Two Availability Partition-Resilience [Fox/Brewer]

Committing Distributed Transactions Transactions may touch data stored at more than one site. Each site commits (i.e., logs) its updates independently. Problem: any site may fail while a commit is in progress, but after updates have been logged at another site. An action could partly commit, violating atomicity. Basic problem: individual sites cannot unilaterally choose to abort without notifying other sites. Log locally, commit globally.

Two-Phase Commit (2PC) Solution: all participating sites must agree on whether or not each action has committed. Phase 1. The sites vote on whether or not to commit. precommit: Each site prepares to commit by logging its updates before voting yes (and enters prepared phase). Phase 2. Commit iff all sites voted to commit. A central transaction coordinator gathers the votes. If any site votes no, the transaction is aborted. Else, coordinator writes the commit record to its log. Coordinator notifies participants of the outcome. Note: one server ==> no 2PC is needed, even with multiple clients.

The 2PC Protocol 1. Tx requests commit, by notifying coordinator (C) C must know the list of participating sites. 2. Coordinator C requests each participant (P) to prepare. 3. Participants validate, prepare, and vote. Each P validates the request, logs validated updates locally, and responds to C with its vote to commit or abort. If P votes to commit, Tx is said to be prepared at P. 4. Coordinator commits. Iff P votes are unanimous to commit, C writes a commit record to its log, and reports success for commit request. Else abort. 5. Coordinator notifies participants. C asynchronously notifies each P of the outcome for Tx. Each P logs outcome locally and releases any resources held for Tx.

Handling Failures in 2PC 1. A participant P fails before preparing. Either P recovers and votes to abort, or C times out and aborts. 2. Each P votes to commit, but C fails before committing. Participants wait until C recovers and notifies them of the decision to abort. The outcome is uncertain until C recovers. 3. P or C fails during phase 2, after the outcome is determined. Carry out the decision by reinitiating the protocol on recovery. Again, if C fails, the outcome is uncertain until C recovers.