Implementing Remote Procedure Calls By Andrew D Birrell
Implementing Remote Procedure Calls By Andrew D. Birrell and Bruce Jay Nelson Presented By: Abdussalam Alawini Reviewed By Prof. Jonathon Walpole
Contents 1. Introduction � � 2. Implementing RPC � � � 3. RPC Structure Binding Process RPC NT Protocol Data Integrity and security � � � 4. Where we are? And where we’re heading? What is “Remote” Procedure Call Design Decisions Goals of RPC Exception Handling Use of Processes Security Optimizations and Evaluation � � Optimizations Performance evaluation
1. Introduction
Where we are? And where we’re heading? �We saw managing OS control flow over one sharedmemory using: �Procedural (thread-based) Model �Message passing (event-based) Model �Now we will see a procedural (thread-based) programming abstraction based on message passing (event-based) substrate. �Threads passed from one machine to the other and back again. �Programmer unaware of the underlying message-based substrate.
What is A “Remote” Procedure Call? Server result Z=F(x, y) Client F(x, y) Compute F(x, y) Communication Network
Design Decisions (Any Alternatives) � Message passing �Same reliable and efficient message (and reply) problems �Procedure calls are the Major transfer mechanism in Mesa. (Remember Duality) �Remote fork �No major changes in design problems �Shared Address space �Integration of remote address spaces �Efficiency issues
Goals of implementing RPC �Simplicity �Make RPC as similar to procedure calls as possible �Make distrusted computation easier �Efficiency �Make sematic of RPC package as powerful as possible without losing efficiency or simplicity �Secure end-to-end communications with RPC
2. Implementing RPC
RPC Facility Structure �Caller Machine �User (user application code module) �User-Stub �Caller instance of RPCRuntime (RPC communications package) �Callee Machine �Server (server code module) �Server-stub �Callee instance of RPCRuntime
RPC Components Interactions Caller Machine User Application User-stub Call Packet Caller RPCRuntime Normal Do work Local Proc and return Call results Import Interface Unpack & Pack target make local Export spec + proc Interface call arguments Pass transmit them topacket server“Reliably” stub Network Callee Machine Libraries (Server code) Server-stub Results Packet Callee RPCRuntime
Who Does What? Mesa Interface Modules Caller Machine User Application User-stub Caller RPCRuntime Programmer Interface Callee Machine Libraries (Server code) Lupine Server-stub Part of Cedar Callee RPCRuntime (Auto Generation) Network
Binding Process �How does a client of the binding mechanism specify what he want to be bound to? �Naming �How does the caller specify the callee machine address and the specific procedure he wants to invoke? �Locating
Naming (Interface Name) Importer of an interface Binding Exporter of an interface �Type: Which interface the caller expect the callee to implement. �Service Name (e. g Mail-server) �Instance: Which particular implementer of an abstract interface is desired. �Machine Address (e. g Specific mail-server address)
Locating Design ideas 1 - Include network address in user application �Too early binding 2 - Broadcasting Protocol �Too much interference with innocent bystanders �Not convenient for binding machines not in the same local network.
Grapevine Database Locating an appropriate exporter Export Interface Type File. Access Instance Ebbets Server 1 (Ebbets) 3#22# Server 2 (Luther) 3#276# Server 3 (Facc) 3#43# Grapevine Database Type (Group) Member-list Instance(Individual) Connect-site File. Access {Ebbets, Luther, Facc} Ebbets 3#22# Luther 3#276# Facc 3#43# Import Interface Type File. Access Instance Ebbets
Steps of Exporting an Interface (Making it available to a client) Export. Interface RPCRuntime make sure that type Record exported and instance is interface in a table correct Callee Machine Grapevine Database Set the address of the current machine in the connect-site Adds the instance to Do update the member-list of RPCRuntime Server-stub Record in table Export [FA, Ebbets, …] Set. Connect the type of the instance Add. Member Do update Server Export [FA, Ebbets] Call Export. Interface Call Name, server. Interface exported (Interface (Can be accessed sub Dispatcher) Table [table. Index, remotely) Interface. Name, Dispa tcher. Prod, Unique. ID] Return
Steps of Binding An Importer to An Exporter Interface (Getting ready for remote calls)
OK, now I’veask got OK, ICall will Call. Table. Index, user-stub UID, Exporter Interface grapevine Import. Interface DB and “I need to import and exporter NT isthe ready for your get “Here’s NT the address type Interface[FA, Address. I willwe remote and ofnext instance exporting Ebbets” record themcalls procedure Interface need” Lookup Grapevine Database Caller Machine User Import [FA, Ebbets] User-stub Import [FA, Ebbets] Callee Machine RPCRuntime open. File -> 2 RPCRuntime Get Connect 1 - Retrieve Alright, I will Normal binding call to interface transmit it to the Bind[FA, information procedure machine. Ebbets] with 2 -open. File(y) Prepare call address “connect. Record Return packet site” result X= open. File(y) Now let see Here’s the NT how this will address work “connect-site” transmit Table lookup Check UID In table Server-stub Server Lookup. I’ll thecall table Alright, the of current exports exporter Send the to RPCRuntime 1 -Lookup current unpacking, corresponding get the. After binding exports Dispatcher uses Call the local binding info 2 -procedure verify the info to. UID map to using 3 - send call packet the right provided to procedure dispatcher arguments 2 -> open. File X= open. File(y)
Binding Mechanism Advantages �Importing an interface has no effect on the data structure of the exporting machine �The use of UID means that bindings are implicitly broken if the exporter crashes and restarts. �Restricting the set of users who can update Grapevine DB. �To avoid security problems. �Several choices of binding time �Importer specifies the type only �Binding at compile-time, by delaying the instance value
Packet-Level Transport Protocol (Why? ) �Substantial performance gains �Minimize the elapsed real-time between initializing a call and getting results. �Unacceptable to have large amount of state info. �Unacceptable to have an expensive handshaking. �Guarantee procedure in the server has been invoked precisely once.
Simple Calls Example RPC If caller compares Seq# EQ Cseq in CID then to“Activity” the Ack one if for needed it has Monotonic each Proposes Result packet is Each activity Procedure Desired Procedure arguments ifin caller. Seq# a table LT Cseq activity. is thethat 1 - Ensure the result sufficient Ack to which ishas Info: the input or 1 at most maintains then drop seq# “repeated” of the No (calls packet isrepeats for this call Machine Id, output UId, Table that will Index, be last Ifmight caller. Seq# call invoked GT by Cseq remote call at eliminated as caller. 2 - the Callee can eliminate and Processes’ Procedure used by entry RP each then calling new call activity packet dup. ) point. any time duplicates Ids [Machine Id, Process] Seq# Callee Machine Caller Machine User Call RPC+Stub Send Call Packet Wait Ack or Result Call. ID Server Invoke proc Do call Send results Return Result Call. ID Return DP info Arugs RPC+Stub results
Is There A “Stack Ripping”? �In manual stack management the necessary data is taking off the stack and then putting it on the heap. �In RPC it’s taking off the stack and putting it in a message. �Sent to the other side. � Very similar to taking the state off the stack and putting it in a continuation. �Executed by a separate event handler.
No subsequent call Now all of arguments Satisfying In. Send case Ack: lost packet, process results Return results tolong arrived, so ask the Call pktduration must be long waits call for results or are. And ready, sofor the wait Send the rest of the Caller gaps sends between calls pkts caller toprocess do anprobe explicit caller (user acknowledged dispatching process another call “works data Data Pkt periodically retransmit the (can last detect pkt Ack in that it has code) Arguments going communication andstarts ask. Ack” for ack failure) as an received the results to be in 2 packets Complicated Call Example Caller Machine User RPC+Stub Call Send Call. Pkt Wait for Ack Call. ID, Pkt=0, Pls. Ack, … Ack Call. ID, Pkt=0, Build next pkt Transmit it Wait for ack Retransmit Wait for ack Data Start arg record Acknowledge Wait next pkt Invoke call Do call Acknowledge Result Call. ID, Pkt=2, Pls. Ack , …. Ack Call. ID, Pkt=2, Acknowledgment Server Call. ID, Pkt=1, Pls. Ack , …. Call. ID, Pkt=2, dont. Ack , …. Return RPC+Stub Call. ID, Pkt=1, dont. Ack, …. Call. ID, Pkt=1, Wait for result Callee Machine Send result Wait for ack Retransmit Wait for ack Idle Return
4. Data Integrity and security
Exception Handing (Remote Process Exception) �Two level of exception �Communication Failure Exception (Explained with complicated call example), considered to be the primary difference between procedure call and RPC �Remote Process Exception
If there’s a catch If the catch phrase Don’t invoke new phrase, exception Caller Prepare If an does exception and sends send terminated by a call, instead raise Events processed Exception handling will bethe handled and occur, exception regular process call packet jump, then thein an exception results packet. normally results will be sent packet instead passes as of we the results saw callee will be thetocalling back the exception before packet tocallee RPC notified process machine Exception Handling Caller Machine User Call RPC+Stub Send Call Packet Wait Ack, Result or Exception Call. ID Return With exception Call with Exception results Send EH results RPC+Stub Server Invoke proc Do call Exception Call. ID Catch exception DP info Arugs Callee Machine Exception Results Call. ID DP info Arugs Send Exception Return With exception Invoke proc that caused the excep Continue doing call
Use of Processes 7 If there’s no corresponding RPC will exchange process waiting for this Src. Process with packet then it will be Dest. Process so that dispatched to one of the it can return the free processes the right (Current, results New, orto. Dup) process 3 Interrupt handler in 7 Process 7 part made a This is the RPC now look transmit at the Src. Process Dest. Process remote procedure process identifiers, the dest. Process, packet back if the to call to process 3 the which the process calleris(result, waiting is part of Idle Server Processes Waiting activity exception, then it transfers or Ack) the info within For RPC packet the Call. ID pkt directly 7 3 3 Src. Process Dest. Process Network Caller Machine Callee Machine
Security �RPC package and protocol provides Encryption-based security of calls �End-to-end encryption of calls and results �Detect tempts of modification, reply, or creation of calls. �Restricted set of users who can update Grapevine DB. �Exporting services is restricted �Grapevine DB used as authentication service.
4. Optimizations and Evaluation
Optimizations �Use of idle processes in caller and callee machines to reduce process creation and process swaps. �The use of process source and destination allow processes to get the packets they’re waiting for directly. �Use of subsequent packet for implicit acknowledgments of previous packets. �Avoid the cost of establishing and termination connection by the implementation of packet-level protocol.
Performance evaluation �They’ve measured the elapsed time between two machines for 12, 000 calls for each of the following procedures: � 0 -10 arguments/results. � 1 -100 word array. �Caller Resume and unwind exception handling.
Performance results
Performance summary �For transferring large amounts of data in one direction products other than RPC have advantage. �Transfer fewer packets in the other direction �They haven’t measure the performance of exporting or importing interfaces. �Used by: � Alpine [File server supports multi-machine transactions] �Control communication for an Ethernet-based for telephone and audio project �Networking games.
Conclusion �RPC is one of the techniques used in communication between processes outside their address space boundaries. �Make distributed programming easier. �RPC protocol for avoiding communications overhead. �Considered to be the first protocol suite that provides security in open network communications. �RPC succeed in providing reliability and integrity for data and control transfer. �More work needs to be done (By now, I think there is a lot of work that has been done)
Discussion
- Slides: 35