190 likes | 198 Views
Learn about Remote Procedure Calls (RPC) and how they make distributed computing easier by transferring control and data across networks. Explore RPC structure, design issues, user and server tasks, and network protocols.
E N D
Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to: Philip Howard Christopher Holm Implementing Remote Procedure Calls
Remote Procedure Calls Make Distributed Computing easier
Application invokes (remote) procedure and suspends Parameters are passed across the network to remote Server The remote Server executes the procedure Results are returned to calling application Application resumes as if result returned from a local procedure call What is a Remote Procedure Call?
Procedure calls are: well known and therefore easily understood It is a Mechanism for transfer of control and data within a running program on a single computer Same mechanism can be used to transfer control and data across a network Why RPC
Semantics of a call in the presence of remote machine or communication failures. Procedure calls that pass data by reference Machine Architecture differences: byte order Binding: what Servers are available and where Network Packet transmission Protocol, Security RPC Design Issues
User application And Server application Written by developer Could compile and link as a single program User and Server Stubs User creates interface definition RPC generation tool use to create stubs(Lupine) RPCruntime is existing part of system RPC Structure
Export Interface Register Interface Services requests May report Server errors to User application. Server Application Tasks
Bind to Server Client imports the interface exported by server Makes (remote) procedure calls as normal Handles remote machine and communication failures. User Application Tasks
Packing parameters into one or more packets Marshalling Calls RPCruntime to send packets to server Receive result packets from RPCruntime, Unpacks result and returns to User application Unmarshalling User Stub Task
Receive packets from RPCruntime Unpacks parameters Dispatches procedure call to Server application Packs returned result (Marshalling) Call RPCruntime to return result to user application Server Stub Task
RPC Structure Caller User User Stub RPCRuntime Network Send packet Procedure call Packarguments Transmit packet(s) Unpackresult(s) Receive packet(s) procedure return Receive packet importer exporter Callee Threaded Interface RPCRuntime Server Stub Server Network Receive packet Unpackarguments Procedure call Receivepacket(s) Transmitpacket(s) Packresult(s) Send packet Procedure return importer exporter Event Driven Interface
Server exports interface Notifies RPCRuntime of Service Table array: Interface Name, Dispatcher, ID Registers Service in Database Type, Instance Binding Process(Server) Callee RPCRuntime Server Stub Server Database ExportInterface ExportInterface UpdateDatabase
Client imports interface, Database lookup, Type (service) Instance (address) Binding Process(Caller) Caller User User Stub RPCRuntime Database Who’s available? ImportInterface ImportInterface QueryDatabase InterfaceInfo InterfaceInfo InterfaceInfo AvailableInterfaces
Binding Process(Caller) • RPCRuntime calls Server • Verifies service is available • Returns ID, and table index • User stub records address, ID, index Caller User User Stub RPCRuntime Database Who’s available? ImportInterface ImportInterface QueryDatabase InterfaceInfo InterfaceInfo InterfaceInfo AvailableInterfaces
Optimized for small request/response packets, Less load on Server Must guarantee procedure invoked at most once Probe packets (are you there?) Report network errors to application, Unknown if procedure invoked. Deadlock or endless loop of server is not handled RPC Network Protocol
All information fits in one packet Efficient for frequent calls Caller sends procedure call Server turns response Caller sends procedure call Server turns response Simple Call Example Only two packets callid foo(a,&b) foo(int a, int *b) callid return;
Complicated Call Caller Callee User RPCRuntime Server RPCRuntime Procedure call Call[Ids, packet=0] Receivepacket 0 Transmit first packet Ack[Ids, packet=0] Transmit ack Receive ack Call[Ids, packet=1] Transmit next packet Receivepacket 1 Procedure call Call[Ids, packet=1, needAck] Retransmit next packet Receivepacket 1 Ack[Ids, packet=1] Transmit ack Receive ack Result[Ids] procedure return Receiveresult Transmitresult procedure return Result[Ids, needAck] Receiveresult Transmit ackrequest Ack[Ids] Transmit ack Receive ack
Process Pools with process ID for reuse Reply packets count as acknowledgement Low connection overhead Low cost to establish connection Reduced Process switching Modified network stack for RPC special case Optimizations
Validation of caller and callee End to end encryption of data Security