19
Implementing Remote Procedure Calls 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 Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to:

  • View
    218

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Implementing Remote Procedure Calls Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to:

Implementing Remote Procedure Calls

Authors: Andrew D. Birrell and Bruce Jay Nelson

Xerox Palo Alto Research Center

Presenter: Jim SantmyerThanks to: Philip Howard

Christopher Holm

Page 2: Implementing Remote Procedure Calls Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to:

Make Distributed Computing easier

Remote Procedure Calls

Page 3: Implementing Remote Procedure Calls Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to:

What is a Remote Procedure Call?

• 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

Page 4: Implementing Remote Procedure Calls Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to:

Why RPC

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

Page 5: Implementing Remote Procedure Calls Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to:

RPC Design Issues

• 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 transmissionProtocol, Security

Page 6: Implementing Remote Procedure Calls Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to:

RPC Structure

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

Page 7: Implementing Remote Procedure Calls Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to:

Server Application Tasks

Export Interface

Register Interface

Services requests

May report Server errors to User application.

Page 8: Implementing Remote Procedure Calls Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to:

User Application Tasks

Bind to Server– Client imports the interface exported by server

Makes (remote) procedure calls as normal

Handles remote machine and communication failures.

Page 9: Implementing Remote Procedure Calls Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to:

User Stub Task

• 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

Page 10: Implementing Remote Procedure Calls Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to:

Server 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

Page 11: Implementing Remote Procedure Calls Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to:

RPC StructureCaller

RPCRuntime

Transmit packet(s)

Receive packet(s)

Send packet

NetworkNetwork

NetworkNetwork

Receive packet

User StubUser

Procedure call

procedure return

Packarguments

Unpackresult(s)

Callee

RPCRuntime

Receivepacket(s)

Transmitpacket(s)

Server Stub Server

Procedure call

Procedure return

Unpackarguments

Packresult(s)

Receive packet

Send packet

Interface

Interface

importer exporter

importer exporter

Threaded

Event Driven

Page 12: Implementing Remote Procedure Calls Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to:

Binding Process(Server)

• Server exports interface– Notifies RPCRuntime of Service

• Table array: Interface Name, Dispatcher, ID– Registers Service in Database

• Type, Instance

Database

RPCRuntime

UpdateDatabase

Server Stub Server

ExportInterface

ExportInterface

Callee

Page 13: Implementing Remote Procedure Calls Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to:

Binding Process(Caller)

• Client imports interface, – Database lookup,

• Type (service)• Instance (address)

Caller

RPCRuntimeUser StubUser

ImportInterface

ImportInterface

QueryDatabase

InterfaceInfo

InterfaceInfo

InterfaceInfo

Database

Who’s available?

AvailableInterfaces

Page 14: Implementing Remote Procedure Calls Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to:

Binding Process(Caller)

RPCRuntimeUser StubUser

ImportInterface

ImportInterface

QueryDatabase

InterfaceInfo

InterfaceInfo

InterfaceInfo

Database

Who’s available?

AvailableInterfaces

Caller

RPCRuntime calls Server– Verifies service is available– Returns ID, and table index

• User stub records address, ID, index

Page 15: Implementing Remote Procedure Calls Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to:

RPC Network Protocol

• 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

Page 16: Implementing Remote Procedure Calls Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to:

Simple Call Example• All information fits in one packet

• Efficient for frequent callsCaller sends procedure callServer turns responseCaller sends procedure callServer turns response

Only two packets

foo(a,&b) foo(int a, int *b)

return;

callid

callid

Page 17: Implementing Remote Procedure Calls Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to:

Complicated CallCaller

RPCRuntime

Transmit first packet

Receiveresult

User

Procedure call

procedure return

Callee

Server

Procedure call

procedure return

RPCRuntime

Call[Ids, packet=0]

Ack[Ids, packet=0]

Call[Ids, packet=1]Transmit next packet

Transmit ack

Receivepacket 0

Receivepacket 1

Receive ack

Retransmit next packet

Call[Ids, packet=1, needAck] Receivepacket 1

Transmit ack

Ack[Ids, packet=1]Receive

ack

Transmitresult

Transmit ack

request

Result[Ids]

Result[Ids, needAck]Receiveresult

Transmit ack

Ack[Ids]Receive

ack

Page 18: Implementing Remote Procedure Calls Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to:

Optimizations

• 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

Page 19: Implementing Remote Procedure Calls Authors: Andrew D. Birrell and Bruce Jay Nelson Xerox Palo Alto Research Center Presenter: Jim Santmyer Thanks to:

Security

• Validation of caller and callee

• End to end encryption of data