Remote Procedure Call
What is Remote Procedure Call?
In short, Remote Procedure Call (RPC) means allowing a program (caller) to call procedures located on other machines (callee). Caller sends an identifier of the procedure and parameters to the callee. The callee executes the procedure and sends the return value (if any) to the caller.
RPC acts as a middleware in between the OS and the application across many machines on a network.
Goal
The goal of RPC is transparency: the calling procedure should not be aware that the called procedure is executing on a different machine or vice versa. In other word, we want a remote procedure call to look like a local procedure call as much as possible.
How RPC Works
The client has a client stub and the server has a server stub. A remote procedure call is summarized as the following:
The client procedure calls the client stub in the normal way.
The client stub builds a message and calls the local operating system.
The client's OS sends the message to the remote OS.
The remote OS gives the message to the server stub.
The server stub unpacks the parameter(s) and calls the server.
The server does the work and returns the result to the stub.
The server stub packs the result in a message and calls its local OS.
The server's OS sends the message to the client's OS.
The client's OS gives the message to the client stub.
The stub unpacks the result and returns it to the client.
Variations on RPC
Asynchronous RPC
The server immediately sends a reply back to the client the moment the RPC request is received, after which it locally calls the requested procedure.
The client will continue without further blocking as soon as it has received the server's acknowledgment.
Multicast RPC
The client sends an RPC request to a group of servers
Last updated