Remote Procedure Call (RPC)

Remote Procedure Call (RPC)

In distributed computing, Remote Procedure Call (RPC) is a protocol that one program can use to request a service from a program located in another computer on a network without having to understand the network’s details. RPC may be a message-passing programming technology developed by Sun Microsystems and extended by the Open Software Foundation (OSF) that enables an application to execute procedures and interact with services on a remote computer on the network.

Remote procedure calls (RPCs) are the preferred method of enabling client/server processing on the Microsoft Windows Server platforms, and Microsoft’s implementation of RPC functionality is compatible with that of other implementations, such as those for the IBM AIX, HP-UX, and Sun Solaris operating systems.

The RPC model implies a level of location transparency, namely that calling procedures are largely the same whether they are local or remote, but usually, they are not identical, so local calls can be distinguished from remote calls. Remote calls are usually orders of magnitude slower and less reliable than local calls, so distinguishing them is important. RPCs are a form of inter-process communication (IPC), in that different processes have different address spaces: if on the same host machine, they have distinct virtual address spaces, even though the physical address space is the same; while if they are on different hosts, the physical address space is different. Many different (often incompatible) technologies have been used to implement the concept.

RPC uses the client-server model. The requesting program is a client, and the service-providing program is the server. Like a regular or local procedure call, an RPC is a synchronous operation requiring the requesting program to be suspended until the results of the remote procedure are returned. However, the use of lightweight processes or threads that share the same address space enables multiple RPCs to be performed concurrently.

Remote Procedure Call (RPC) is analogous to a function call. Like a function call, when an RPC is made, the calling arguments are passed to the remote procedure and the caller waits for a response to be returned from the remote procedure. The figure above shows the flow of activity that takes place during an RPC call between two networked systems. The client makes a procedure call that sends a request to the server and waits. The thread is blocked from processing until either a reply is received, or it times out. When the request arrives, the server calls a dispatch routine that performs the requested service and sends the reply to the client. After the RPC call is completed, the client program continues. RPC specifically supports network applications.

RPC is a request-response protocol. An RPC is initiated by the client, which sends a request message to a known remote server to execute a specified procedure with supplied parameters. The remote server sends a response to the client, and the application continues its process. While the server is processing the call, the client is blocked (it waits until the server has finished processing before resuming execution), unless the client sends an asynchronous request to the server, such as an XMLHttpRequest. There are many variations and subtleties in various implementations, resulting in a variety of different (incompatible) RPC protocols.

RPC is especially well suited for client-server (e.g. query-response) interaction in which the flow of control alternates between the caller and callee. Conceptually, the client and server do not both execute at the same time. Instead, the thread of execution jumps from the caller to the callee and then back again. In the course of an RPC call, client-side and server-side run-time systems’ code handle binding, establish communications over an appropriate protocol, pass call data between the client and server, and handle communications errors.

Remote Procedure Call (RPC) is uniquely identified by program number, version number, and procedure number. The program number identifies a group of related remote procedures, each of which has a unique procedure number. A program may consist of one or more versions. Each version consists of a collection of procedures that are available to be called remotely. Version numbers enable multiple versions of an RPC protocol to be available simultaneously. Each version contains a number of procedures that can be called remotely. Each procedure has a procedure number.

An important difference between remote procedure calls and local calls is that remote calls can fail because of unpredictable network problems. Also, callers generally must deal with such failures without knowing whether the remote procedure was actually invoked. Idempotent procedures (those that have no additional effects if called more than once) are easily handled, but enough difficulties remain that code to call remote procedures is often confined to carefully written low-level subsystems.

There are several RPC models and distributed computing implementations. A popular model and implementation is the Open Software Foundation’s (OSF) Distributed Computing Environment (DCE). The Institute of Electrical and Electronics Engineers (IEEE) defines RPC in its ISO Remote Procedure Call Specification, ISO/IEC CD 11578 N6561, ISO/IEC, November 1991.

RPC spans the transport layer and the application layer in the Open Systems Interconnection (OSI) model of network communication. RPC makes it easier to develop an application that includes multiple programs distributed in a network. Alternative methods for client-server communication include message queueing and IBM’s Advanced Program-to-Program Communication (APPC).

There are five types of Remote Procedure Call (RPC):

  • The normal method of operation where the client makes a call and doesn’t continue until the server returns the reply.
  • The client makes a call and continues with its own processing. The server doesn’t reply.
  • A facility for sending several client nonblocking calls in one batch.
  • RPC clients have a broadcast facility, i.e., they can send messages to many servers and then receive all the resulting replies.
  • The client makes a nonblocking client/server call; the server signals the call is completed by calling a procedure associated with the client.

Remote Procedure Call (RPC) provides ABSTRACTION i.e. message-passing nature of network communication is hidden from the user. It often omits many of the protocol layers to improve performance. Even a small performance improvement is important because a program may invoke RPCs often. RPC enables the usage of the applications in the distributed environment, not only in the local environment. With RPC code re-writing/re-developing effort is minimized. Process-oriented and thread oriented models supported by RPC.


Information Sources:

  4. wikipedia