Upload
others
View
68
Download
0
Embed Size (px)
Citation preview
Koo-Toueg coordinated checkpointing
algorithm
β’A coordinated checkpointing and recovery
technique that takes a consistent set of
checkpointing and avoids domino effect and
livelock problems during the recovery
β’Includes 2 parts: the checkpointing
algorithm and the recovery algorithm
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
1
Koo-Toueg coordinated checkpointingalgorithm(cont.)
β’ Checkpointing algorithmβ Assumptions: FIFO channel, end-to-end protocols,
communication failures do not partition the network, single process initiation, no process fails during the execution of the algorithm
β Two kinds of checkpoints: permanent and tentativeβ’ Permanent checkpoint: local checkpoint, part of a
consistent global checkpoint
β’ Tentative checkpoint: temporary checkpoint, becomepermanent checkpoint when the algorithm terminatessuccessfully
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
2/31
Koo-Toueg coordinated checkpointingalgorithm(cont.)
β’ Checkpointing algorithmβ 2 phases
β’ The initiating process takes a tentative checkpoint and requests all other processes to take tentative checkpoints. Every process can not send messages after taking tentative checkpoint. All processes will finally have the single same decision: do or discard
β’ All processes will receive the final decision from initiating processand act accordingly
β Correctness: for 2 reasonsβ’ Either all or none of the processes take permanent checkpoint
β’ No process sends message after taking permanent checkpoint
β Optimization: maybe not all of the processes need to takecheckpoints (if not change since the last checkpoint)
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
3/31
Koo-Toueg coordinated checkpointingalgorithm(cont.)
β’ The rollback recovery algorithmβ Restore the system state to a consistent state after a
failure with assumptions: single initiator, checkpoint and rollback recovery algorithms are not invoked concurrently
β 2 phasesβ’ The initiating process send a message to all other processes
and ask for the preferences β restarting to the previous checkpoints. All need to agree about either do or not.
β’ The initiating process send the final decision to all processes, all the processes act accordingly after receiving the final decision.
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
4/31
Koo-Toueg coordinated checkpointingalgorithm(cont.)
β’ Correctness: resume from a consistent state
β’ Optimization: may not to recover all, since some of the processes did not change anything
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
5/31
Juang-Venkatesan algorithm for asynchronouscheckpointing and recovery
β’ Assumptions: communication channels are reliable, delivery messages in FIFO order, infinite buffers, message transmission delay is arbitrary but finite
β’ Underlying computation/application is event-driven: process P is at state s, receives message m, processes the message, moves to state sβ and send messages out. So the triplet (s, m, msgs_sent) represents the state of P
β’ Two type of log storage are maintained:
β Volatile log: short time to access but lost if processor crash. Move to stable log periodically.
β Stable log: longer time to access but remained if crashed
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
6/31
Juang-Venkatesan algorithm for asynchronous
checkpointing and recovery(cont.)
β’ Asynchronous checkpointing:β After executing an event, the triplet is recorded without any
synchronization with other processes.β Local checkpoint consist of set of records, first are stored in volatile
log, then moved to stable log.
β’ Recovery algorithmβ Notations:
β’ π πΆππ·πβπ (πΆπππ‘π ): number of messages received by ππ from ππ , from the beginning of computation to checkpoint πΆπππ‘π
β’ ππΈπππβπ (πΆπππ‘π): number of messages sent by ππ to ππ , from the beginning of computation to checkpoint πΆπππ‘πβ Idea:
β’ From the set of checkpoints, find a set of consistent checkpoints
β’ Doing that based on the number of messages sent and received
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
7/31
Juang-Venkatesan algorithm for asynchronous
checkpointing and recovery(cont.)
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
8
Juang-Venkatesan algorithm for asynchronous
checkpointing and recovery(cont.)
β’ Example
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
9
Manivannan-Singhal algorithm
β’ Observation: there are some checkpoints useless (i.e. never included in any consistent global checkpoint), even none of them are useful
β’ Combine the coordinated and uncoordinated checkpointing approachesβ Take checkpoint asynchronously
β Use communication-induced checkpointing to eliminates the useless checkpointβ Every checkpoint lies on a consistent checkpoint, determine the recovery
β’ line is easy and fast
β’ Ideaβ Each checkpoint of a process has a unique sequence number β local number, increased
periodicallyβ When a process send out a message, its sequence number is piggybacked
β When a process received a message, if the received sequence number > its sequence number, it is forced to take checkpoint, and any basic checkpointing with smaller sequence number is skipped
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
10/31
Manivannan-Singhal β Checkpointing Alg. (1)
β’ Checkpointing algorithm
β Checkpoints satisfy the following interesting properties
β’ Ci,m of Pi is concurrent with C*, m of all other processes
β’ Checkpoints C*,m of all processes form a consistent global checkpoint
β’ Checkpoint Ci,m of Pi is concurrent with earliest checkpoint Cj, n
with m β€ n
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
11/31
Manivannan-Singhal β Checkpointing Alg. (2)
For a forced
checkpoint
For a basic
checkpoint
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
12/31
Manivannan-Singhal β Checkpointing Ex
β’ M1 forces P2 to take a forced checkpoint with sequence number
3 before processing M1 because M1.sn> sn2
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
13/31
Manivannan-Singhal β Recovery Alg. (1)
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
14
Manivannan-Singhal β Recovery Alg. (2)
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
15
Manivannan-Singhal β Recovery Ex
β’ When π3 recovers,
β broadcast rollback(inc3, rec_lin3) where inc3 = 1 and rec_line3 = 5
β π2 rollback to πΆ2,5
β π1 does not have a checkpoint with sequence number β₯ 5. So it takes
a local check point and assign 5 as its sequence number
πΆ1,5
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
16/31
Activity
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
17/31
Manivannan-Singhal quasi-synchronouscheckpointing algorithm(cont.)
β’ Comprehensive handling messages during recoveryβ Handling the replay of messages
β Handle of received messages
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
18/31
Peterson-Kearns algorithm β Definition (1)
β’ Based on optimistic recovery protocol
β’ Rollback based on vector time
β’ Ring configuration : each processor knows its successor on the ring
β’ Each process ππ has a vector clock ππ [π], 0 β€ j β€ N-1
β’ ππ (ππ) : the clock value of an event ππ which occurred at ππβ’ ππ (ππ) : the current vector clock time of ππ and ππ denotes the most
recent event in ππ, thus ππ (ππ) = ππ (ππ)
β’ ππ : i th event on ππ
β’ s : A send event of the underlying computation
β’ π(π ) : The process where send event s occurs
β’ π(s) : The process where the receive event matched with send event s
occurs
β’ ππ : The i th failure on ππ
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
19/31
Peterson-Kearns algorithm β Definition (2)
β’ πππ : The i th state checkpoint on ππ . The check point resides on
the
stable stoarge
β’ ππ π : The i th restart event on ππ
β’ πππ : The i th rollback event on ππ
β’ LastEvent (ππ ) = π iff π β¦ ππ π
β’
π β² β² π
πΆπ ,π (π) : The arrival of the final polling wave message for rollbackfrom failure ππ at process ππβ’π€π,π(π) : The response to this final polling wave by ππ. If no response is required, π€π,π(π) = πΆπ,π (π)
π
β’ The final polling wave for recovery from failure ππ :π
πππ (π) = πβ1 π€π,π(π) πβ1 πΆπ=0 π=0π ,π
(π)
β’ tk(i, m).ts : the token with failure ππ and restart event ππ πβ’ tk(i, m).inc : incarnation number of in the token
π π
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
20/31
Peterson-Kearns Alg. β Informal Description (1)
β’ Step 1
β When a process ππ restarts after failure, it retrieves its latest
checkpoint, including its vector time value, and roll back to it
β’ Step 2
β The message log is replayed
β’ Step 3
β The recovering process executes a restart event ππ π to begin the
global rollback protocol
β creates a token message containing the vector timestamp of the restart event
β sends the token to its successor process
π
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
21/31
Peterson-Kearns Alg. β Informal Description (2)
β’ Step 4
β The token is circulated through all the processes on the ring
(propagation rule : from ππ to π π+1 πππ
π)β When the token arrives at process ππ , the timestamp in the token
is used to determine whether ππ must roll back
If tk(i, m).ts < ππ (ππ),
then ππ must roll back to an earlier state because an orphan event has
occurred at ππ
Otherwise, the state of ππ is not changed
β’ Step 5
β When the token returns to the originating process, the roll back
recovery is complete
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
22/31
Peterson-Kearns Alg. β Formal Description (1)
β’ described as set of six rules, CRB1 to CRB6
β’ CRB1
β A formerly failed process creates and propagates a token, event
π€π,π(π), only after restoring the state from the latest checkpoint and
executing the message log from the stable storage
β’ CRB2
β The restart event increments the incarnation number at the recovering process, and the token carries the vector timestamp of the restart event and the newly incremented incarnation number
β’ CRB3
β A non-failed process will propagate the token only after it has
rolled back
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
23/31
Peterson-Kearns Alg. β Formal Description (2)
β’ CRB4
β A non-failed process will propagate the token only after it has
incremented its incarnation number and has stored the vector
timestamp of the token and the incarnation number of the token in
its OrVect set
β’ CRB5
β When the process that failed, recovered, and initiated the token,
receives its token back, the rollback is complete
β’ CRB6
β Messages that were in transit and which were orphaned by the
failure and subsequent restart and recovery must be discarded
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
24/31
Peterson-Kearns - example
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
25
Helary-Mostefaoui-Netzer-Raynal protocol (1)
β’ Communication-induced checking protocol
β’ Some coordination is required in taking local checkpoints
β’ Achieve the coordination by piggybacking control information on
application messages
β’ Basic checkpoints
β Processes take local checkpoints independently
β’ Forced checkpoints
β The protocol directs processes to take additional local checkpoints
β A process takes a forces checkpoint when it receives a message and its predicate becomes true
β’ No local checkpoint is useless
β’ Takes as few forced checkpoints as possible
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
26/31
Helary-Mostefaoui-Netzer-Raynal protocol (2)
β’ Based on Z-path and Z-cycle theory
β A useless checkpoint exactly corresponds to the existence of a Z-
cycle in the distributed computation
β The protocol prevents Z-Cycles
β’ A Z-path exists from local check point A to local checkpoint B iff (i)A precedes B in the same process, or (ii) a sequence of message [π1,
π2, . . . , ππ] (q β₯ 1) exists such that
β (1) A precedes send(π¦π) in the same process, and
β (2) for each π¦π’, i < q, delivery(π¦π’) is in the same or earlier interval as send(π¦π’+π), and
β (3) delivery(π¦πͺ) precedes B in the same process
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
27/31
Helary-Mostefaoui-Netzer-Raynal protocol (3)
β’ A Z-path from a local checkpoint πΆπ,π₯ to the same local checkpoint
πΆπ,π₯ is called a Z-cycle (i.e., it involves the local checkpoint πΆπ,π₯)
β’ In a Z-path [π1, π2, . . . , ππ], two consecutive messages ππΌ and
ππΌ+1 form a Z-pattern iff send(ππΌ+1) β delivery(ππΌ)
β’ Theorem : For any pair of checkpoints πΆπ,π¦ and πΆπ,π§, such that there is
a Z-path from πΆπ,π¦ to πΆπ,π§, πΆπ,π¦. π‘ < πΆπ,π§. π‘ implies that there is no Z-
cycle
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
28/31
H-M-N-R protocol β Z-path & Z-cycle ex.
β’ [π3, π2] is a Z-path from πΆπ,0 to πΆπ,2
β’ [π5, π4] and [π5, π6] are two Z-paths from πΆπ,2 to πΆπ,2
β’ [π3, π2] and [π5, π4] are two Z-patterns
β’The Z-path [π7, π5, π6] is a Z-cycle that involves the local
checkpoint πΆπ,2CS8603 -Distributed Systems-Algorithm for asynchronous
checkpointing and recovery29/31
H-M-N-R protocol β forced checkpoints ex.
β’ (a) ππ. π β€ ππ. π : πΆπ,π¦. π‘ < π1. π‘ < π2. π‘ < πΆπ,π§. π‘ . Hence, the Z-
pattern [π1, π2] is consistent with the assumption of the above
theorem
β’ (b) ππ. π > ππ. π : A safe strategy to prevent Z-cycle formation is
to direct ππ to take a forced checkpoint πΆπ,π₯ before delivering π1.
This βbreaksβ [π1, π2], so it is no longer a Z-pattern
β’ How to implement βtaking a forced checkpointβ?
β ππ takes a forced checkpoint if C is true, where
C β‘ (β k: π πππ‘_π‘ππ π β§ π1. π‘ > πππ_π‘ππ π )CS8603 -Distributed Systems-Algorithm for asynchronous
checkpointing and recovery30/31
Helary-Mostefaoui-Netzer-Raynal protocol β Alg.
CS8603 -Distributed Systems-Algorithm for asynchronous checkpointing and recovery
31