Skip to content
SEE Exam Prep

Question 14 of 15 · CIE-1 QB · CIE-1 paper · 7 marks

Open in ChatGPT

What is Reliable RPC? Explain how it handles the problem of lost requests and lost replies.


Introduction

Plain RPC hides the network, but the network fails: a request can be lost, a reply can be lost, or the server can crash after executing. Reliable RPC is RPC that gives the caller a defined answer in each of those cases instead of hanging.

The four failure cases

  1. The request is lost before reaching the server.
  2. The server receives the request and the reply is lost.
  3. The server crashes before executing.
  4. The server crashes after executing but before replying.

The client cannot distinguish case 2 from case 3, which is the whole difficulty.

Handling lost requests and lost replies

The client sets a timeout and retransmits. On the server side:

  1. Every request carries a client identifier and a sequence number.
  2. The server keeps a reply cache keyed by that pair.
  3. On a duplicate request the server finds the cached reply and returns it without executing again.
  4. Retransmissions stop after a fixed number of attempts (a bounded window), after which the client reports failure.

This gives at-most-once semantics: the operation runs at most once, and a retransmission receives the original answer.

Handling server crashes

  • If the server crashed before executing, the client's retransmission reaches the restarted server and the call succeeds, provided the cache was not needed.
  • If the server crashed after executing, it must recover the reply from stable storage (logging the sequence number and reply, or checkpointing the state) or the client's retry will execute the call a second time.
  • The server must also notify clients that it restarted, so that clients discard stale expectations and resend with a fresh session.

Diagram

request (id, seq 7)reply lostrequest (id, seq 7)cached replyexecutes, caches replytimeoutClientServerClientServer

Conclusion

Reliable RPC is timeouts plus retransmission plus duplicate suppression, backed by stable storage for the reply. Retries make it robust to lost packets; the reply cache and the sequence number make it safe against lost replies; persistence makes it safe against crashes.