0% found this document useful (0 votes)
100 views22 pages

03 - Remote Invoaction: Request-Reply RPC RMI Coulouris 5 Birrel - Nelson - 84 PDF

This document discusses remote procedure calls (RPCs) and their implementation. It begins by explaining that RPCs provide a mechanism for process communication across distributed systems and are built on top of lower-level interprocess communication primitives. It then covers request-reply protocols, how they support client-server interactions, and their common communication primitives like doOperation and sendReply. The document also discusses how RPCs extend the procedure call abstraction to make remote calls appear local and hide things like distribution and data encoding/decoding. It provides examples of interface definition languages and RPC call semantics regarding fault tolerance.

Uploaded by

Dani Jazmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views22 pages

03 - Remote Invoaction: Request-Reply RPC RMI Coulouris 5 Birrel - Nelson - 84 PDF

This document discusses remote procedure calls (RPCs) and their implementation. It begins by explaining that RPCs provide a mechanism for process communication across distributed systems and are built on top of lower-level interprocess communication primitives. It then covers request-reply protocols, how they support client-server interactions, and their common communication primitives like doOperation and sendReply. The document also discusses how RPCs extend the procedure call abstraction to make remote calls appear local and hide things like distribution and data encoding/decoding. It provides examples of interface definition languages and RPC call semantics regarding fault tolerance.

Uploaded by

Dani Jazmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

03 – Remote invoaction

● Request-reply ● Coulouris 5
● RPC ● Birrel_Nelson_84.pdf
● RMI
2/22
Remote invocation
● Mechanisms for process communication on a DS
● Built on top of interprocess communication
primitives
– Lower level
– Provided by the OS

Applications

Remote invocation, indirect communication


This chapter
Middleware
Underlying interprocess communication primitives: layers
sockets, message passing, multicast support, overlay networks
UDP and TCP
3/22
Request Reply Protocols
● Support client-server interaction
● Usually synchronous
– Client blocks until reply is received
● Reliable (reply is an acknowledge)
● May use UDP datagram instead of TCP streams
– TCP knowledge is redundant
– Connection establishing requires extra messages
– Flow control is redundant for some uses
● Which pass only small arguments and results
4/22
Request Reply Protocols
● Communication primitives
– doOperation
– getRequest
– sendReply

Client Server

Request
doOperation getRequest
message
select object
(wait) execute method
Reply sendReply
message
(continuation)
5/22
Request Reply Protocols
● doOperation
– Sends request to the remote server
– Arguments
● Server remote reference
● Operation id
● Arguments
– Returns
● reply
– send (TCP), sendto (UDP)
6/22
Request Reply Protocols
● getRequest
– Blocking function / waits for request
– Returns request data
● sendReply
– Sends response to client
– Arguments
● Reply
● Client id
– send (TCP), sendto (UDP)
7/22
Request Reply Protocols
MessageType int (0=Request, 1= Reply)
requestId int
remoteReference RemoteRef
operationID int or Operation
arguments array of bytes

● Message identifier
– RequestId
● increasing sequence of integers (per sending process)
– RemoteReference
● Identification of the process (IP address, port, process id)
8/22
Request Reply Protocols
● Failure model (UDP)
– Omission failures
– Delivery order not guaranteed
● Timeouts
– doOperation can
● Repeats transmission of message
9/22
Request Reply Protocols
● Duplicate messages
– After time-outs
– Protocols must recognize them
● Lost reply messages
– Reception of duplicate request
– Ignore second repetitions
– Implement idepotent operation
● History
– required
10/22
Request Reply Protocols
● Exchange protocols ● Exchange protocols
– R (request) – RRA (request-reply-ack)
● Online request is sent ● Explicit ack of the reply
● No need for response ● Server can clean history
● Client may unblock imediatly ● TCP
– RR (request-reply)
● Special ACK message not
– simplifies protocol
required – Larger messages
– Implemented by the response
● Subsequent Request is
– Acknowledgements not
Acknowledgment of the necessary
reply
12/22
Remote Procedure Call
● Request Reply protocols
– Not transparent (w.r.t. distribution)
– Local invocation ≠ remote invocation
● Extends procedure call abstraction
– RPCs are called as if in local address space
– RPC system hides
● Distribution
● Encoding/decoding of parameters/reply
● Passing of messages
● Semantics of call
13/22
Remote Procedure Call
Interfaces
● RPCs should mimic programming language
structures
– Modules/ libraries / classes
– Function/procedures/methods
– Use the concept of interface
● A set of well defined ointeraction points
– Encapsulate implementation details
● Service interfaces
– Set of procedures offered by a server
– Defining parameters and return values (and types)
14/22
Remote Procedure Call
Interfaces
● Provide/implement goof programming practices
– Implementation are hidden from the programmer
– Server programming language /architecture is hidden
– SW evolution is possible
● Distribution imposes
– Impossible access to remote variables
– Call by reference not suitable
● Input parameters: client → server transfer
● Output parameters client ← server transfer
– Addresses in one process are not valid on another
● Addresses can not be passed
15/22
Remote Procedure Call
Interface Definition Languages
● Static languages require the a priori declaration of functions and types
● Publication of a service requires its description
● Interface Definition Languages (IDL) allow:
– Specification of interfaces
– Communication of interfaces
– Production of .c/.h files

● Examples
– SUN XDR, – Java interfaces
– CORBA IDL – Google protocol buffers
– Webservices WSDL
16/22
Remote Procedure Call
RPC call semantics
● DoOperation can be implemented differently
– Retry request message
● Are retries made until reply is received?
– Duplicate filtering
● What happens when server receives duplicate message
– Retransmission of results
● Is history kept to prevent re-execution of operations?
17/22
Remote Procedure Call
RPC call semantics
Fault tolerance measures
Call semantics Retransmit request Re-execute procedure or
Duplicate filtering
message retransmit reply
Maybe No Not Applicable Not Applicable
No fault tolerance measures applied
Omission failures (message lost), crash failures (server fails)

At-least-once Yes No Re-execute procedure


Invoker receives a result (code was executed at least once) or an exception (result was
not received)
Retransmission of requests
Crash failures (server fails), arbitrary failures (requests are retransmitted, procedure
may be executed more than once)

At-most-once Yes Yes Retransmit reply


Invoker receives a result (code was executed once) or an exception (result was not
received, but code not executed or executed once)
18/22
Remote Procedure Call Minimum requirement
Transparency
● RPC tries to hide differences from local/remote
procedure call
– Syntax is similar
– Data marshaling and retransmission is hidden
● However RPC are more vulnerable to failure
– Involve network, other computer, other process
– Code should be able to recover
● RPC latency is higher
● Parameter passing is different
19/22
Remote Procedure Call
Implementation
client process server process
Request

Reply
client stub server stub
procedure procedure
client service
program Communication Communication
module module dispatcher procedure


Generated automatically ●
General
– Stubs – Communication module

Marshal arguments /return
values

Hand coded
– Dispatcher – Client program

Redirects call – Service procedure
20/22
Remote Method Invocation
● Extends RPC to the OO world
● RPC and RMI
– Support programming with interfaces
– Built on top of Request-reply protocols
– Offer similar semantics
– Offer similar level of transparency
● RMI
– Use OO mechanisms
● Object, classes inheritance, OO development methods/tools
– Provide concept of object identity
● All objects have references (local or remote)
● That can be globally accessed
21/22
Remote Method Invocation
Object model
Remote object
Remote
● Object references interface Data
m1 m4
– remote
{
Implementation m5
m2 of methods
m3 m6
● Interfaces
– remote
● Actions Local Local remote
remote invocation invocation invocation

– State change invocation Local


invocation

– Object creation
– Further invocations
● Exception
– Can be generated and “returned”
● Garbage collection
22/22
Remote Method Invocation
Implementation

● Proxy
● Dispatcher
● Skeleton
● Static Generation
– IDL+compiler (Similar to SUN RPC)
● Dynamic invocation
– Language support for refection
● method interception (client)
● Dynamic code loading
23/22
Remote Method Invocation
Execution
● Server/client programs
● Binder/ns
– Process that provides object reference from textual
name
● Server threads
– In order to allow concurrent method execution
– Requires synchronization
● Activation
– When are objects killed?

You might also like