Remote procedure call
Remote procedure call
In computer science, a remote procedure call (RPC) is an inter-process communication that allows a computer program to cause a subroutine or procedure to execute in another address space (commonly on another computer on a shared network) without the programmer explicitly coding the details for this remote interaction. That is, the programmer writes essentially the same code whether the subroutine is local to the executing program, or remote. When the software in question uses object-oriented principles, RPC is called remote invocation or remote method invocation.
Many different (often incompatible) technologies can be used to implement the concept.
| Internet Protocol Suite | |
|---|---|
| Application Layer | |
| BGP · DHCP · DNS · FTP · HTTP · IMAP · IRC · LDAP · MGCP · NNTP · NTP · POP · RIP · RPC · RTP · SIP · SMTP · SNMP · SOCKS · SSH · Telnet · TLS/SSL · XMPP · (more) | |
| Transport Layer | |
| TCP · UDP · DCCP · SCTP · RSVP · ECN · (more) | |
| Internet Layer | |
| IP (IPv4, IPv6) · ICMP · ICMPv6 · IGMP · IPsec · (more) | |
| Link Layer | |
| ARP/InARP · NDP · OSPF · Tunnels (L2TP) · PPP · Media Access Control (Ethernet, DSL, ISDN, FDDI) · (more) | |
Contents |
History and origins
The idea of treating computer network operations as remote procedure calls goes back at least to the 1970s in early ARPANET documents. Bruce Jay Nelson is generally credited with coining the term. One of the first business uses of RPC was by Xerox under the name "Courier" in 1981. The first popular implementation of RPC on Unix was Sun's RPC (now called ONC RPC), used as the basis for Network File System.
Message passing
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. There are many variations and subtleties in various implementations, resulting in a variety of different (incompatible) RPC protocols. While the server is processing the call, the client is blocked (it waits until the server has finished processing before resuming execution).
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.
Sequence of events during a RPC
- The client calls the client stub. The call is a local procedure call, with parameters pushed on to the stack in the normal way.
- The client stub packs the parameters into a message and makes a system call to send the message. Packing the parameters is called marshalling.
- The kernel sends the message from the client machine to the server machine.
- The kernel passes the incoming packets to the server stub.
- Finally, the server stub calls the server procedure. The reply traces the same steps in the reverse direction.
Standard contact mechanisms
To let different clients access servers, a number of standardized RPC systems have been created. Most of these use an interface description language (IDL) to let various platforms call the RPC. The IDL files can then be used to generate code to interface between the client and server. The most common tool used for this is RPCGEN.
Other RPC analogues
RPC analogues found elsewhere:
- Java's Java Remote Method Invocation (Java RMI) API provides similar functionality to standard UNIX RPC methods.
- Modula-3's network objects, which were the basis for Java's RMI
- XML-RPC is an RPC protocol that uses XML to encode its calls and HTTP as a transport mechanism.
- JSON-RPC is an RPC protocol that uses JSON-encoded messages
- SOAP is a successor of XML-RPC and also uses XML to encode its HTTP-based calls.
- Microsoft .NET Remoting offers RPC facilities for distributed systems implemented on the Windows platform.
- RPyC implements RPC mechanisms in Python, with support for asynchronous calls.
- Pyro object-oriented form of RPC for Python.
- ZeroC's Internet Communications Engine (Ice) distributed computing platform.
- Etch (protocol) framework for building network services.
- Facebook's Thrift protocol and framework.
- CORBA provides remote procedure invocation through an intermediate layer called the object request broker.
- DRb allows Ruby programs to communicate with each other on the same machine or over a network. DRb uses remote method invocation (RMI) to pass commands and data between processes.
- AMF allows Flex applications to communicate with back-ends or other applications that support AMF.
- Libevent provides a framework for creating RPC servers and clients.
- Windows Communication Foundation is an application programming interface in the .NET framework for building connected, service-oriented applications.
- Android (operating system) uses an asynchronous RPC for one activity to invoke another.
- GWT (Java base web UI development interface ) uses an asynchronous RPC to communicate the server service.
Web
See also
- Local Procedure Call
- SOAP
- HTTP
- ODBC
- Remote function call
- External Data Representation
- ROA (Resource-oriented architecture)
- ^ James E. White (December 23, 1975). "A High-Level Framework for Network-Based Resource Sharing". RFC 707. Augmentation Research Center. http://tools.ietf.org/html/rfc707. Retrieved July 11, 2011.
- ^ "1994 – Andrew Birrell, Bruce Nelson: Remote Procedure Call". Software System Award citation. Association for Computing Machinery. http://awards.acm.org/citation.cfm?id=5125494&srt=all&aw=149&ao=SOFTWSYS&yr=1994. Retrieved July 11, 2011.
- ^ "SIGOPS Hall of Fame Award". Special Interest Group on Operating Systems. Association for Computing Machinery. http://www.sigops.org/award-hof.html. Retrieved July 11, 2011.
- ^ Bruce Jay Nelson (May 1981). Remote Procedure Call. Xerox Palo Alto Research Center. PhD thesis.
- ^ http://www.computerworld.com.au/index.php/id;1422447371;pp;3;fp;4194304;fpid;1
- ^ http://www.monkey.org/~provos/libevent/doxygen-1.4.10/
This article was originally based on material from the Free On-line Dictionary of Computing, which is licensed under the GFDL.
