Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

34
Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner

Transcript of Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Page 1: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Remote Procedure Calls

Adam Smith, Rodrigo Groppa, and Peter Tonner

Page 2: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Outline

I. IntroductionII. BindingIII. Packet Level ProtocolIV. PerformanceV. Status And Discussions

Page 3: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Introduction

Page 4: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

def: Remote Procedure Calls

• Procedure call that executes remotely• (in this paper) single threaded– caller waits for return of function

• Abstraction of message passing • Simple syntax and simple semantics– user should not be concerned with

implementation

Page 5: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Environment (old computers)

• Cedar programming environment• Dorados– 24 bit virtual address space– 80 Mb disk

• Mesa, Smalltalk, InterLisp• PUP protocol family

Page 6: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Aims

“Make distributed computation easy”• Make remote programming nearly as easy as

making local procedure calls• Keep efficiency within 5 times the network

latency• Use secure communication with encryption

Page 7: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Fundamental Decisions

• RPC vs Message Passing– same problems, same solutions–Mesa: based on procedural control flow

• Fork adds no significant complexity• No shared address space– requires extension of address space with

network location– out of solution scope

Page 8: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Terms of RPC

• Caller and callee• Interface Modules– list of functions with parameter and

return types

• Export – define functions• Import – use functions of an interface• Program Modules

Page 9: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Structure

• User, User Stub, RPCRuntime, Server, Server Stub

• Stub– Pack and unpack arguments and results

• RPCRuntime– exists on both machines– transmit messages from caller to callee

Page 10: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

More Structure

Page 11: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

II. Binding

• Naming– specify what a client should be bound to by the RPC

Runtime• Location– Caller locates callee and invokes a procedure

Page 12: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Naming

• Check whether an importer is connecting to an appropriate exporter

• Type– specify the interface of a callee– think Java/C# classes

• Instance– implements the Type interface

Page 13: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Locating an Appropriate Exporter

• RPCRuntime links caller and callee modules– stores machine locations in a Grapevine database

• Exporter (implementing an interface) calls ExportInterface– stores interface and procedure callback

• Importer (uses an interface instance) calls ImportInterface– must include interface type– instance identifier is optional

Page 14: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Exporting and Importing

Page 15: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Packet Level Transport Protocol

Page 16: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Requirements

They believe there are performance gains available if they were to design and implement a transport protocol specially for RPC, because of the nature of the system they were creating.

They believed that performance could possibly be improved by a factor of ten.

Page 17: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Requirements

One aim they emphasized in their protocol design was minimizing the amount of real-time taken between initiating a call and getting results. With protocols for large amount of data transfer this isn’t important because so much time will be spent transferring the data.

They also wanted to minimize the load given to a server by a large number of users.

Page 18: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Requirements

They wanted their machines to be able to handle a large number of clients, and it wouldn’t be feasible to require a large amount of state info or costly connection handshaking for this situation.

Page 19: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Requirements

They wanted to guarantee that if the call returns to the user that the user can be certain that the procedure in the server has been executed precisely once. Otherwise, he could expect an exception to have been reported and the procedure would have been executed either once or not at all, without being informed of which actually happened.

Page 20: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Requirements

There is no upper bound on how long it will wait for results.

Calls will be aborted if there is a communication problem or a crash, but not if the server stops or loops.

They did this to mirror how local procedure calls work.

Page 21: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Simple Calls

To make a call, the caller sends a call packet containing a call identifier, data specifying the desired procedure, and the arguments.

When the callee machine receives this packet, the appropriate procedure is invoked. When the procedure returns, a result packet containing the same call identifier, and the results, is sent back to the caller.

Page 22: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Simple Calls

Page 23: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Complicated Calls

Page 24: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Exception Handling in Mesa

Exceptions are called signals, and when an exception is raised, the runtime system dynamically scans the call stack to determine if there is a catch phrase for the exception. If there is, then the catch phrase code is executed, and data pertaining when it was raised is given. The catch may return to where the exception was raised, or it may terminate and jump back.

Page 25: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Exception Handling by RPC package

The RPC package uses the way Mesa handles exceptions as a model. The protocol allows the process on the server machine to send exception packets in place of result packets. This allows the caller machine to raise an exception in the appropriate process. The results (if any) can be sent back to the callee machine, and the process can proceed normally.

Page 26: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Exception Handling by RPC package

If the catch code terminates then the callee machine is so notified, which then unwinds the appropriate procedure activations.

In addition to exceptions raised by the callee, the RPC runtime may raise a call failed exception if there is some communication difficulty.

Page 27: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Use of Processes

Since forking processes is normally a costly event, they took extra care whilst building this package to keep that cost as low as possible.

The first step to reaching this goal is the fact that they used idle server processes to remove the costs of process creation. As soon as a call is received by a callee, it may be handled.

Page 28: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Use of Processes

Each packet contains a process identifier for both source and destination.

In packets from the caller machine, the source process identifier is the calling process.

In packets from the callee machine, the source process identifier is the server process handling the call.

Page 29: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Use of ProcessesA process wanting to make a call makes the first

packet of the call, guesses a value for the destination process identifier, and sets the source to be itself. It then sends the packet and waits.

The callee receives this and tells a server process to handle the packet and make a response packet. The destination process identifier in this packet will be that of the process waiting in the caller machine.

When the response arrives in the caller machine, it is passed directly to the calling process.

Page 30: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Optimizations

They use subsequent packets for implicit acknowledgment of previous packets, they attempt to minimize the costs of maintaining their connections, they avoid costs of establishing and terminating connections, and they reduce the number of process switches involved in a call.

Page 31: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Other OptimizationsWhen transmitting and receiving RPC packets

they bypass the software layers that correspond to the normal layers of a protocol hierarchy in the case of local calls.

They modified the network-driver software to treat RPC packets as a special case. They want RPC to be a special case and they want it to be the dominant communication protocol.

Many other options for optimization were avoided.

Page 32: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Security

Their RPC package and protocol uses Grapevine as an authentication service and use the federal data encryption standard.

This gives full end-to-end encryption of calls and results. These encryption techniques provide protection from eavesdropping, and detect attempts at modification, replay, or creation of calls.

Page 33: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Results

• Figures in microseconds.

Page 34: Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.

Status

• Project was still its early stages at time of writing.

• RPC isn’t a suitable replacement for certain situations.

• Use Multicast/broadcast instead