Distributed Systems CS 15-440 Fault Tolerance- Part III Lecture 19, Nov 25, 2013 Mohammad Hammoud 1.

Slides:



Advertisements
Similar presentations
(c) Oded Shmueli Distributed Recovery, Lecture 7 (BHG, Chap.7)
Advertisements

Computer Science Lecture 18, page 1 CS677: Distributed OS Last Class: Fault Tolerance Basic concepts and failure models Failure masking using redundancy.
OCT Distributed Transaction1 Lecture 13: Distributed Transactions Notes adapted from Tanenbaum’s “Distributed Systems Principles and Paradigms”
Systems of Distributed Systems Module 2 -Distributed algorithms Teaching unit 3 – Advanced algorithms Ernesto Damiani University of Bozen Lesson 6 – Two.
Computer Science Lecture 17, page 1 CS677: Distributed OS Last Class: Fault Tolerance Basic concepts and failure models Failure masking using redundancy.
Fault Tolerance Chapter 7.
Non-blocking Atomic Commitment Aaron Kaminsky Presenting Chapter 6 of Distributed Systems, 2nd edition, 1993, ed. Mullender.
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
Chapter 7 Fault Tolerance Basic Concepts Failure Models Process Design Issues Flat vs hierarchical group Group Membership Reliable Client.
Distributed Systems CS Fault Tolerance- Part III Lecture 15, Oct 26, 2011 Majd F. Sakr, Mohammad Hammoud andVinay Kolar 1.
1 CS 194: Distributed Systems Distributed Commit, Recovery Scott Shenker and Ion Stoica Computer Science Division Department of Electrical Engineering.
1 Fault Tolerance Chapter 7. 2 Fault Tolerance An important goal in distributed systems design is to construct the system in such a way that it can automatically.
©Silberschatz, Korth and Sudarshan19.1Database System Concepts Distributed Transactions Transaction may access data at several sites. Each site has a local.
1 More on Distributed Coordination. 2 Who’s in charge? Let’s have an Election. Many algorithms require a coordinator. What happens when the coordinator.
1 ICS 214B: Transaction Processing and Distributed Data Management Distributed Database Systems.
A Survey of Rollback-Recovery Protocols in Message-Passing Systems M. Elnozahy, L. Alvisi, Y. Wang, D. Johnson Carnegie Mellon University Presented by:
Commit Protocols. CS5204 – Operating Systems2 Fault Tolerance Causes of failure: process failure machine failure network failure Goals : transparent:
Distributed Deadlocks and Transaction Recovery.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Distributed Commit Dr. Yingwu Zhu. Failures in a distributed system Consistency requires agreement among multiple servers – Is transaction X committed?
Real Time Multimedia Lab Fault Tolerance Chapter – 7 (Distributed Systems) Mr. Imran Rao Ms. NiuYu 22 nd November 2005.
1 Distributed Systems Fault Tolerance Chapter 8. 2 Course/Slides Credits Note: all course presentations are based on those developed by Andrew S. Tanenbaum.
Fault Tolerance. Agenda Overview Introduction to Fault Tolerance Process Resilience Reliable Client-Server communication Reliable group communication.
Chapter 19 Recovery and Fault Tolerance Copyright © 2008.
Distributed Transactions Chapter 13
1 8.3 Reliable Client-Server Communication So far: Concentrated on process resilience (by means of process groups). What about reliable communication channels?
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
EEC 688/788 Secure and Dependable Computing Lecture 7 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
12. Recovery Study Meeting M1 Yuuki Horita 2004/5/14.
Distributed Transaction Management, Fall 2002Lecture Distributed Commit Protocols Jyrki Nummenmaa
Fault Tolerance CSCI 4780/6780. Distributed Commit Commit – Making an operation permanent Transactions in databases One phase commit does not work !!!
University of Tampere, CS Department Distributed Commit.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Chapter 8 Fault.
Commit Algorithms Hamid Al-Hamadi CS 5204 November 17, 2009.
More on Fault Tolerance Chapter 7. Topics Group Communication Virtual Synchrony Atomic Commit Checkpointing, Logging, Recovery.
EEC 688/788 Secure and Dependable Computing Lecture 10 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
Fault Tolerance Chapter 7.
Fault Tolerance. Basic Concepts Availability The system is ready to work immediately Reliability The system can run continuously Safety When the system.
Kyung Hee University 1/33 Fault Tolerance Chap 7.
Reliable Communication Smita Hiremath CSC Reliable Client-Server Communication Point-to-Point communication Established by TCP Masks omission failure,
Fault Tolerance Chapter 7. Failures in Distributed Systems Partial failures – characteristic of distributed systems Goals: Construct systems which can.
Building Dependable Distributed Systems, Copyright Wenbing Zhao
Revisiting failure detectors Some of you asked questions about implementing consensus using S - how does it differ from reaching consensus using P. Here.
Fault Tolerance Chapter 7. Basic Concepts Dependability Includes Availability Reliability Safety Maintainability.
1 CHAPTER 5 Fault Tolerance Chapter 5-- Fault Tolerance.
Fault Tolerance Chapter 7. Goal An important goal in distributed systems design is to construct the system in such a way that it can automatically recover.
Fault Tolerance (2). Topics r Reliable Group Communication.
1 Fault Tolerance Chapter 8. 2 Basic Concepts Dependability Includes Availability Reliability Safety Maintainability.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
1 Fault Tolerance and Recovery Mostly taken from
EEC 688/788 Secure and Dependable Computing Lecture 10 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
Chapter 8 – Fault Tolerance Section 8.5 Distributed Commit Heta Desai Dr. Yanqing Zhang Csc Advanced Operating Systems October 14 th, 2015.
More on Fault Tolerance
Fault Tolerance Prof. Orhan Gemikonakli
Fault Tolerance Chap 7.
Reliable group communication
Distributed Systems CS
Commit Protocols CS60002: Distributed Systems
Outline Announcements Fault Tolerance.
Operating System Reliability
Distributed Systems CS
Distributed Systems CS
Advanced Operating System
EEC 688/788 Secure and Dependable Computing
Distributed Transactions
Distributed Systems CS
Distributed Databases Recovery
EEC 688/788 Secure and Dependable Computing
EEC 688/788 Secure and Dependable Computing
Last Class: Fault Tolerance
Presentation transcript:

Distributed Systems CS Fault Tolerance- Part III Lecture 19, Nov 25, 2013 Mohammad Hammoud 1

Today…  Last Two Sessions:  Fault Tolerance – Part II  Reliable request-reply communication  Quiz 2  Today’s Session:  Fault Tolerance – Part III  Reliable group communication  Atomicity  Recovery  Announcements:  Quiz 2 grades are out  PS4 (the last assignment) is due on Dec 2, 2013 by 11:59PM  P4 (the last project) is due on Dec 5, 2013 by 11:59PM  Final Exam is on Sunday Dec 8, 2013 at 9:00AM, Room 2051 (all topics are included- Open book, open notes) 2

Objectives Discussion on Fault Tolerance General background on fault tolerance Process resilience, failure detection and reliable communication Atomicity and distributed commit protocols Recovery from failures

Objectives Discussion on Fault Tolerance General background on fault tolerance Process resilience, failure detection and reliable communication Atomicity and distributed commit protocols Recovery from failures

Reliable Communication 5 Reliable Request-Reply Communication Reliable Group Communication

 As we considered reliable request-reply communication, we need also to consider reliable multicasting services  E.g., Election algorithms use multicasting schemes

Reliable Group Communication  A Basic Reliable-Multicasting Scheme  Atomic Multicasting 7

Reliable Group Communication  A Basic Reliable-Multicasting Scheme  Atomic Multicasting 8

Reliable Multicasting  Reliable multicasting indicates that a message that is sent to a group of processes should be delivered to each member of that group  A distinction should be made between:  Reliable communication in the presence of faulty processes  Reliable communication when processes are assumed to operate correctly  In the presence of faulty processes, multicasting is considered to be reliable when it can be guaranteed that all non-faulty group members receive the message 9

Basic Reliable Multicasting Questions  What happens if during multicasting a process P joins or leaves a group?  Should the sent message be delivered?  Should P (if joining) also receive the message?  What happens if the (sending) process crashes during multicasting?  What about message ordering? 10

A Simple Case: Reliable Multicasting with Feedback Messages  Consider the case when a single sender S wants to multicast a message to multiple receivers  An S’s multi-casted message may be lost part way and delivered to some, but not to all, of the intended receivers  Assume that messages are received in the same order as they are sent 11

Reliable Multicasting with Feedback Messages M25 Last = 24 Receiver Last = 24 Receiver Last = 23 Receiver Last = 24 Receiver Network Sender History Buffer M25 Last = 24 Receiver Last = 24 Receiver Last = 23 Receiver Last = 24 Receiver Sender M25 ACK25 Missed 24 ACK25 12 An extensive and detailed survey of total-order broadcasts can be found in Defago et al. (2004)

Reliable Group Communication  A Basic Reliable-Multicasting Scheme  Atomic Multicasting 13

Atomic Multicast  C1: What is often needed in a distributed system is the guarantee that a message is delivered to either all processes or none at all  C2: It is also generally required that all messages are delivered in the same order to all processes  Satisfying C1 and C2 results in what we call atomic multicast  Atomic multicast:  Ensures that non-faulty processes maintain a consistent view  Forces reconciliation when a process recovers and rejoins the group 14

Virtual Synchrony  A multicast message m is uniquely associated with a list of processes to which it should be delivered  This delivery list corresponds to a group view (G)  In principle, the delivery of m is allowed to fail:  When a group-membership-change is the result of the sender of m crashing  Accordingly, m may either be delivered to all remaining processes, or ignored by each of them  Or when a group-membership-change is the result of a receiver of m crashing  Accordingly, m may be ignored by every other receiver-- which corresponds to the situation that the sender of m crashed before m was sent 15 A reliable multicast with this property is said to be “virtually synchronous”

The Principle of Virtual Synchrony P1 P2 P3 P4 Reliable multicast by multiple point-to-point messages P3 crashes G = {P1, P2, P3, P4} G = {P1, P2, P4} P3 rejoins G = {P1, P2, P3, P4} Time Partial multicast from P3 is discarded 16

Message Ordering  Four different virtually synchronous multicast orderings are distinguished: 1.Unordered multicasts 2.FIFO-ordered multicasts 3.Causally-ordered multicasts 4.Totally-ordered multicasts 17

1. Unordered multicasts  A reliable, unordered multicast is a virtually synchronous multicast in which no guarantees are given concerning the order in which received messages are delivered by different processes Process P1Process P2Process P3 Sends m1Receives m1Receives m2 Sends m2Receives m2Receives m1 Three communicating processes in the same group 18

2. FIFO-Ordered Multicasts  With FIFO-Ordered multicasts, the communication layer is forced to deliver incoming messages from the same process in the same order as they have been sent Process P1Process P2Process P3Process P4 Sends m1Receives m1Receives m3Sends m3 Sends m2Receives m3Receives m1Sends m4 Receives m2 Receives m4 Four processes in the same group with two different senders. 19

3-4. Causally-Ordered and Total-Ordered Multicasts  Causally-ordered multicasts preserve potential causality between different messages  If message m1 causally precedes another message m2, regardless of whether they were multicast by the same sender or not, the communication layer at each receiver will always deliver m1 before m2  Total-ordered multicasts require that when messages are delivered, they are delivered in the same order to all group members (regardless of whether message delivery is unordered, FIFO-ordered, or causally-ordered) 20

Virtually Synchronous Reliable Multicasting  A virtually synchronous reliable multicasting that offers total-ordered delivery of messages is what we refer to as atomic multicasting MulticastBasic Message OrderingTotal-Ordered Delivery? Reliable multicastNoneNo FIFO multicastFIFO-ordered deliveryNo Causal multicastCausal-ordered deliveryNo Atomic multicastNoneYes FIFO atomic multicastFIFO-ordered deliveryYes Causal atomic multicastCausal-ordered deliveryYes Six different versions of virtually synchronous reliable multicasting MulticastBasic Message OrderingTotal-Ordered Delivery? Reliable multicastNoneNo FIFO multicastFIFO-ordered deliveryNo Causal multicastCausal-ordered deliveryNo Atomic multicastNoneYes FIFO atomic multicastFIFO-ordered deliveryYes Causal atomic multicastCausal-ordered deliveryYes MulticastBasic Message OrderingTotal-Ordered Delivery? Reliable multicastNoneNo FIFO multicastFIFO-ordered deliveryNo Causal multicastCausal-ordered deliveryNo Atomic multicastNoneYes FIFO atomic multicastFIFO-ordered deliveryYes Causal atomic multicastCausal-ordered deliveryYes MulticastBasic Message OrderingTotal-Ordered Delivery? Reliable multicastNoneNo FIFO multicastFIFO-ordered deliveryNo Causal multicastCausal-ordered deliveryNo Atomic multicastNoneYes FIFO atomic multicastFIFO-ordered deliveryYes Causal atomic multicastCausal-ordered deliveryYes MulticastBasic Message OrderingTotal-Ordered Delivery? Reliable multicastNoneNo FIFO multicastFIFO-ordered deliveryNo Causal multicastCausal-ordered deliveryNo Atomic multicastNoneYes FIFO atomic multicastFIFO-ordered deliveryYes Causal atomic multicastCausal-ordered deliveryYes MulticastBasic Message OrderingTotal-Ordered Delivery? Reliable multicastNoneNo FIFO multicastFIFO-ordered deliveryNo Causal multicastCausal-ordered deliveryNo Atomic multicastNoneYes FIFO atomic multicastFIFO-ordered deliveryYes Causal atomic multicastCausal-ordered deliveryYes 21

Distributed Commit  Atomic multicasting problem is an example of a more general problem, known as distributed commit  The distributed commit problem involves having an operation being performed by each member of a process group, or none at all  With reliable multicasting, the operation is the delivery of a message  With distributed transactions, the operation may be the commit of a transaction at a single site that takes part in the transaction  Distributed commit is often established by means of a coordinator and participants 22

One-Phase Commit Protocol  In a simple scheme, a coordinator can tell all participants whether or not to (locally) perform the operation in question  This scheme is referred to as a one-phase commit protocol  The one-phase commit protocol has a main drawback that if one of the participants cannot actually perform the operation, there is no way to tell the coordinator  In practice, more sophisticated schemes are needed  The most common utilized one is the two-phase commit protocol 23

Two-Phase Commit Protocol  Assuming that no failures occur, the two-phase commit protocol (2PC) consists of the following two phases, each consisting of two steps: Phase I: Voting Phase Step 1 The coordinator sends a VOTE_REQUEST message to all participants. Step 2 When a participant receives a VOTE_REQUEST message, it returns either a VOTE_COMMIT message to the coordinator telling the coordinator that it is prepared to locally commit its part of the transaction, or otherwise a VOTE_ABORT message Phase I: Voting Phase Step 1 The coordinator sends a VOTE_REQUEST message to all participants. Step 2 When a participant receives a VOTE_REQUEST message, it returns either a VOTE_COMMIT message to the coordinator telling the coordinator that it is prepared to locally commit its part of the transaction, or otherwise a VOTE_ABORT message Phase I: Voting Phase Step 1 The coordinator sends a VOTE_REQUEST message to all participants. Step 2 When a participant receives a VOTE_REQUEST message, it returns either a VOTE_COMMIT message to the coordinator indicating that it is prepared to locally commit its part of the transaction, or otherwise a VOTE_ABORT message. 24

Phase II: Decision Phase Step 1 Step 2 Two-Phase Commit Protocol Phase II: Decision Phase Step 1 The coordinator collects all votes from the participants. Step 2 Phase II: Decision Phase Step 1 The coordinator collects all votes from the participants. If all participants have voted to commit the transaction, then so will the coordinator. In that case, it sends a GLOBAL_COMMIT message to all participants. Step 2 Phase II: Decision Phase Step 1 The coordinator collects all votes from the participants. If all participants have voted to commit the transaction, then so will the coordinator. In that case, it sends a GLOBAL_COMMIT message to all participants. However, if one participant had voted to abort the transaction, the coordinator will also decide to abort the transaction and multicasts a GLOBAL_ABORT message. Step 2 Phase II: Decision Phase Step 1 The coordinator collects all votes from the participants. If all participants have voted to commit the transaction, then so will the coordinator. In that case, it sends a GLOBAL_COMMIT message to all participants. However, if one participant had voted to abort the transaction, the coordinator will also decide to abort the transaction and multicasts a GLOBAL_ABORT message. Step 2 Each participant that voted for a commit waits for the final reaction by the coordinator. Phase II: Decision Phase Step 1 The coordinator collects all votes from the participants. If all participants have voted to commit the transaction, then so will the coordinator. In that case, it sends a GLOBAL_COMMIT message to all participants. However, if one participant had voted to abort the transaction, the coordinator will also decide to abort the transaction and multicasts a GLOBAL_ABORT message. Step 2 Each participant that voted for a commit waits for the final reaction by the coordinator. If a participant receives a GLOBAL_COMMIT message, it locally commits the transaction. Phase II: Decision Phase Step 1 The coordinator collects all votes from the participants. If all participants have voted to commit the transaction, then so will the coordinator. In that case, it sends a GLOBAL_COMMIT message to all participants. However, if one participant had voted to abort the transaction, the coordinator will also decide to abort the transaction and multicasts a GLOBAL_ABORT message. Step 2 Each participant that voted for a commit waits for the final reaction by the coordinator. If a participant receives a GLOBAL_COMMIT message, it locally commits the transaction. Otherwise, when receiving a GLOBAL_ABORT message, the transaction is locally aborted as well. 25

2PC Finite State Machines INIT WAIT COMMITABORT Commit Vote-request Vote-abort Global-abort Vote-commit Global-commit INIT WAIT COMMITABORT Vote-request Vote-commit Global-abort ACK Global-commit ACK Vote-request Vote-abort The finite state machine for the coordinator in 2PC The finite state machine for a participant in 2PC 26

2PC Algorithm write START_2PC to local log; multicast VOTE_REQUEST to all participants; while not all votes have been collected{ wait for any incoming vote; if timeout{ write GLOBAL_ABORT to local log; multicast GLOBAL_ABORT to all participants; exit; } record vote; } If all participants sent VOTE_COMMIT and coordinator votes COMMIT{ write GLOBAL_COMMIT to local log; multicast GLOBAL_COMMIT to all participants; }else{ write GLOBAL_ABORT to local log; multicast GLOBAL_ABORT to all participants; } Actions by coordinator: 27

Two-Phase Commit Protocol write INIT to local log; Wait for VOTE_REQUEST from coordinator; If timeout{ write VOTE_ABORT to local log; exit; } If participant votes COMMIT{ write VOTE_COMMIT to local log; send VOTE_COMMIT to coordinator; wait for DECISION from coordinator; if timeout{ multicast DECISION_RQUEST to other participants; wait until DECISION is received; /*remain blocked*/ write DECISION to local log; } if DECISION == GLOBAL_COMMIT { write GLOBAL_COMMIT to local log;} else if DECISION == GLOBAL_ABORT {write GLOBAL_ABORT to local log}; }else{ write VOTE_ABORT to local log; send VOTE_ABORT to coordinator; } Actions by participants: 28

Two-Phase Commit Protocol /*executed by separate thread*/ while true{ wait until any incoming DECISION_REQUEST is received; /*remain blocked*/ read most recently recorded STATE from the local log; if STATE == GLOBAL_COMMIT send GLOBAL_COMMIT to requesting participant; else if STATE == INIT or STATE == GLOBAL_ABORT send GLOBAL_ABORT to requesting participant; else skip; /*participant remains blocked*/ } Actions for handling decision requests: 29

Objectives Discussion on Fault Tolerance General background on fault tolerance Process resilience, failure detection and reliable communication Atomicity and distributed commit protocols Recovery from failures

Recovery  So far, we have mainly concentrated on algorithms that allow us to tolerate faults  However, once a failure has occurred, it is essential that the process where the failure has happened can recover to a correct state  In what follows we focus on:  What it actually means to recover to a correct state  When and how the state of a distributed system can be recorded and recovered, by means of checkpointing and message logging 31

Recovery  Error Recovery  Checkpointing  Message Logging 32

Recovery  Error Recovery  Checkpointing  Message Logging 33

Error Recovery  Once a failure has occurred, it is essential that the process where the failure has happened can recover to a correct state  Fundamental to fault tolerance is the recovery from an error  The idea of error recovery is to replace an erroneous state with an error-free state  There are essentially two forms of error recovery: 1.Backward recovery 2.Forward recovery 34

Backward Recovery  In backward recovery, the main issue is to bring the system from its present erroneous state “back” to a previously correct state  It is necessary to record the system’s state from time to time onto a stable storage, and to restore such a recorded state when things go wrong  Each time (part of) the system’s present state is recorded, a checkpoint is said to be made  Some problems with backward recovery:  Restoring a system or a process to a previous state is generally expensive (in terms of performance)  Some states can never be rolled back (e.g., typing in UNIX rm –fr *)

Forward Recovery  When the system detects that it has made an error, forward recovery reverts the system state to error time and corrects it, to be able to move forward  Forward recovery is typically faster than backward recovery but requires that it has to be known in advance which errors may occur  Some systems make use of both forward and backward recovery for different errors or different parts of one error 36

Recovery  Error Recovery  Checkpointing  Message Logging 37

Why Checkpointing?  In fault-tolerant distributed systems, backward recovery requires that systems “regularly” save their states onto stable storages  This process is referred to as checkpointing  Checkpointing consists of storing a “distributed snapshot” of the current application state, and later on, use it for restarting the execution in case of a failure 38

Recovery Line  In capturing a distributed snapshot, if a process P has recorded the receipt of a message, m, then there should be also a process Q that has recorded the sending of m Initial state A snapshot Message sent from Q to P A recovery line Not a recovery line A failure They jointly form a distributed snapshot We are able to identify both, senders and receivers. P Q 39 m

Checkpointing  Checkpointing can be of two types: 1.Independent Checkpointing: each process simply records its local state from time to time in an uncoordinated fashion 2.Coordinated Checkpointing: all processes synchronize to jointly write their states to local stable storages  Which algorithm among the ones we’ve studied can be used to implement coordinated checkpointing?  A simple solution is to use 2PC 40

Domino Effect  Independent checkpointing may make it difficult to find a recovery line, leading potentially to a domino effect resulting from cascaded rollbacks  With coordinated checkpointing, the saved state is automatically globally consistent, hence, domino effect is inherently avoided A failure P Q Not a Recovery Line Rollback Not a Recovery Line 41

Recovery  Error Recovery  Checkpointing  Message Logging 42

Why Message Logging?  Considering that checkpointing is an expensive operation, techniques have been sought to reduce the number of checkpoints, but still enable recovery  An important technique in distributed systems is message logging  The basic idea is that if transmission of messages can be replayed, we can still reach a globally consistent state, yet without having to restore that state from stable storage  In practice, the combination of having fewer checkpoints and message logging is more efficient than having to take many checkpoints 43

Message Logging  Message logging can be of two types: 1.Sender-based logging: A process can log its messages before sending them off 2.Receiver-based logging: A receiving process can first log an incoming message before delivering it to the application  When a sending or a receiving process crashes, it can restore the most recently checkpointed state, and from there on “replay” the logged messages (Is it fine for non-deterministic behaviors?) 44

Replay of Messages and Orphan Processes  Caveat: Incorrect replay of messages after recovery can lead to orphan processes P Q R M1 Logged Message Unlogged Message M2 M3 Q crashes Q recovers M1 M1 is replayed M2 M2 can never be replayed M3 M3 becomes an orphan 45

Objectives Discussion on Fault Tolerance General background on fault tolerance Process resilience, failure detection and reliable communication Atomicity and distributed commit protocols Recovery from failures All Covered!

Next Class Distributed File Systems-Part I Thank You! 47