Lecture23 FaultTolerance
Lecture23 FaultTolerance
CS 15-440
Mohammad Hammoud
1
Today…
Last Session:
Quiz 2
Today’s Session:
Fault Tolerance – Part II
Reliable communication
Announcements:
Project 4 is due on Dec 3rd by midnight
PS5 will be posted by tonight. It is due on Dec 4th by midnight
2
Objectives
Discussion on Fault Tolerance
Recovery from
failures
Atomicity and
distributed
Process commit
resilience, protocols
General failure detection
background on and reliable
fault tolerance communication
Reliable Communication
Fault tolerance in distributed systems typically
concentrates on faulty processes
P1 P0
However, we also need to consider
communication failures
Reliable Communication
5
Request-Reply Communication
The request-reply (RR) communication is designed to support the
roles and message exchanges in typical client-server interactions
Client Server
Request Message
doOperation getRequest
•
• select operation
(wait)
• execute operation
•
(continuation) sendReply
Reply Message
6
Timeout Mechanisms
Request-reply communication may suffer from crash, omission,
timing, and byzantine failures
9
Keeping History
Servers can maintain the execution outcomes of requests in
what is called the history
10
Managing History
The server can interpret each request from a client as an ACK
of its previous reply
Thus, the history needs contain ONLY the last reply message
sent to each client
11
In Summary…
RR protocol can be implemented in different ways to provide
different delivery guarantees. The main choices are:
12
Request-Reply Call Semantics
Combinations of request-reply protocols lead to a variety of possible
semantics for the reliability of remote invocations
13
Reliable Communication
Reliable Communication
14
Reliable Group Communication
As we considered reliable request-reply communication,
we need also to consider reliable multicasting services
1 2
7 3
6 4
15
Reliable Group Communication
A Basic Reliable-Multicasting Scheme
Atomic Multicasting
16
Reliable Group Communication
A Basic Reliable-Multicasting Scheme
Atomic Multicasting
17
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
18
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?
19
A Simple Case: Reliable Multicasting
with Feedback Messages
Consider the case when a single sender S wants to
multicast a message to multiple receivers
20
Reliable Multicasting with Feedback
Messages
Sender Receiver Receiver Receiver Receiver
M25
History
Buffer
Last = 24 Last = 24 Last = 23 Last = 24
Network
ACK25 ACK25
Missed 24 ACK25
22
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
Atomic multicast:
P1
P2
P3
P4
Time
G = {P1, P2, P3, P4} G = {P1, P2, P4} G = {P1, P2, P3, P4}
25
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
26
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
27
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
28
3-4. Causally-Ordered and
Total-Ordered Multicasts
Causally-ordered multicasts preserve potential causality
between different messages
29
Virtually Synchronous Reliable
Multicasting
A virtually synchronous reliable multicasting that offers total-ordered
delivery of messages is what we refer to as atomic multicasting
30
Distributed Commit
Atomic multicasting problem is an example of a more general
problem, known as distributed commit
31
One-Phase Commit Protocol
In a simple scheme, a coordinator can tell all participants
whether or not to (locally) perform the operation in question
32
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:
33
Two-Phase Commit Protocol
Phase II: Decision Phase
• The coordinator collects all votes from the participants.
The finite state machine for the The finite state machine for a
coordinator in 2PC participant in 2PC
35
2PC Algorithm
Actions by coordinator:
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;
} 36
Two-Phase Commit Protocol
Actions by participants:
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;
} 37
Two-Phase Commit Protocol
Actions for handling decision requests:
/*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*/
}
38
Objectives
Discussion on Fault Tolerance
Recovery from
failures
Atomicity and
distributed
Process commit
resilience, protocols
General failure detection
background on and reliable
fault tolerance communication
Recovery
So far, we have mainly concentrated on algorithms that allow us to
tolerate faults
When and how the state of a distributed system can be recorded and
recovered, by means of checkpointing and message logging
40
Recovery
Error Recovery
Checkpointing
Message Logging
41
Recovery
Error Recovery
Checkpointing
Message Logging
42
Error Recovery
Once a failure has occurred, it is essential that the process where
the failure has happened can recover to a correct state
43
Backward Recovery
In backward recovery, the main issue is to bring the system from its
present erroneous state “back” to a previously correct state
45
Recovery
Error Recovery
Checkpointing
Message Logging
46
Why Checkpointing?
In fault-tolerant distributed systems, backward recovery
requires that systems “regularly” save their states onto
stable storages
47
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
m A failure
49
Domino Effect
Independent checkpointing may make it difficult to find a recovery line,
leading potentially to a domino effect resulting from cascaded rollbacks
Rollback
Not a Recovery Line Not a Recovery Line Not a Recovery Line
A failure
50
Recovery
Error Recovery
Checkpointing
Message Logging
51
Why Message Logging?
Considering that checkpointing is an expensive operation,
techniques have been sought to reduce the number of checkpoints,
but still enable recovery
52
Message Logging
Message logging can be of two types:
53
Replay of Messages and
Orphan Processes
Caveat: Incorrect replay of messages after recovery can lead to
orphan processes
Q crashes Q recovers M1 is replayed M3 becomes an
orphan
P
M1 M1
Q
M3 M3
M2 M2
R
Unlogged Message
54
Objectives
Discussion on Fault Tolerance
Recovery from
failures
Atomicity and
distributed
Process commit
resilience, protocols
General failure detection
background on and reliable All Covered!
fault tolerance communication
Next Class
Thank You!
56