Thursday, 4 December 2014

Again considering the RPC mechanism, consider the “exactly once” semantic. Does the algorithm for implementing this semantic execute correctly even if the “ACK” message back to the client is lost due to a network problem? Describe the sequence of messages and whether "exactly once" is still preserved.

The “exactly once” semantics ensure that a remore procedure will be executed exactly once and only once. The general algorithm for ensuring this combines an acknowledgment (ACK) scheme combined with timestamps (or some other incremental counter that allows the server to distinguish between duplicate messages). The general strategy is for the client to send the RPC to the server along with a timestamp. The client will also start a timeout clock. The client will then wait for one of two occurrences: 
(1) it will receive an ACK from the server indicating that the remote procedure was performed, or 
(2) it will time out. If the client times out, it assumes the server was unable to perform the remote procedure so the client invokes the RPC a second time, sending a later timestamp. The client may not receive the ACK for one of two reasons: 
(1) the original RPC was never received by the server, or 
(2) the RPC was correctly received—and performed—by the server but the ACK was lost. In situation 
(1), the use of ACKs allows the server ultimately to receive and perform the RPC. In situation 
(2), the server will receive a duplicate RPC and it will use the timestamp to identify it as a duplicate so as not to perform the RPC a second time. It is important to note that the server must send a second ACK back to the client to inform the client the RPC has been performed.

No comments:

Post a Comment