Communication Chapter 2 1 Overview Layered protocols Remote procedure call Remote object invocation Message-oriented communication Stream-oriented communication 2
Layered protocols Low-level layers Transport layer Application layer Middleware layer 3 OSI reference model Bits organized into frames specification and implementation of bits, Error and flow control transmission between sender and receiver Focus on message passing Not all functionality needed 4
Typical message 5 Data Link Protocol example 6
OSI reference model 2-1 Provides communication facilities for Handles distributed packet systems routing 7 Transport layer Provides actual communication facilities to distributed systems Standard protocols TCP: transmission control protocol Connection oriented Reliable Stream-oriented UDP: universal datagram protocol Unreliable (best effort) Data gram oriented 8
Client-Server TCP examples TCP T/TCP for transactions 9 Observations Many application protocols are directly implemented via the transport protocols Examples: News: nntp file transfer: ftp WWW: http New layer: middleware Provide common services to distributed applications 10
Middleware Protocols An adapted reference model for networked communication 11 Middleware layer Rich set of communication protocols Marshalling of data Naming Security Scaling mechanism 12
Understanding RPC Conventional Procedure Call: main program calls read parameters are pushed onto stack 13 Remote Procedure Call Client and Server Stubs 14
Steps of a Remote Procedure Call 1. Client procedure calls client stub in normal way 2. Client stub builds message, calls local OS 3. Client's OS sends message to remote OS 4. Remote OS gives message to server stub 5. Server stub unpacks parameters, calls server 6. Server does work, returns result to the stub 7. Server stub packs it in message, calls local OS 8. Server's OS sends message to client's OS 9. Client's OS gives message to client stub 10. Stub unpacks result, returns to client 15 RPC illustration 16
Passing Parameters? a) Original message on a Pentium b) The message after receipt on a SPARC c) The message after being inverted parameter marshalling 17 Parameter Specification and Stub Generation client and server need to agree on: function name & parameters data representations (encoding) formalized as : interface IDL: interface definition language automatic generation of client stubs help with creation of server stubs 18
other RPC model: Door server process is on same computer 19 Asynchronous RPC (1) synchronous asynchronous 20
Asynchronous RPC (2) two asynchronous RPCs complete logic 21 Example: DCE RPC Distributed Computing Environment Developed by Open Software Foundation Adopted by Microsoft Services Distributed file service Directory service Security service Distributed time service 22
Distributed Computing Environment RPC system Binds client to server Handles message transport Handles data type conversions Allows independence Programming language Operating system Platform 23 Writing a Client and a Server The steps in writing a client and a server in DCE RPC 24
Binding a Client to a Server Client-to-server binding in DCE 25 Remote Object Invocation Proxy/Skeleton instead of stub 26
Different distributed objects Compile-time object Vs. Run-time object Transient object Vs. Persistent object object exists and is fully defined via class/interface class/interface is implemented by run-time construct does object exist beyond lifetime of server 27 Client to object binding Object reference Denotes server, object, protocol Client loads associated stub Binding Explicit Implicit: done automatically 28
Examples: Binding a Client to an Object Distr_object* obj_ref; obj_ref = ; obj_ref-> do_something(); Distr_object objpref; Local_object* obj_ptr; obj_ref = ; obj_ptr = bind(obj_ref); obj_ptr -> do_something(); (a) (b) //Declare a systemwide object reference // Initialize the reference to a distributed object // Implicitly bind and invoke a method //Declare a systemwide object reference //Declare a pointer to local objects //Initialize the reference to a distributed object //Explicitly bind and obtain a pointer to the local proxy //Invoke a method on the local proxy a) implicit binding using only global references b) explicit binding using global and local references 29 Object reference implementations Similar to endpoint managed by daemon May contain URL of implementation file (server, object) pair sufficient Need protocol to load and instantiate code Remote-object references enable call-by-reference semantics 30
Static Remote method invocation Interface and its methods are known Class to proxy is compiled into client code Dynamic Interface and its methods are looked up at run time Method invocation is composed at run time 31 Parameter Passing The situation when passing an object by reference or by value 32
Example I: DCE Distributed-Object Model remote object invocation done via RPC 33 Example II: Java RMI Java enables object distribution via RMI Interface mechanism is part of language Registry service allows naming and lookup of objects rmic compiler generates proxies and skeletons Parameter passing: By value: via serialization By reference: via remote object reference 34
Part II Message-oriented communication Synchronous vs. asynchronous Message queuing systems Message brokers Stream-oriented communication 35 Synchronous communication Client and server are active Clients sends and blocks Server waits for request, then processes Drawbacks: Client cannot do other work while waiting Failures have to be dealt with immediately Model to rigid for most distributed applications (mail, news) 36
Asynchronous communication Processes send messages which are queued Send need not wait for immediate reply Middleware often ensures fault tolerance 37 General organization 38
Persistent: Persistent vs. transient Message is stored at a communications server as long as it takes to deliver Transient: Message is discarded by a communications server as soon as it cannot be delivered 39 Persistent communication: the Pony Express 40
Persistent Asynchronous Communication 41 Persistent Synchronous Communication 42
Transient Asynchronous Communication 43 Receipt-based transient synchronous communication 44
Delivery-based transient synchronous communication at message delivery 45 Response-based transient synchronous communication 46
Message oriented transient communication Typically built on top of simple transport layer message model Examples: Berkeley sockets Message-passing interface (MPI) 47 Berkeley Sockets primitives server Primitive Meaning client Socket Create a new communication endpoint Bind Attach a local address to a socket Listen Announce willingness to accept connections Accept Block caller until a connection request arrives Connect Actively attempt to establish a connection Send Send(write) some data over the connection Receive Receive(read) some data over the connection Close Release the connection 48
Berkeley Sockets communication pattern 49 MPI: Message-passing interface High-performance computers COW & MPP Reliable high-speed interconnect Message is sent to unique process Process belongs to group (groupid, processid) 50
MPI primitives Primitive MPI_bsend MPI_send MPI_ssend MPI_sendrecv MPI_isend MPI_issend MPI_recv MPI_irecv Meaning Append outgoing message to a local send buffer Send a message and wait until copied to local or remote buffer Send a message and wait until receipt starts Send a message and wait for reply Pass reference to outgoing message, and continue Pass reference to outgoing message, and wait until receipt starts Receive a message; block if there are none Check if there is an incoming message, but do not block 51 Message oriented persistent communication Message queuing systems Message-oriented middleware Example: IBM MQSeries 52
Message-Queuing model Message are inserted into queue Message is forwarded from queue to queue Message is read from queue Example: SMTP mail 53 Message-Queuing Model scenarios 54
Message-Queuing Model primitives Primitive Put Get Poll Notify Meaning Append a message to a specified queue Block until the specified queue is nonempty, and remove the first message Check a specified queue for messages, and remove the first. Never block. Install a handler to be called when a message is put into the specified queue. 55 Message-Queuing System architecture Potential bottleneck 56
Message-Queuing System architecture 2-29 Improvement: Routers 57 Message-Queuing models Observation: Assume common messaging protocol Same structure and data representation Solution: Message broker Centralized component to transform messages May provide subject-based routing Acts much like application gateway 58
Message Brokers 59 IBM MQSeries concepts Message sent/received via queues Queues have Queue manager Queue managers connected via unidirectional channel pairs Message channel agent (MCA) at each channel endpoint: Setup channel via transport layer (un)wrap messages to/from transport layer packets Send/receive packets 60
IBM MQSeries illustration 2-31 61 MCA details Attribute Transport type FIFO delivery Message length Setup retry count Delivery retries Description Determines the transport protocol to be used Indicates that messages are to be delivered in the order they are sent Maximum length of a single message Specifies maximum number of retries to start up the remote MCA Maximum times MCA will try to put received message into queue 62
Message Transfer illustration Additional concepts: alias and routing 63 Message Queue Interface (MQI) Primitive MQopen MQclose MQput MQget Description Open a (possibly remote) queue Close a queue Put a message into an opened queue Get a message from a (local) queue 64
Stream-oriented communication Support for continuous media Time dependent Multimedia Streams in distributed systems Stream management 65 Continuous media Values are time dependent: Audio Video Animation Sensor data Transmission modes: Asynchronous: without time restrictions Synchronous: defined max delay Isochronous: defined max and min delay 66
Continuous data stream Connection-oriented communication facility that supports isochronous data transmission Unidirectional: single source, single sink Source or sink may be device wrapper Stream types: Simple: single flow of data Complex: multiple data flows substreams 67 Data Stream illustration 68
Data Stream between two devices 69 Multicast Data Stream 70
QoS: Quality of Service Token bucket algorithm: Tokens added at constant rate if bucket full, tokens will be dropped Tokens removed for transmission of data units 71 QoS: Flow specification Characteristics of the Input maximum data unit size (bytes) Token bucket rate (bytes/sec) Token bucket size (bytes) Maximum transmission rate (bytes/sec) Service Required Loss sensitivity (bytes) Loss interval (µsec) Burst loss sensitivity (data units) Minimum delay noticed (µsec) Maximum delay variation (µsec) Quality of guarantee Better: flow classification with reasonable defaults Ex: audio, video 72
Quality of service Flow specification is translated into resource allocation: Bandwidth Buffers Processing capacity 73 Example: RSVP protocol Steps: Sender sends flow spec to receiver Received sends reservation requests back Sender sends data stream Resource reservation protocol (RSVP) 74
Problem: Stream Synchronization Complex stream with substreams Time dependency between substream Slide show with music Video with audio Stereo audio 75 Synchronization Mechanisms 1/2 based on transmission units 76
Synchronization Mechanisms 2/2 based on middleware interface 77