Remote procedure call
In distributed computing, a remote procedure call (RPC) is when a computer program causes a procedure (subroutine) to execute in another address space (commonly on another computer on a shared network), which is coded as if it were a normal (local) procedure call, without the programmer explicitly coding the details for the remote interaction. That is, the programmer writes essentially the same code whether the subroutine is local to the executing program, or remote.[1] This is a form of client–server interaction (caller is client, executer is server), typically implemented via a request–response message-passing system. The object-oriented programming analog is remote method invocation (RMI). The RPC model implies a level of location transparency, namely that calling procedures is largely the same whether it is 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 useful.
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.
History and origins
Response–request protocols date to early distributed computing in late 1960s, theoretical proposals of remote procedure calls as the model of network operations date to the 1970s, and practical implementations date to the early 1980s. In the 1990s, with the popularity of object-oriented programming, the alternative model of remote method invocation (RMI) was widely implemented, such as in Common Object Request Broker Architecture (CORBA, 1991) and Java remote method invocation. RMIs in turn fell in popularity with the rise of the internet, particularly in the 2000s.
Remote procedure calls used in modern operating systems trace their roots back to the RC 4000 multiprogramming system,[2] which used a request-response communication protocol for process synchronization.[3] The idea of treating network operations as remote procedure calls goes back at least to the 1970s in early ARPANET documents.[4] In 1978, Per Brinch Hansen proposed Distributed Processes, a language for distributed computing based on "external requests" consisting of procedure calls between processes.[5]
Bruce Jay Nelson is generally credited with coining the term "remote procedure call" (1981),[6] and the first practical implementation was by Andrew Birrel and Bruce Nelson, called Lupine, in the Cedar environment at Xerox PARC.[7][8][9] Lupine automatically generated stubs, providing type-safe bindings, and used an efficient protocol for communication.[8] 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
RPC is a kind of 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 XHTTP call. There are many variations and subtleties in various implementations, resulting in a variety of different (incompatible) RPC protocols.
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 an 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 client's local operating system sends the message from the client machine to the server machine.
- The local operating system on the server machine passes the incoming packets to the server stub.
- The server stub unpacks the parameters from the message. Unpacking the parameters is called unmarshalling.
- 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 servers.
Other RPC analogues
Notable RPC implementations and analogues include:
- Open Network Computing Remote Procedure Call, by Sun Microsystems
- D-Bus open source IPC program provides similar function to CORBA.
- Java's Java Remote Method Invocation (Java RMI) API provides similar functionality to standard Unix RPC methods.
- SORCER provides the API and exertion-oriented language (EOL) for a federated method invocation
- Modula-3's network objects, which were the basis for Java's RMI[10]
- 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
- JSON-WSP 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.
- RPyC implements RPC mechanisms in Python, with support for asynchronous calls.
- Spyne defines primitives for doing RPC in Python. It also contains implementations of some of the most popular protocols and transports.[11]
- Pyro object-oriented form of RPC for Python.
- ZeroC's Internet Communications Engine (Ice) distributed computing platform.
- Delta V Software's Remote Call Framework[12]
- Etch framework for building network services.
- Apache Thrift protocol and framework.
- BERT-RPC is an RPC protocol in use by GitHub [13][14]
- CORBA provides remote procedure invocation through an intermediate layer called the object request broker.
- Distributed Ruby (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.
- Action Message Format (AMF) allows Adobe Flex applications to communicate with back-ends or other applications that support AMF.
- Libevent provides a framework for creating RPC servers and clients.[15]
- Windows Communication Foundation is an application programming interface in the .NET framework for building connected, service-oriented applications.
- Microsoft .NET Remoting offers RPC facilities for distributed systems implemented on the Windows platform. It has been superseded by WCF.
- The Microsoft DCOM uses MSRPC which is based on DCE/RPC
- The Open Software Foundation DCE/RPC Distributed Computing Environment (also implemented by Microsoft).
- Google Protocol Buffers (protobufs) package includes an interface definition language used for its RPC protocols.[16]
- Google Web Toolkit uses an asynchronous RPC to communicate to the server service.[17]
- Apache Avro provides RPC where client and server exchange schemas in the connection handshake and code generation is not required.
- Spike-Engine provides cross platform RPC facilities for .NET framework, web and mobile architectures with auto-generated stubs.
- Twitter Finagle is a network stack for the JVM that you can use to build asynchronous Remote Procedure Call (RPC) clients and servers in Java, Scala, or any JVM-hosted language.
- SAP Remote Function Call (RFC) is the standard SAP interface for communication between SAP systems. RFC calls a function to be executed in a remote system.
- Elixir (programming language) builds on top of the Erlang VM and allows process communication (Elixir/Erlang processess, not OS processes) of the same network out-of-the-box via Agents and message passing.
- Hottentot RPC Framework provides both Serialization and RPC Stub Generation for C++ and Java programming languages. The project has begun in 2015 and it is currently hosted on GitHub at "Hottentot RPC Framework Github Page". Hottentot RPC Framework. Retrieved April 15, 2016. Support for C, Python and Embedded C is being developed.
See also
- JSON-RPC the "JSON encoded" RPC variant.
- XML-RPC the "XML encoded" RPC variant.
- 9P
- Microsoft RPC
- Local Procedure Call
- SOAP
- HTTP
- ODBC
- Remote function call
- Remote evaluation
- External Data Representation
- ROA (Resource-oriented architecture)
- Distributed object middleware
- Java remote method invocation
- Elixir (programming language)
- Hottentot RPC Framework
Notes
- ↑ Arpaci-Dusseau, Remzi H.; Arpaci-Dusseau, Andrea C. (2014), Introduction to Distributed Systems (PDF) 0911, Arpaci-Dusseau Books, pp. arXiv:0911.4395, arXiv:0911.4395 [cs.DC], Bibcode:2009arXiv0911.4395T
- ↑ "Per Brinch Hansen • IEEE Computer Society". www.computer.org. Retrieved 2015-12-15.
- ↑ Brinch Hansen, Per (1969). RC 4000 Computer Software: Multiprogramming System (PDF). Copenhagen, Denmark: Regnecentralen.
- ↑ Anand M. White (December 23, 1975). "A High-Level Framework for Network-Based Resource Sharing". RFC 707. Augmentation Research Center. Retrieved July 11, 2011.
- ↑ Brinch Hansen, Per (November 1978). "Distributed processes: a concurrent programming concept" (PDF). Communications of the ACM.
- ↑ Bruce Jay Nelson (May 1981). Remote Procedure Call. PARC CSL-81-9 (Also CMU-CS-81-119) (Xerox Palo Alto Research Center). PhD thesis.
- ↑ Birrell, Andrew D.; Nelson, Bruce Jay (1984). "Implementing remote procedure calls". ACM Transactions on Computer Systems 2: 39. doi:10.1145/2080.357392.
- 1 2 "1994 – Andrew Birrell, Bruce Nelson: Remote Procedure Call". Software System Award citation. Association for Computing Machinery. Retrieved July 11, 2011.
- ↑ "SIGOPS Hall of Fame Award". Special Interest Group on Operating Systems. Association for Computing Machinery. Retrieved July 11, 2011.
- ↑ The A-Z of Programming Languages: Modula-3 - a-z of programming languages. Computerworld. Retrieved on 2013-07-17.
- ↑ "Spyne". Spyne Website. Retrieved Feb 1, 2013.
- ↑ "RCF Remote Call Framework by Delta V Software". Deltasoft Website. Retrieved October 14, 2015.
- ↑ "Introducing bert and bert rpc". Github blog. Retrieved July 17, 2012.
- ↑ "How we made GitHub fast". Github blog. Retrieved July 17, 2012.
- ↑ libevent: Main Page. Monkey.org. Retrieved on 2013-07-17.
- ↑ "Protocol Buffers - Google's data interchange format". Google project website. Retrieved November 1, 2011.
- ↑ "Google Web Toolkit". Google project website. Retrieved November 1, 2011.
External links
- RFC 1057 - Specifies version 1 of ONC RPC
- RFC 5531 - Specifies version 2 of ONC RPC
- Remote Procedure Calls (RPC) — A tutorial on ONC RPC by Dr Dave Marshall of Cardiff University
- Introduction to RPC Programming — A developer's introduction to RPC and XDR, from SGI IRIX documentation.