You are on page 1of 62

Distributed Systems

Communication

Prof. Dr.-Ing. Torben Weis


Universitt Duisburg-Essen
Example: Online shop I

Customers computer Online store computer

Customers can
Browse the inventory
Search for items
Order items

Universitt Duisburg-Essen Torben Weis 2


Verteilte Systeme
Example: Online shop (2)

Online store computer runs some shop


program
Customers computer runs a shopping program
Computers are connected by a network
Processes exchange messages
Give me an inventory list
List of items
Order an item
Order acknowledged

Universitt Duisburg-Essen Torben Weis 3


Verteilte Systeme
Messages

Sender and receiver must agree on several


things
How are messages transmitted physically?
Used voltage for 0 or 1?
What is the last bit?
Error handling
What should happen in case of errors?
What is the meaning of the bits in the message?
Is it text? US-ASCII?
A custom format?
Various other agreements on all levels have to
be made this is called a Protocol
Universitt Duisburg-Essen Torben Weis 4
Verteilte Systeme
Protocol

Set of conventions to allow computer systems to


exchange information
Both syntactic and semantic
Rules governing the interactions between computers
Formats of the exchanged data

Universitt Duisburg-Essen Torben Weis 5


Verteilte Systeme
Example: Online shop (3)

Typically client and server are not in the same


network
No direct connection

Instead: INTERconnected NETworks


With different technologies (Ethernet LAN, WLAN,
ATM, )
Connected via routers

Communication will be rather complex!

Universitt Duisburg-Essen Torben Weis 6


Verteilte Systeme
Example: Heterogeneous Networks

Router

Online shop computer

Internet
Ethernet LAN

Router

Subscriber line

Online shop customer

Universitt Duisburg-Essen Torben Weis 7


Verteilte Systeme
Dealing with Complexity

Divide system into subsystems


Elements with common properties
Each offering services to other subsystems
Most common approach in computer sciences!

Advantages
Smaller units of development
Reuse
Maintainability
Portability

Universitt Duisburg-Essen Torben Weis 8


Verteilte Systeme
Layering and Partitioning

Layering
Each subsystem represents a different level of
abstraction
Layers are built on top of each other

Partitioning
Each subsystem deals with one aspect of the
functionality of the system

Both approaches are often used together

Universitt Duisburg-Essen Torben Weis 9


Verteilte Systeme
Layered Architecture

Each layer
Has a well defined interface
Provides services for the upper
Layer n layer using the lower layers
Layer n-1 Hides parts of the lower layers

Layer 2

Layer 1

Universitt Duisburg-Essen Torben Weis 10


Verteilte Systeme
Interface

Defines the syntax of a service


Name of available functions
Type of parameters
Return types
Exceptions

There can be multiple implementations


(services) of an interface

Universitt Duisburg-Essen Torben Weis 11


Verteilte Systeme
Layering: Examples

Operating systems
Hardware abstraction layer, kernel layer, applications

Application

Kernel

HAL

Kernel interface:
int read( char* buffer, int len )

Universitt Duisburg-Essen Torben Weis 12


Verteilte Systeme
Discussion: Layering

Advantages
Increasing levels of abstraction during design
Eases enhancements
Isolates code changes
Possible specification of interface standards

Problems
Identification of a clean layer
Overhead

Universitt Duisburg-Essen Torben Weis 13


Verteilte Systeme
ISO/OSI Reference Model

OSI model created by ISO


OSI: Open Systems Interconnect
ISO: International Organization for Standardization

Defines a layered architecture for network


protocols (protocol stack)

Universitt Duisburg-Essen Torben Weis 14


Verteilte Systeme
ISO/OSI Reference Model

Sending:
Each layer passes data to the one below
The lowest layer physically transmits it

Receiving:
The lowest layer receives data
Each layer passes it up till the top layer is reached

Identical layers on two computers communicate


using a protocol

Universitt Duisburg-Essen Torben Weis 15


Verteilte Systeme
ISO/OSI Layers

7. Application layer Telnet, FTP,

6. Presentation layer ISO-PP (X.226), ASN.1 BER

5. Session layer ISO-SP (X.225), SIP

4. Transport layer ISO-TP, TCP, UDP

3. Network layer NetBEUI, IP

2. Data Link layer Ethernet, Token Ring, ATM

1. Physical layer RS232, 100BaseT

Universitt Duisburg-Essen Torben Weis 16


Verteilte Systeme
Layers and Protocols

Universitt Duisburg-Essen Torben Weis 17


Verteilte Systeme
ISO/OSI Layer Description I

1. Physical layer
Physical transmission of bits and bytes as (electric)
signals
E.g. modem, wireless, smoke signs,

2. Data Link layer


Data transmission between directly connected
stations
Media access control, frames, checksums, flow control

Universitt Duisburg-Essen Torben Weis 18


Verteilte Systeme
ISO/OSI Layer Description II

3. Network layer
End-to-end data transmission between computers in
all connected networks
Accepting and forwarding packets, routing
4. Transport layer
End-to-end data transmission between processes on
computers
E.g. ports, flow control, ordering

Universitt Duisburg-Essen Torben Weis 19


Verteilte Systeme
ISO/OSI Layer Description II

5. Session layer
Provides a (virtual) connection between processes
Build up and tear down connections

6. Presentation layer
Defines how the data being transmitted should be
represented

7. Application layer
Application-specific protocols

Universitt Duisburg-Essen Torben Weis 20


Verteilte Systeme
The message is being
passed up the layers
Data Flow through the Layers till the target process
is reached
A process on Computer A wants
It passes the to send a message M to a
process on Computer B
message to the
top layer
M
A B M

Each layer adds header


information to the message and
Application layer passes it to the layer below, Application layer
H1 M this could be addresses, H1 M
Presentation layer checksums Presentation layer
H2 H1 M H2 H1 M
..passing it up to the network
Session layer layer consuming the header Session layer
H3 H2 information H3 H2
Transport layer Router Transport
The networklayer
layer
H4 H3 decides which H4 H3
Network layer Network layer Network
network layerto
device
H5 H4 H5 H6 pass the message to H5 H4
Data Link layer Data Link layer Data Link layer
H6 H5 H6 H7 H6 H5
Physical layer Physical layer Physical layer
H7 H6 H7 H6

A router receives the The message is being The target computer


The message is being Universitt Duisburg-Essen
message on one transmitted physically receives the message
Torben Weis 21
transmitted physically Verteilte Systeme
network device
Internet Model

4. Application layer HTTP, FTP, DNS,

3. Transport layer TCP, UDP

2. Internet layer IPv4, IPv6, ARP, IPX

1. Host-to-network layer Ethernet, WLAN (802.11 WiFi), Token Ring, FDDI

HTTP = Hypertext Transfer Protocol


DNS = Domain Name System
TCP = Transmission Control Protocol
UDP = User Datagram Protocol
ICMP = Internet Control Message Protocol
WLAN = Wireless Local Area Network
Universitt Duisburg-Essen Torben Weis 22
Verteilte Systeme
Internet Layer Description

1. Host-to-network layer
Physical data transmission between directly connected
stations

2. Internet layer
End-to-end data transmission between computers in all
connected networks

3. Transport layer
End-to-end data transmission between processes on
computers

4. Application layer
Application-specific protocols

Universitt Duisburg-Essen Torben Weis 23


Verteilte Systeme
Comparison I

Application layer

Application layer Presentation layer

Session layer

Transport layer Transport layer

Internet layer Network layer

Data Link layer


Host-to-network layer
Physical layer

Universitt Duisburg-Essen Torben Weis 24


Verteilte Systeme
Comparison II

ISO/OSI
Standard legislated by officially recognized body
First model, then protocols
Universality
Complex implementations
Bad timing

Internet
Standard adopted due to widespread use
Protocols built the model
Simplicity
Simple, robust (and available) implementations
Universitt Duisburg-Essen Torben Weis 25
Verteilte Systeme
NETWORK LAYER

Universitt Duisburg-Essen Torben Weis 26


Verteilte Systeme
Network Layer

How is data transferred through the network?


Circuit switching
Dedicated circuit per communication process
Setup at start required
Teardown at end required
E.g. telephone system (POTS)
Packet switching
Data is transferred in discrete packets
Packets are independently forwarded to the next hop
(store-and-forward)
E.g. snail mail

Universitt Duisburg-Essen Torben Weis 27


Verteilte Systeme
Circuit Switching

Universitt Duisburg-Essen Torben Weis 28


Verteilte Systeme
Circuit Switching

Universitt Duisburg-Essen Torben Weis 29


Verteilte Systeme
Circuit Switching

Universitt Duisburg-Essen Torben Weis 30


Verteilte Systeme
Circuit Switching

Universitt Duisburg-Essen Torben Weis 31


Verteilte Systeme
Circuit Switching

Universitt Duisburg-Essen Torben Weis 32


Verteilte Systeme
Circuit Switching

Universitt Duisburg-Essen Torben Weis 33


Verteilte Systeme
Circuit Switching

Universitt Duisburg-Essen Torben Weis 34


Verteilte Systeme
Circuit Switching

Universitt Duisburg-Essen Torben Weis 35


Verteilte Systeme
Circuit Switching: Discussion

Advantages
Fixed bandwidth (guaranteed capacity)
Low variance in latency (almost constant)
E.g. video and audio transmission

Disadvantages
Extra overhead and delay because of setup and
teardown
Waste of resources when low utilization
Low scalability

Universitt Duisburg-Essen Torben Weis 36


Verteilte Systeme
Packet Switching

Universitt Duisburg-Essen Torben Weis 37


Verteilte Systeme
Packet Switching

Universitt Duisburg-Essen Torben Weis 38


Verteilte Systeme
Packet Switching

Universitt Duisburg-Essen Torben Weis 39


Verteilte Systeme
Packet Switching

Universitt Duisburg-Essen Torben Weis 40


Verteilte Systeme
Packet Switching

Universitt Duisburg-Essen Torben Weis 41


Verteilte Systeme
Packet Switching

Universitt Duisburg-Essen Torben Weis 42


Verteilte Systeme
Packet Switching

Universitt Duisburg-Essen Torben Weis 43


Verteilte Systeme
Packet Switching: Discussion

Advantages
Efficient resource usage
No setup required
Flexible

Disadvantages
No guarantee in delay and bandwidth
(quality of service)

Universitt Duisburg-Essen Torben Weis 44


Verteilte Systeme
TRANSPORT LAYER

Universitt Duisburg-Essen Torben Weis 45


Verteilte Systeme
Transport Layer

Connection-oriented communication
Error-free transmission (mostly)
Correct ordering
No data drop or duplicates
Flow control
E.g. TCP (Transmission Control Protocol)

Connectionless communication
Best effort delivery of datagrams
E.g. UDP (User Datagram Protocol)

Universitt Duisburg-Essen Torben Weis 46


Verteilte Systeme
Connection-oriented Communication

Sender Receiver

Connection request Connection indication

Connection confirm Connection accept


Data

Disconnect request Disconnect indication

Disconnect confirm Disconnect response

Universitt Duisburg-Essen Torben Weis 47


Verteilte Systeme
Connectionless Communication

Sender Receiver

Data

Universitt Duisburg-Essen Torben Weis 48


Verteilte Systeme
Transport Layer: Discussion

Connection-oriented
Much overhead
Convenient to use

Connectionless
Less overhead
Datagram ordering, dealing with datagram loss is left
to application
E.g. for audio and video streaming

Universitt Duisburg-Essen Torben Weis 49


Verteilte Systeme
Sockets

Programming interface on transport layer


Stream socket: uses TCP
Datagram socket: uses UDP

Supported on most platforms

Universitt Duisburg-Essen Torben Weis 50


Verteilte Systeme
APPLICATION LAYER

Universitt Duisburg-Essen Torben Weis 51


Verteilte Systeme
Application Layer: HTTP

Hypertext Transfer Protocol


Specified by Internet Engineering Task Force (IETF)
The protocol of the World Wide Web
Request/response scheme
Stateless
Features
Available for all platforms
Simple text-based protocol
Simple security features (HTTPS for network security)
Gets along with firewalls
Universitt Duisburg-Essen Torben Weis 52
Verteilte Systeme
HTTP Basics

Simple flow of action


Client connects to HTTP server
Client sends HTTP request
Server sends HTTP response
Connection is closed (or kept alive for more requests)
Request and Response consist of
Request or status line
Header
Empty line
Optional body

Universitt Duisburg-Essen Torben Weis 53


Verteilte Systeme
HTTP Request

Structure:
Request line with
HTTP method (GET, HEAD, POST, PUT,)
Requested resource
Header with optional header fields
E.g. Content-Length
Body with content (e.g. POST)

Universitt Duisburg-Essen Torben Weis 54


Verteilte Systeme
HTTP Response

Structure
First line with status code
E.g. 200 OK, 404 Not Found
Header with optional header fields
Body with content of requested resource

Universitt Duisburg-Essen Torben Weis 55


Verteilte Systeme
HTTP GET Request Example

GET /search?how+does+http+work HTTP/1.0


User-Agent: Mozilla/5.0
Accept: text/xml,text/html,text/plain
Connection: close

Universitt Duisburg-Essen Torben Weis 56


Verteilte Systeme
HTTP POST Request Example

POST /search HTTP/1.0


User-Agent: Mozilla/5.0
Accept: text/xml,text/html,text/plain
Content-Length: 24
Connection: close

Query=how+does+http+work

Universitt Duisburg-Essen Torben Weis 57


Verteilte Systeme
HTTP Response Example

HTTP/1.1 200 OK
Connection: close
Date: Mon, 12 Jul 2004 17:19:58 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Content-Length: 39455
Content-Type: text/html
Expires: Mon, 12 Jul 2004 17:19:58 GMT
Cache-control: private

<HTML>
<HEAD>

Universitt Duisburg-Essen Torben Weis 58


Verteilte Systeme
Keep-Alive

Thought: what if we want to request multiple


resources?
Close connection after each response?
Overhead for TCP handshake
TCP slow start
Keep connections alive?
Idle connections take up resources (e.g. socket buffer)
When to reclaim unused connections?
HTTP: kept open unless signaled by client
Closed by client/server after timeout
Universitt Duisburg-Essen Torben Weis 59
Verteilte Systeme
HTTP Streaming

Thought: how to stream a live video over HTTP?


Just send a very long body?
Content-Length must be announced

Content-Length: 999999999?
Many implementations wait until response is complete

Transfer-Encoding: chunked
Send data in chunks (announce length of each chunk)
Good HTTP implementations support pushing data
chunks to application for continuous processing

Universitt Duisburg-Essen Torben Weis 60


Verteilte Systeme
Server Push

Thought: can the server push data to the client?


E.g. send message in a web-based chat

Change roles: web server connects to browser?


Firewall will block connections attempts to user device

Long polling: client sends requests


Response blocks until data is available

WebSockets: start with HTTP


Upgrade to arbitrary bidirectional protocol

Universitt Duisburg-Essen Torben Weis 61


Verteilte Systeme
HTTP Summary

Supported on all platforms


Simple text-based protocol
Usually gets along with firewalls

Universitt Duisburg-Essen Torben Weis 62


Verteilte Systeme

You might also like