Remote Procedure Call
RPC Model Server process
Client Process
Call Procedure
Request Message Receive Request Start Execution
Resume Execution
Reply Message
Send reply wait for next request
Transparency of RPC ●
Syntactic Transparency (Same syntax as Local Procedure Call)
●
Semantic Transparency (Same semantics as Local Procedure Call)
Semantic Transparency ●
Calling process is suspended until procedure returns
●
Caller can pass arguments to remote procedure
●
Called procedure can return results
Remote / Local Procedures ●
Disjoint address space
●
More prone to Failures (Exceptions)
●
Time factor (Long Delays)
Elements of RPC ●
Client
●
Client Stub
●
RPC Runtime
●
Server
●
Server Stub
RPC Client Machine
Server Machine
Client
Server
Client Stub
Server Stub
RPC Runtime
RPC Runtime Call Packet Request Packet
Stub Generation ●
Automatic
●
Manually
Components of Call Messages ●
Identification info of remote procedure
●
Arguments
●
Message Identification Field ● ●
●
Message Type Field ●
●
For identifying lost messages For Matching reply to call
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
RPC SERVER ●
Message not intelligible
●
Not authorized client
●
Particular program,version, procedure no. not available
●
Cannot decode arguments
●
Exception during execution
●
Successfully executed
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
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
Server Management ●
Server Implementation
●
Server Creation
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
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
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
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
Failure of RPC ●
Call message gets lost
●
Response message gets lost
●
Callee node crashes
●
Caller node crashes
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
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
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
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
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
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
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
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.
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
Server Naming ●
Use of Interface name Type (Version no.)
●
Interface Name
Instance ( server providing services within the interface)
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
Binding Agent Binding Agent Client Req for server location
Server Registers Server's location info
Client Process
Server Process Client calls server
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
Binding at Call time (Indirect Call) Binding Agent
Client passes server's interface name, arg
RPC call result,handle Result
Client Process
Server Process Subsequent calls
Binding at Call time Indirect Call
Assignments ●
●
Examples of –
R Protocol
–
RR Protocol
–
RRA Protocol
Lightweight RPC(LRPC)