distributed systems santa clara university 2016tschwarz/coen 317/communication.pdf · remote object...

114
Communication Distributed Systems Santa Clara University 2016

Upload: phunganh

Post on 17-Sep-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

CommunicationDistributed Systems

Santa Clara University 2016

Page 2: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Protocol Stack• Each layer has its own protocol • Can make changes at one layer without changing

layers above or below • Use well defined interfaces

Page 3: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Protocols

• OSI model was never popular • Physical layer:

• Transmission of bits • Data link layer:

• Organizes bits into frames • Add checksum to frames in order to detect /

correct errors

Page 4: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Layered Protocols• Open Systems Interconnection Reference Model

Page 5: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Layered Protocols

Page 6: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Example Data link layer

Page 7: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Transport Protocols

• Transport layer • Offer a reliable connection

• TCP protocol vs. UDP protocol • There are many new proposals for the transport

layer • E.g. Real-time transport protocol (RTP) for real-

time data transfer

Page 8: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Transport Protocol• Client Server TCP

• TCP not tailored for synchronous request-reply behavior of client-server interaction

• Can use UDP with added reliability features • Transactional TCP:

• Proposal that combines connection setup with sending request.

Page 9: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

T/TCP

Page 10: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Higher Level Protocols• Session Protocol

• Enhancement of transport layer: • Dialog control • Synchronization • Not present in IP suite

• Presentation layer: meaning of bits • Application layer:

• OSI intended a collection of network applications • email, file transfer, terminal emulation

Page 11: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Middleware Protocols

• Middleware lives at the application layer • Can contain general purpose protocols that

warrant their own layer • Examples for middleware services

• Authentication protocols • Authorization protocols • Distributed commit protocols

Page 12: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Middleware Protocols

• Remote procedure calls • Remote object invocation • Message queuing systems • Communication of continuous media through

streams

Page 13: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Network Model for networked communication

Page 14: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Procedure Calls• Birrell & Nelson (1984)

• Programs call procedures on other machines • Remote Procedure Call (RPC) • When process on A calls procedure on B, calling

process on A is suspended • Information is passed through the parameters

from A to B and through the result from B to A

Page 15: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Procedure Calls• Conventional procedure call uses stack

Page 16: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Procedure Calls• Conventional procedure call:

• Call by value • Call by reference • Call by copy / restore

• Caller copies variable to stack • Callee copies overwrites variable on the stack

• Almost like call by reference • But not if same parameter occurs several

times in the parameter list

Page 17: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Procedure Calls• RPC

• Make remote procedure call look like a local one • Use stubs at client and server

Page 18: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Procedure Calls• RPC execution

1. Client procedure calls the client stub in the normal way 2. Client stub builds a message and calls the local OS 3. Client’s OS sends the message to the remote OS 4. Remote OS gives message to the server stub 5. Server stub unpacks parameters and calls server 6. Server does the work and returns the result to the stub 7. Server stub packs result in a message and calls local OS 8. Server’s OS sends message to client’s OS 9. Client’s OS gives message to the client stub 10.Stub unpacks the result and returns to the client

Page 19: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Procedure Calls

Page 20: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Procedure Calls• Passing reference parameters

• How to pass pointers: • Not at all (pointer to an object) • Pack what is pointed to into the message

• as in copy / restore

Page 21: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Procedure Calls• Caller and callee need to use the same standard

for formatting data

A. Message on Pentium B. Message as received on SPARC C. Message on SPARC after reformatting

Page 22: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Procedure Calls• Example

Page 23: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Procedure Calls

• To allow implementation of stubs for RPC • Define interface • Interface Definition Language

Page 24: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Procedure Calls• RPC model assumes that caller and callee only

communicate through message passing • Sometimes caller and callee live in the same

machine • IP calls to the same machine are unnecessarily

complex

Page 25: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Doors

• Some OS offer RPCs for processes collocated on the same machine

• Doors • OS needs to support doors • Sever must register a door before it can be called

• OS returns a door identifier • E.g. Solaris: each door has a file name

Page 26: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Doors

Page 27: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Procedure Calls• Asynchronous RPC

• Request reply behavior can prevent client from doing useful work • as long as it does not depend on the result

• Asynchronous RPC is not blocking

Page 28: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Procedure Calls

(a) Traditional RPC (b)Asynchronous RPC

Page 29: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Procedure Calls• If server gives a result, can combine two

asynchronous RPC to yield deferred synchronous RPC

Page 30: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Procedure Calls• One way RPC:

• Client does not wait for an acknowledgment

Page 31: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

DCE RPC• Distributed Computing Environment

• Middleware system • Layer of abstraction between os and distributed

application • Uses client server model

• DCE consists of (among others) • distributed file service • directory service • security service • distributed time service

Page 32: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

DCE RPC• RPC system allows accessing remote services by

calling a local procedure • RPC locates correct server and binds client and

server software • Handles message transport, fragmentation and

reassembly • Data conversions

Page 33: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

• Interface Definiton Language • IDL files define types, constants, … for

parameter marshaling • Use IDL compiler to generate header file, client

stub, and server stub

DCE RPC

Page 34: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

DCE RPC

Page 35: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

DCE - RPC

Client to Server Binding in DCE

Page 36: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

DCE RPC

• Semantic options • At most once operation • Idempotent

Page 37: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Object Invocation• RPC principles can be applied also to Remote

Objects • Sophisticated systems CORBA and DCOM

• Objects encapsulate data (state) and methods • Methods are made available through an interface

• Distributed Systems: • Separate between interfaces and objects

Page 38: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Object Invocation

Page 39: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Object Invocation• When a client binds to a distributed object • Implementation of the interface — the proxy — is loaded

into the client’s address space • Works like a client stub for RPC

• Proxy: • marshals method invocation into messages • unmarshals reply messages

• Actual object sits at a server machine • Skeleton — server stub:

• Unmarshals method invocations • Marshals replies

Page 40: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Object Invocation

Page 41: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Object Invocation• Objects can be compiled

• Compile-time objects• Define an object by a class implemented in Java/C

++, … • Compilation of class definition gives code to

instantiate Java / C++ … objects • Interfaces are compiled into client-side and server-

side stubs

Page 42: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Object Invocation• Compile time objects depend on a particular programming

language • Alternative:

• Explicitly instantiate objects at run-time • Allows development in several programming languages • But need to result in objects that can be invoked from a remote

machine • Common method: object adapter

• Wrapper around the implementation • Objects are defined in terms of their interface

• Implementation is registered at an adapter • Adapter makes interface available for remote invocations

Page 43: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Object Invocation• Persistent vs. Transient Objects

Page 44: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Object Invocation• Binding a client to an object

• Systems with distributed objects can provide systemwide object references • Can be passed freely around

• Client with object reference needs to bind to the referenced object • Binding places proxy into the client’s address

space

Page 45: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Object Invocation• Implicit binding:

• Client can invoke methods using a reference to the object • Implementation needs to allow client to bind to

the object • Explicit binding

• Client needs to explicitly bind and obtain a pointer to a distributed object

Page 46: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Object Invocation

Code with (a) implicit binding using only global references and (b) with explicit binding with local and global references

Page 47: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Object Invocation• Possible Implementation of implicit binding

• Object reference gives • network address of server • endpoint identifying the server that manages

the object • endpoint = local port dynamically assigned

by server’s OS • indication of which object

Page 48: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Object Invocation• Drawback

• Server crashes and endpoint changes • Object references are now invalid • Could use a local daemon to keep track of the

endpoints • But now server cannot be relocated

• So use a location server • which turns out to not be scalable

Page 49: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Object Invocation• Full object reference

• can also identify network protocol etc. • could have an implementation handle that

contains a complete implementation of the proxy • Client follows link and installs the proxy

Page 50: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Object Invocation• After binding

• Client issues remote method invocation - RMI • Difference between RMI and RPC

• RMI supports systemwide object references • Support of RMI

• specify interface with an interface definition language • or: use a single language to generate stubs

automatically • This is static invocation

• interface of an object are known when client application is developed

Page 51: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Object Invocation• Dynamic Invocation:

• compose a method at runtime • Application selects at runtime which method it

will invoke • invoke(object, method, input_par, output_par)

Page 52: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Object Invocation• Example:

• Static invocation • fobject.append(integer)

• Dynamic invocation • invoke(fobject, id(append), int)

• where id(append) returns an identifier for a method “append”

Page 53: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Object Invocation• Example:

• Object browser that examines objects • Browser support remote object invocation • Binds to a distributed object and presents the

objects interface to the user • At this point, user decides on a method and

parameters

Page 54: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Object Invocation• Passing parameters

• Example: All objects are distributed objects • Use object references to interact with methods • References are passed by value and copied between

machines • For efficiency: treat remote and local objects

differently • If reference is remote:

• Copy reference: pass by reference • If reference is local:

• Referred object is copied pass by value

Page 55: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Object Invocation

Client program on A, server program on C Client uses local and remote reference as parameters in a RMI Copy O1 to server, pass remote reference

Page 56: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Remote Object Invocation• Invoking a method with an object reference can

result in copying an object • Cannot hide this

• there are suddenly two replicas of the object • Need to make a distinction between local and

distributed objects • Violates transparency • Makes it harder to write distributed applications

Page 57: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Example 1: DCE Remote Objects

• DCE Distributed Object Model • Added as extensions to their IDL • With C++ language bindings

• Objects are created by a server • creates local C++ objects • makes methods available to clients

• Two types of objects: • Distributed dynamic object• Distributed named object

Page 58: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Example 1: DCE Distributed Object Model

• Distributed dynamic object • Server creates local object on behalf of a client • Accessible only to that client • Clients call a create RPC • DCE runtime administers the new object and associates it with the

client • Distributed named object

• Created by server to be shared amongst clients • Registered with a directory service • Client can look up directory service and bind to the object • Registration gives

• Unique identifier for the object • Info on how to contact the objects server

Page 59: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Example 1: DCE Distributed Object Model

Dynamic (a) vs named objects in DCE

Page 60: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Example 1: DCE Distributed Object Model

• Remote object invocation • done with RPC • To invoke a method, client passes to the server

• method identifier • identifier of interface that contains the method • parameters

• Server maintains an object table • Objects can be stored on disk instead of staying in

memory • Server then might have to retrieve the object first

Page 61: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Example 1: DCE Distributed Object Model

• DCE have no mechanism to handle transparent object references

• Clients can use binding handles associated with a named object • Contains identification of an interface of the

object • transport protocol used to communicate with

server • server’s host address and endpoint

Page 62: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Example 2: Java RMI• Java:

• Distributed objects are part of the language • Tries to maintain high transparency

• Differences between local and remote objects are hidden (unless it become to inefficient)

Page 63: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Example 2: Java RMI• Java only uses remote objects for distributed

objects • State always resides on a single machine • Interface can be made available to remote

processes • Interfaces are implemented by using a proxy • Proxy appears as a local object in the client’s

address space

Page 64: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Example 2: Java RMI• Differences between local and remote objects

1.Cloning local and remote objects is different • Cloning a local object results in a new object

with the same state • Cloning a remote object can only be done at

the server • Hence, proxies are not cloned • Clients need to bind to the clone if they want

to use it

Page 65: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Example 2: Java RMI• Differences between local and remote objects

2.Blocking an object • Objects can be constructed as “monitors" • by declaring a method as “synchronized" • If two processes call simultaneously a synchronized method, one has to be

blocked • Could block client process in the client stub

• Problem: Need to synchronize between clients on different machines (which is complicated)

• Could only block at the server • Problem: What happens if a client fails (which results in

complications) • Therefore: Java RMI only block object on proxies • Remote objects are not protected natively against simultaneous access

from processed operating on different proxies • Will have to use an explicit distributed locking technique

Page 66: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Example 2: Java RMI• Java Remote Object Invocation

• Java hides most of the differences between local and remote objects

• Primitive or object type can be passed as a parameter to an RMI • If it can be marshaled

• Called serializable• Example: file descriptors and sockets depend

on platform —> cannot be serialized

Page 67: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Example 2: Java RMI• When passing objects during an RMI

• Local objects are passed by value (even if they are arrays)

• Remote objects are passed by reference • Java RMI reference to a remote object

• network address and endpoint of server • local identifier of the object in the server’s

address space • protocol stack used for communication between

server and client

Page 68: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Example 2: Java RMI• Remote object is build from two different classes

• Server class: • implementation of server side code

• Client class: • implementation of a proxy

• Proxies can be marshaled • Can be sent to another client • Serve as references to remote objects

Page 69: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Example 2: Java RMI• Marshaling proxies:

• First possibility: Convert state and code into a byte stream • Would lead to very large references

• Better alternative: Generate implementation handle • Specifies which classes are needed to

construct the proxy • Server might need to download classes

Page 70: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Comparison• Java RMI allows passing proxies as parameters

because every client and server runs the same JVM

• DCE does not share platform, so cannot pass stubs • DCE needs to link to a dynamically to a locally

available stub • But can then use this stub as a parameter in an

RPC

Page 71: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Message oriented communication

• RPC and RMI can hide communication in distributed systems

• Need for alternative communication services • Use explicit messaging

Page 72: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Persistence and Synchronization

Communication System

Page 73: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Persistence and Synchronization

• Persistence • Message is stored until it can be delivered

• Sender or receiver might be down while message travels between communication servers

Page 74: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Persistence and Synchronization

Page 75: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Persistence and Synchronization

• Transient communication • Message is stored by the communication system

only as long as sender and receiver execute

Page 76: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Persistence and Synchronization

• Asynchronous communication • Sender continues immediately after submitting

message for transmission

Page 77: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Persistence and Synchronization

• Synchronous communication • Sender blocks until its message is

• stored in the local buffer at the receiver • or actually delivered to the receiver

Page 78: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Persistence and Synchronization

• Persistent asynchronous communication • Electronic mail

• Persistent synchronous communication • Messages are stored only at the receiving host • Sender is blocked until message reaches

receiver’s buffer • (But receiver does not have to run)

Page 79: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Persistence and Synchronization

• Transient asynchronous communication • UDP • One-way RPC

• Transient synchronous communication • Sender is blocked until the message is stored in

a local buffer at the receiving host • Sender receives ack • Sender continues

• Asynchronous RPC

Page 80: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

(a) persistent asynchronous (b)persistent synchronous (c) transient asynchronous (d)receipt based transient

synchronous (e) delivery based transient

synchronous (f) response based transient

synchronous

Page 81: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Persistence and Synchronization

• Persistent communication is necessary in large-scale and widely dispersed interconnected networks

• Persistency is useful when dealing with failure

Page 82: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

• Berkeley UNIX sockets interface

Message Oriented Transient Communication

Page 83: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Message Oriented Transient Communication

General pattern for socket based communication

Page 84: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Message Oriented Transient Communication

• Message passing interface (MPI) • Standard for message passing • Supports several communication models

Page 85: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Message Oriented Persistent Communication

• Important class of middleware services: • Message Queuing Systems• Message Oriented Middleware (MOM)

• support persistent asynchronous communication • offer intermediate-term storage capacity for

messages

Page 86: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Message Oriented Persistent Communication

• Message Queueing Model • Applications communicate by inserting messages in specific

queues • For sender:

• Guarantee that message will be eventually inserted into the recipients queue

Page 87: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Message Oriented Persistent Communication

• Message Queuing System Interface

Page 88: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Message Oriented Persistent Communication

• Message queuing system • Many allow installing a handler as a callback

function • Invoked when message is put into the queue

• Allow daemon etc to monitor queue for incoming messages

Page 89: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Message Oriented Persistent Communication

• Message-queueing system architecture • Local: on the same machine or the same LAN • Queues distributed over network

Page 90: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Message Oriented Persistent Communication

• Message Queueing System Architecture • Queues managed by queue manager • Some act as routers / relays

• Generate an overlay network • Existence simplifies network administration

• Only routers need to be updated when a queue is moved, inserted, or deleted

• Can also be used to log messages • for security, fault tolerance

Page 91: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Message Oriented Persistent Communication

Page 92: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Message Oriented Persistent Communication

• Message Brokers • Integrate existing and new applications

• Applications need to understand messages • Sender can format outgoing messages

according to the receiver • or: Use a common message format • or: Message brokers convert incoming

messages to a format understood by receiver

Page 93: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Message Oriented Persistent Communication

Page 94: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Message Oriented Persistent Communication

• Message queuing systems are almost like email servers • But:

• email servers directly support endusers • have additional requirements such as

automatic message filtering, …

Page 95: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Message Oriented Persistent Communication

• IBM MQSeries

Page 96: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Message Oriented Persistent Communication

• IBM MQSeries • Queues are managed by queue managers • Message channels connect two queue managers

• unidirectional • reliable • managed by Message Channel Agent (MCA)

• Queue managers can be linked into the same process as an application • Queues are hidden to application • Standard interface for messaging

Page 97: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Message Oriented Persistent Communication

• IBM MQSeries • Message channels

• one send queue • one receive queue • both MCA need to be up for sending a message

• Initialization: • Manually • or: application starts MCA • or: Send queue triggers when message is put into queue, which

starts a handler, to start the sending MCA • or: start MCA over the network

• Termination: • Automatic after a specific time without sending messages

Page 98: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Message Oriented Persistent Communication

Attributes for message channel agents

Page 99: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Message Oriented Persistent Communication

Routing tables and aliases for MQSeries

Page 100: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Message Oriented Persistent Communication

Page 101: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Stream Oriented Communication

• Streams: • Timing is crucial

• Continuous media • Meaning of message depends on temporal

relationship to previous messages • Motion , Audio

• Discrete media • text, still images

Page 102: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Stream Oriented Communication

• Data stream: sequence of data units • Asynchronous transmission mode:

• Data items are transmitted in order • without timing constraints

• Synchronous transmission mode: • Data items are transmitted in order • Maximum end-to-end delay for each unit in the stream

• Isochronous transmission mode: • Data units are transferred on time • Maximum and minimum end-to-end delay

• “Bounded delay jitter"

Page 103: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Stream Oriented Communication

• Simple streams • Complex streams

• consist of several related simple streams, the sub streams

Page 104: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Stream Oriented Communication

(a) stream between two processes

(b) stream between two devices

Page 105: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Stream Oriented Communication

• Multicasting • Receivers can have different requirements • Use filters to adjust quality

Page 106: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Stream Oriented Communication

• Quality of Service (QoS) • Flow specification: bandwidth requirements,

transmission rates, delays, …

Page 107: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Stream Oriented Communication

Token bucket algorithm

Generate tokens at constant rate If bucket is full, tokens fall away Each time application sends data, needs to remove tokens from bucket

Page 108: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Stream Oriented Communication

• Currently, no model for • specifying QoS parameters • describing resources in a communication system • translating QoS parameters to resource usage

Page 109: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Stream Oriented Communication

• QoS protocol: Resource reSerVation Protocol (RSVP)

Page 110: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Stream Oriented Communication

• RSVP • Senders provide flow specification • Hand it over to RSVP process • RSVP process stores specification • Sender sets up path to receiver(s)

• providing flow specification to all intermediate nodes • RSVP server when receiving a reservation request:

• Checks whether enough resources are available • Checks whether receiver has permission to make

the reservation

Page 111: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Stream Oriented Communication

• Stream synchronization • Sub streams in a complex stream need to be

synchronized • Simple form: discrete data stream (slides) and

continuous data stream (audio) • Complex form: Synchronizing video and audio

stream, two audio streams for stereo (with max. jitter of less than 20 μsec

• Need to synchronize between data units

Page 112: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Stream Oriented Communication

• Explicit synchronization at the data level

Page 113: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Stream Oriented Communication

• Synchronization at high level

Page 114: Distributed Systems Santa Clara University 2016tschwarz/COEN 317/Communication.pdf · Remote Object Invocation • Compile time objects depend on a particular programming language

Stream Oriented Communication

• Synchronization at high level: • Multimedia middleware offers interfaces for

controlling video and audio streams • Multiplex different streams into a single stream:

• MPEG streams