Distributed Systems Topic 2 Communication Dr Michael R
Distributed Systems Topic 2: Communication Dr. Michael R. Lyu Computer Science & Engineering Department The Chinese University of Hong Kong © Chinese University, CSE Dept. Distributed Systems / 2 - 1
Outline 1 Communication Protocols 2 Client/Server Communication 3 Group Communication 4 Event Service 5 Summary © Chinese University, CSE Dept. Distributed Systems / 2 - 2
1 Complexity and Heterogeneity intranet ISP % % backbone satellite link desktop computer: server: network link: © Chinese University, CSE Dept. Distributed Systems / 2 - 3
1 Heterogeneous Network Performance Example Range Bandwidth Latency (Mbps) (ms) LAN Ethernet 1 -2 kms 10 -1000 WAN IP routing worldwide 0. 010 -600 100 -500 MAN ATM 250 kms 1 -150 10 Internetwork Internet worldwide 0. 5 -600 100 -500 NFC ISO/IEC 14443 0. 1 – 0. 2 m 0. 4 – 0. 5 1 -10 WPAN Bluetooth (802. 15. 1) 10 - 30 m 0. 5 -20 WLAN Wi. Fi (IEEE 802. 11) 0. 15 -1. 5 km 2 -54 5 -20 WMAN Wi. MAX (802. 16) 550 km 1. 5 -20 WWAN GSM, 3 G phone nets worldwide 0. 01 -02 100 -500 Wired: 1 -10 Wireless: © Chinese University, CSE Dept. Distributed Systems / 2 - 4
1 Conceptual Layering of Protocol Message received Message sent Layer n Layer 2 Layer 1 Sender © Chinese University, CSE Dept. Communication medium Recipient Distributed Systems / 2 - 5
1 The ISO/OSI 7 -Layer Protocol Application Presentation The ISO/OSI Reference Model: Session Transport Network PSE (packet switching exchange) host HTTP, FTP, Telnet XDR, CDR Secure Sockets for connectionoriented comm. message; TCP, UDP packet; IP; ATM VC Data link error-free trans. Physical ISDN, baseband signaling host PSE © Chinese University, CSE Dept. Distributed Systems / 2 - 6
1. 1 ISO/OSI Transport Layer u Level 4 of ISO/OSI reference model. u Concerned with the transport of information through a network. u Two facets in UNIX networks: – TCP – UDP - connection oriented - virtual connection - w sequencing & - connectionless acknowledgement - up to 64 k bytes datagram - no seqs and acks © Chinese University, CSE Dept. Application Presentation Session Transport Network Data link Physical Distributed Systems / 2 - 7
1. 1 ISO/OSI Transport Layer (TCP) u Transmission Control Protocol (TCP) provides bi-directional stream of bytes between two distributed components. u Reliable but slow protocol. u Buffering at both sides decouples computation speeds. u Maximum transfer unit (MTU): the maximum length of a message that can be delivered in a packet. © Chinese University, CSE Dept. Distributed Systems / 2 - 8
1. 1 ISO/OSI Transport Layer (UDP) u User Datagram Protocol (UDP) enables a component to pass a message containing a sequence of bytes to another component. u Other component is identified within message. u Unreliable but very fast protocol. u Restricted message length (usually 64 K bytes). u Queuing at receiver. © Chinese University, CSE Dept. Distributed Systems / 2 - 9
1. 1 TCP/IP Layers in Internet Layers Message Application Messages (UDP) or Streams (TCP) Transport UDP or TCP packets Internet IP datagrams Network interface Network-specific frames Underlying network © Chinese University, CSE Dept. Distributed Systems / 2 - 10
1. 1 The Mobile. IP Routing Mechanism Sender Address of FA returned to sender Subsequent IP packets tunnelled to FA Mobile host MH First IP packet addressed to MH Internet Home agent © Chinese University, CSE Dept. Foreign agent FA First IP packet tunnelled to FA Distributed Systems / 2 - 11
1. 2 ISO/OSI Presentation Layer u At application layer: complex data types u How to transmit complex values through transport layer? u Presentation layer issues: – Complex data structures and – Heterogeneity. Application Presentation Session Transport Network Data link Physical © Chinese University, CSE Dept. Distributed Systems / 2 - 12
1. 2 Middleware Layers Inter-process Communicati on © Chinese University, CSE Dept. Distributed Systems / 2 - 13
1. 2 Complex Data Structures u Marshaling: Disassemble data structures into a transmittable form u Unmarshaling: Re-assemble the complex data structure. © Chinese University, CSE Dept. Distributed Systems / 2 - 14
1. 2 Heterogeneity u Heterogeneous data representation on different hardware platforms. u Approach 1 (Example XDR, CDR): – Define a shared representation, – For each different platform, provide mapping between common and specific representation. u Approach 2 (Example ASN): – Abstract syntax notation. – Notation to include type definition. © Chinese University, CSE Dept. Distributed Systems / 2 - 15
1. 2 Common Data Representation (CDR) u Presentation layer implementation to support heterogeneity in CORBA (Common Object Request Broker Architecture). u Mapping of application layer data types to transport byte stream. u Encodings of – primitive types – constructed types – interoperable object references © Chinese University, CSE Dept. Distributed Systems / 2 - 16
1. 2 CDR Message index in sequence of bytes 0– 3 4– 7 8– 11 12– 15 16– 19 20 -23 24– 27 4 bytes 5 "Smit" "h___" 6 "Lond" "on__" 1934 notes on representation length of string ‘Smith’ length of string ‘London’ unsigned long The flattened form represents a Person struct with value: {‘Smith’, ‘London’, 1934} © Chinese University, CSE Dept. Distributed Systems / 2 - 17
1. 2 Heterogeneous Data Representation u Examples of Heterogeneity – Big-endian versus little-endian data representation – Different encoding schemes for character set – Different ways complex data types are implemented by run-time environment of programming languages u Resolution: Standardized Data Representation u Resolution: Application-Level Transport Protocol u Resolution: Virtual Machines © Chinese University, CSE Dept. Distributed Systems / 2 - 18
1. 2. 1 Big-endian versus Little-endian u. A ‘big-endian’ 4 -byte integer – the word is stored “big-end-first” – the most significant byte is at the first of a four-byte sequence (i. e. , those with a lower address). u. A ‘little-endian’ 4 -byte integer – the word is stored “little-end-first” – the lowest-significant byte is at the first of the sequence. © Chinese University, CSE Dept. Distributed Systems / 2 - 19
1. 3 Communication Patterns u Basic operations: send and receive messages (as in UDP). u Message delivery: – Synchronous or – Asynchronous u Messages are used to model: – Notification and – Request. © Chinese University, CSE Dept. Distributed Systems / 2 - 20
1. 3 Synchronous Communication (1) (2) sender (3) (4) (5) blocked ac kn send Transport Layer receiver blocked Time © Chinese University, CSE Dept. Distributed Systems / 2 - 21
1. 3 Communication Deadlocks P 1: send() to P 2; receive() from P 2; P 2: send() to P 1; receive() from P 1; u Components P 1 Waits-for P 2 © Chinese University, CSE Dept. are mutually waiting for each other. u To avoid deadlocks: Waits-for relation has to be acyclic! Distributed Systems / 2 - 22
1. 3 Asynchronous Communication (1) (2) (3) (4) sender send Transport Layer receiver blocked Time © Chinese University, CSE Dept. Distributed Systems / 2 - 23
1. 3 Notification send(. . . ) Notifier receive(. . . ) Notified u Uni-directional communication u Message contains marshaled notification parameters. © Chinese University, CSE Dept. Distributed Systems / 2 - 24
1. 3 Request send(. . . ) receive(. . . ) request reply Requester receive(. . . ). . . send(. . . ) Provider u Bi-directional communication. u Request message contains marshaled parameters. u Requester receives reply message. u Reply message contains marshaled results. © Chinese University, CSE Dept. Distributed Systems / 2 - 25
1. 3 Reliability Issues u Unreliable message refers to message transmission without acknowledgement or retries (e. g. , UDP). u A reliable delivery service may be constructed from an unreliable one by the use of ack. u Positive ack. for client-server communication and negative ack. for group multicast. u Reliable communication involves overheads. u Each message should have a unique identifier. © Chinese University, CSE Dept. Distributed Systems / 2 - 26
2 Client/Server Communication u Qualities of service. u Request protocol (R). u Request reply protocol (RR). u Request reply acknowledgement protocol (RRA). © Chinese University, CSE Dept. Distributed Systems / 2 - 27
2. 1 Qualities of Service u Exactly once, u At most once, u At least once and u Maybe? © Chinese University, CSE Dept. Distributed Systems / 2 - 28
2. 2 Request Protocol u If service – does not have out or inout parameters and – does not have a return type client may not want to wait for server to finish. execution request send(. . . ) Client © Chinese University, CSE Dept. receive(. . . ) exec op; Server Distributed Systems / 2 - 29
2. 3 Request/Reply Protocol u To be applied if client expects result from server. u Client requests service execution from server through request message. u Delivery of service result in reply message. send(. . . ) receive(. . . ) Client © Chinese University, CSE Dept. request reply receive(. . . ) exec op; send(. . . ) Server Distributed Systems / 2 - 30
2. 4 RRA Protocol u In addition to RR protocol, client sends acknowledgement after it received reply. u Acknowledgement sent asynchronously. send(. . . ) receive(. . . ) send (. . . ) Client © Chinese University, CSE Dept. request reply ackn receive(. . . ) exec op; send(. . . ) receive(. . . ) Server Distributed Systems / 2 - 31
3 Group Communication u Client/server requests: – There is no other party involved. – Client has to identify server. u Sometimes other properties are required: – Communication between multiple components. – Anonymous communication. © Chinese University, CSE Dept. Distributed Systems / 2 - 32
3. 1 Concepts u Broadcast: Send msg to a group. N u Multicast: Send msg to subgroup only. N N M N N N © Chinese University, CSE Dept. M N N Useful applications: ¨Fault tolerance ¨Object location ¨Better performance ¨Multiple update N N Distributed Systems / 2 - 33
3. 2 Qualities of Service u Ideal: R 1 Immediate and reliable. S Time R 2 l R 1 Optimal: Simultaneous and reliable. S R 2 © Chinese University, CSE Dept. Time Distributed Systems / 2 - 34
3. 2 Qualities of Service u In reality: not simultaneous. . . R 1 S Time R 2 R 1 . . . and not reliable S R 2 © Chinese University, CSE Dept. Time Distributed Systems / 2 - 35
3. 2 Qualities of Service u Problem: To achieve reliable broadcast/multicast is very expensive. u Degrees of reliability: – Best effort, – K-reliability, – totally ordered, – Atomicity. u Choose the degree of reliability needed and be prepared to pay the price. © Chinese University, CSE Dept. Distributed Systems / 2 - 36
4 Event Management u Event management service defines interfaces for different group communication models. u Events are created by suppliers (producers) and communicated through an event channel to multiple consumers. u Service does not define a quality of service (left to implementers). © Chinese University, CSE Dept. Distributed Systems / 2 - 37
4. 1 Push Model u Consumers register with the event channels through which the events the consumers are interested in can be communicated. u Event producers create a new event by invoking a push operation from an event channel. u Event channel notifies all registered consumers by invoking their push operations. © Chinese University, CSE Dept. Distributed Systems / 2 - 38
4. 1 Push Model (Example) Share value updated Producer push(. . . ) © Chinese University, CSE Dept. Redisplay chart Event Channel Consumer push(. . . ) Redisplay table Consumer push(. . . ) Distributed Systems / 2 - 39
4. 2 The Pull Model u Event producer registers its capability of producing events with event channel. u Consumer obtains event by invoking pull operation from event channel. u Event channel asks producer to produce event and delivers it to the consumer. © Chinese University, CSE Dept. Distributed Systems / 2 - 40
4. 2 Pull Model (Example) Current value: 76. 10 Producer pull(. . . ) © Chinese University, CSE Dept. Current share value? Event Channel Consumer pull(. . . ) Distributed Systems / 2 - 41
4. 2 Event Channel Push supplier Push consumer Event Channel Direction of event transfer Pull supplier © Chinese University, CSE Dept. Supported combinations: ¨push suppliers, push consumers ¨push suppliers, pull consumers ¨pull suppliers, push consumers ¨pull suppliers, pull consumers Pull consumer Distributed Systems / 2 - 42
4. 2 Event Channel (with proxies) Proxy push consumer Push supplier Proxy push supplier Push consumer Event Channel Direction of event transfer Proxy pull consumer Pull supplier © Chinese University, CSE Dept. Proxy pull supplier Pull consumer Distributed Systems / 2 - 43
5 Summary u What communication protocols do we use? u How are differences between application and communication layer resolved? u What quality of service do the client/server protocols achieve that we discussed? u What quality of services are involved in group communication? u Event service for group communication. u Read Textbook Chapter 3 through Chapter 6. © Chinese University, CSE Dept. Distributed Systems / 2 - 44
- Slides: 44