Download - rpc
![Page 1: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/1.jpg)
Remote Procedure Call
![Page 2: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/2.jpg)
RPC Model
Server processClient Process
Request Message
Reply Message
CallProcedure
Receive Request Start Execution
ResumeExecution
Send reply wait for next request
![Page 3: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/3.jpg)
Transparency of RPC
● Syntactic Transparency
(Same syntax as Local Procedure Call)
● Semantic Transparency
(Same semantics as Local Procedure Call)
![Page 4: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/4.jpg)
Semantic Transparency
● Calling process is suspended until procedure returns
● Caller can pass arguments to remote procedure
● Called procedure can return results
![Page 5: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/5.jpg)
Remote / Local Procedures
● Disjoint address space
● More prone to Failures (Exceptions)
● Time factor (Long Delays)
![Page 6: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/6.jpg)
Elements of RPC
● Client
● Client Stub
● RPC Runtime
● Server
● Server Stub
![Page 7: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/7.jpg)
RPC
Client Server
Client Stub
RPC Runtime
Server Stub
RPC Runtime
Client Machine Server Machine
Call Packet
Request Packet
![Page 8: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/8.jpg)
Stub Generation
● Automatic
● Manually
![Page 9: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/9.jpg)
Components of Call Messages● Identification info of remote procedure● Arguments ● Message Identification Field
● For identifying lost messages● For Matching reply to call
● Message Type Field● For identifying call messages from reply messages
( 0 - Call 1 - Reply )
● Client Identification Field● For Server to identify client● For Server to authenticate client process
![Page 10: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/10.jpg)
RPC SERVER
● Message not intelligible ● Not authorized client● Particular program,version, procedure no. not
available● Cannot decode arguments● Exception during execution● Successfully executed
![Page 11: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/11.jpg)
Reply Format
● Successful● Message ID (Same as call message ID)● Message Type● Reply Status (0 - Successful)● Result
● Unsuccessful● Message ID● Message Type● Reply Status (Non zero - Unsuccessful)● Reason for failure
![Page 12: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/12.jpg)
Steps involved during Marshalling
● Taking arguments or result that forms message data
● Encoding message data on senders machine– Converting into suitable stream for transmission– Placing in message buffer
● Decoding message data on receiver's comp.– Reconstruction of program objects from stream
![Page 13: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/13.jpg)
Server Management
● Server Implementation
● Server Creation
![Page 14: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/14.jpg)
Server Implementation
● Stateful Servers– Maintains Client state information from one call to
next● Stateless Servers
– Does not maintain any client state information– Client should supply all necessary parameters for
successful execution of procedure
![Page 15: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/15.jpg)
Server Creation Semantics
● Instance per call Servers– Server created only when call message arrives– Server exist only for the duration of one call– Server deleted after call has been executed
● Instance per Session Servers– Server exists for the entire session for which client
and server interact– Accomplished through Server Manager and Binding
Agent
![Page 16: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/16.jpg)
Server Creation Semantics Contd.
● Persistent Servers – Remains in existence indefinitely– Shared by many clients– Created and installed before clients use them– Accomplished through Binding agent– Interleaved for concurrent requests
![Page 17: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/17.jpg)
Parameter Passing
● Call by Value● Parameters copied to message
● Call by Reference– Call by move
– At the time of call parameter object is moved to destination node– After the call the argument object does not return to the caller's
node
– Call by visit– After the call the argument object returns to the caller's node
![Page 18: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/18.jpg)
Failure of RPC
● Call message gets lost● Response message gets lost● Callee node crashes● Caller node crashes
![Page 19: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/19.jpg)
Call Semantics
● How often remote procedure may be executed under fault conditions
● Possibly or May-Be Call Semantics● Last-One Call Semantics● Last-Of Many Call Semantics● At-Least-Once Call Semantics● Exactly -Once Call Semantics
![Page 20: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/20.jpg)
Call Semantics contd.
● Possibly or May-Be Call Semantics– Caller times out and continues execution– No guarantee of delivery of call or execution of
procedure● Last-One Call Semantics
– Retransmissions based on timeouts until response is delivered
– Side effects are possible – Orphan call may violate last-one semantics
![Page 21: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/21.jpg)
Call Semantics contd.
● Last-of Many Call Semantics
– Neglect orphan calls by using call identifiers
– Call id identify each call
– Accepts response for matched call id else ignore
● At-Least-Once Call Semantics
– Timeout retransmissions
– Ignore Orphan calls
![Page 22: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/22.jpg)
Call Semantics contd.
● Exactly-Once Call Semantics– Most desirable– Strongest Call Semantics– Based on
● Timeouts● Retransmissions● Call Id's (Same id for repeated calls)● Reply Cache associated with callee
![Page 23: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/23.jpg)
Communication Protocol
● Request Protocol (R protocol)– No result returned – No confirmation of procedure execution– Asynchronous RPC– 1 packet per call
● Request/Reply Protocol– Servers reply is regarded as ack. for client– Subsequent call from client acts as ack. for server's
reply of previous call– 2 Packets per call
![Page 24: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/24.jpg)
Communication Protocol
● Request/Reply/Acknowledge-Reply Protocol(RRA)– Clients ack. Reciept of reply– Server deletes from reply cache after receiving ack
from client.– 3 packets per call– What happens if ack. From client is lost
![Page 25: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/25.jpg)
RRA Protocol
● If Ack. is lost– Unique Message ID in order– Client acknowledges only if it has recvd. Replies to
all previous requests– Ack is interpreted as ack. For all reply messages
corresponding to req messages with lower message id's
– Loss of ack. is harmless
![Page 26: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/26.jpg)
Complicated RPC
● Long duration calls/gaps between calls– Periodic probing of server by client– Periodic generation of ack by server (if execution not
completed within expected time)● Arguments / Results too large to fit in single
datagram packet– Use several physical RPC for one logical RPC– Multigram messages with single ack.
![Page 27: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/27.jpg)
Client Server Binding
● Process by which client becomes associated with server so that call can take place- BINDING
● Binding Issues– Server Naming– Server Locating – Binding Time
![Page 28: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/28.jpg)
Server Naming
● Use of Interface name
● Interface Name
Type (Version no.)
Instance ( server providing services within the interface)
![Page 29: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/29.jpg)
Server Locating
● Broadcasting– First response is used
● Binding Agent– Named server used to bind client to server by providing
the client with location information of server– Maintains binding table to map server's interface name
to server locations– Servers register with the binding agent
● Identification info , handle used to locate it
![Page 30: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/30.jpg)
Binding Agent
Client Process Server Process
Server RegistersClient Req for server location
Server's location info
Client calls server
Binding Agent
![Page 31: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/31.jpg)
Binding Time
● Binding at compile time– Client and server models are programmed and linked
together● Binding at Link time
– Through binding agent– Server's handle is cached by client to avoid
subsequent calls to binding agent● Binding at Call time
– Indirect call method
![Page 32: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/32.jpg)
Binding at Call time(Indirect Call)
Client Process Server Process
Client passes server'sinterface name, arg
result,handle
Subsequent calls
Binding Agent
RPC call
Result
![Page 33: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/33.jpg)
Binding at Call timeIndirect Call
![Page 34: rpc](https://reader033.vdocuments.net/reader033/viewer/2022061115/5464f88ab4af9f314f8b46aa/html5/thumbnails/34.jpg)
Assignments
● Examples of – R Protocol – RR Protocol– RRA Protocol
● Lightweight RPC(LRPC)