1dt057 distributed information system chapter 3 transport layer

44
2 : A p p l i c a t i o n L a y e r 1 1DT057 Distributed Information System Chapter 3 Transport Layer

Upload: carminda-ruiz

Post on 02-Jan-2016

39 views

Category:

Documents


0 download

DESCRIPTION

1DT057 Distributed Information System Chapter 3 Transport Layer. Chapter 3: Transport Layer. Our goals: understand principles behind transport layer services: multiplexing/demultiplexing reliable data transfer flow control congestion control. - PowerPoint PPT Presentation

TRANSCRIPT

2: A

pplica

tion La

yer

1

1DT057Distributed Information System

Chapter 3Transport Layer

CHAPTER 3: TRANSPORT LAYER

Tra

nsp

ort La

yer

3-2

Our goals: understand

principles behind transport layer services: multiplexing/

demultiplexing reliable data transfer flow control congestion control

learn about transport layer protocols in the Internet: UDP: connectionless

transport TCP: connection-oriented

transport

CHAPTER 3 OUTLINE

Tra

nsp

ort La

yer

3-3

3.1 Transport-layer services

3.2 Multiplexing and demultiplexing

3.3 Connectionless transport: UDP

3.4 Principles of reliable data transfer

3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control Congestion control

TRANSPORT VS. NETWORK LAYER

Tra

nsp

ort La

yer

3-4

network layer: logical communication between hosts

transport layer: logical communication between processes relies on, enhances,

network layer services

INTERNET TRANSPORT-LAYER PROTOCOLSTra

nsp

ort La

yer

3-5

reliable, in-order delivery (TCP) congestion control flow control connection setup

unreliable, unordered delivery: UDP no-frills extension of

“best-effort” IP services not available:

delay guarantees bandwidth guarantees

application

transportnetworkdata linkphysical network

data linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

application

transportnetworkdata linkphysical

logical end-end transport

CHAPTER 3 OUTLINE

Tra

nsp

ort La

yer

3-6

3.1 Transport-layer services

3.2 Multiplexing and demultiplexing

3.3 Connectionless transport: UDP

3.4 Principles of reliable data transfer

3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control Congestion control

MULTIPLEXING/DEMULTIPLEXING

Transport Layer

3-7

application

transport

network

link

physical

P1 application

transport

network

link

physical

application

transport

network

link

physical

P2P3 P4P1

host 1 host 2 host 3

= process= socket

delivering received segmentsto correct socket

Demultiplexing at rcv host:gathering data from multiplesockets, enveloping data with header (later used for demultiplexing)

Multiplexing at send host:

HOW DEMULTIPLEXING WORKSTra

nsp

ort La

yer

3-8

host receives IP datagrams each datagram has source IP

address, destination IP address

each datagram carries 1 transport-layer segment

each segment has source, destination port number

host uses IP addresses & port numbers to direct segment to appropriate socket

source port # dest port #

32 bits

applicationdata

(message)

other header fields

TCP/UDP segment format

CONNECTIONLESS DEMUX (CONT)

DatagramSocket serverSocket = new DatagramSocket(6428);

3-9

Tra

nsp

ort La

yer

ClientIP:B

P2

client IP: A

P1P1P3

serverIP: C

SP: 6428

DP: 9157

SP: 9157

DP: 6428

SP: 6428

DP: 5775

SP: 5775

DP: 6428

SP provides “return address”

CHAPTER 3 OUTLINE

Tra

nsp

ort La

yer

3-10

3.1 Transport-layer services

3.2 Multiplexing and demultiplexing

3.3 Connectionless transport: UDP

3.4 Principles of reliable data transfer

3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control congestion control

UDP: USER DATAGRAM PROTOCOL [RFC 768]

Tra

nsp

ort La

yer

3-11

“no frills,” “bare bones” Internet transport protocol

“best effort” service, UDP segments may be: lost delivered out of order

to app connectionless:

no handshaking between UDP sender, receiver

each UDP segment handled independently of others

Why is there a UDP? no connection

establishment (which can add delay)

simple: no connection state at sender, receiver

small segment header no congestion control:

UDP can blast away as fast as desired

UDP: MORETra

nsp

ort La

yer

3-12

often used for streaming multimedia apps loss tolerant rate sensitive

other UDP uses DNS SNMP

reliable transfer over UDP: add reliability at application layer application-specific

error recovery!

source port # dest port #

32 bits

Applicationdata

(message)

UDP segment format

length checksumLength, in

bytes of UDPsegment,including

header

CHAPTER 3 OUTLINE

Tra

nsp

ort La

yer

3-13

3.1 Transport-layer services

3.2 Multiplexing and demultiplexing

3.3 Connectionless transport: UDP

3.4 Principles of reliable data transfer

3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control congestion control

PRINCIPLES OF RELIABLE DATA TRANSFER

Tra

nsp

ort La

yer

3-14

important in app., transport, link layers top-10 list of important networking topics!

characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt)

PRINCIPLES OF RELIABLE DATA TRANSFER

Tra

nsp

ort La

yer

3-15

important in app., transport, link layers top-10 list of important networking topics!

characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt)

PRINCIPLES OF RELIABLE DATA TRANSFER

Tra

nsp

ort La

yer

3-16

important in app., transport, link layers top-10 list of important networking topics!

characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt)

RDT3.0 EXAMPLE

3-17

Tra

nsp

ort La

yer

RDT3.0 EXAMPLE

3-18

Tra

nsp

ort La

yer

PERFORMANCE OF RDT3.0Tra

nsp

ort La

yer

3-19

rdt3.0 works, but performance stinks ex: 1 Gbps link, 15 ms prop. delay, 8000 bit packet:

U sender: utilization – fraction of time sender busy sending

U sender

= .008

30.008 = 0.00027

microseconds

L / R

RTT + L / R =

1KB pkt every 30 msec -> 33kB/sec thruput over 1 Gbps link

network protocol limits use of physical resources!

dsmicrosecon8bps10

bits80009

R

Ldtrans

RDT3.0: STOP-AND-WAIT OPERATION

3-20

Tra

nsp

ort La

yer

first packet bit transmitted, t = 0

sender receiver

RTT

last packet bit transmitted, t = L / R

first packet bit arriveslast packet bit arrives, send ACK

ACK arrives, send next packet, t = RTT + L / R

U sender

= .008

30.008 = 0.00027

microseconds

L / R

RTT + L / R =

PIPELINED PROTOCOLSTra

nsp

ort La

yer

3-21

Pipelining: sender allows multiple, “in-flight”, yet-to-be-acknowledged pkts range of sequence numbers must be increased buffering at sender and/or receiver

Two generic forms of pipelined protocols: go-Back-N, selective repeat

PIPELINING: INCREASED UTILIZATION

3-22

Tra

nsp

ort La

yer

first packet bit transmitted, t = 0

sender receiver

RTT

last bit transmitted, t = L / R

first packet bit arrives

last packet bit arrives, send ACK

ACK arrives, send next packet, t = RTT + L / R

last bit of 2nd packet arrives, send ACKlast bit of 3rd packet arrives, send ACK

U sender

= .024

30.008 = 0.0008

microseconds

3 * L / R

RTT + L / R =

Increase utilizationby a factor of 3!

PIPELINING PROTOCOLS

Tra

nsp

ort La

yer

3-23

Go-back-N: overview sender: up to N

unACKed pkts in pipeline

receiver: only sends cumulative ACKs doesn’t ACK pkt if

there’s a gap sender: has timer for

oldest unACKed pkt if timer expires:

retransmit all unACKed packets

Selective Repeat: overview

sender: up to N unACKed packets in pipeline

receiver: ACKs individual pkts

sender: maintains timer for each unACKed pkt if timer expires: retransmit

only unACKed packet

GO-BACK-N

Tra

nsp

ort La

yer

3-24

Sender: k-bit seq # in pkt header “window” of up to N, consecutive unACKed pkts allowed

ACK(n): ACKs all pkts up to, including seq # n - “cumulative ACK” may receive duplicate ACKs (see receiver)

timer for each in-flight pkt timeout(n): retransmit pkt n and all higher seq # pkts in

window

GBN INACTION

3-25

Tra

nsp

ort La

yer

GBN DEMO

3-26

Tra

nsp

ort La

yer

http://www.cs.mum.edu/courses/cs450/GoBackN.htm

SELECTIVE REPEATTra

nsp

ort La

yer

3-27

receiver individually acknowledges all correctly received pkts buffers pkts, as needed, for eventual in-order

delivery to upper layer sender only resends pkts for which ACK not

received sender timer for each unACKed pkt

sender window N consecutive seq #’s again limits seq #s of sent, unACKed pkts

SELECTIVE REPEAT: SENDER, RECEIVER WINDOWS

3-28

Tra

nsp

ort La

yer

SELECTIVE REPEATTra

nsp

ort La

yer

3-29

data from above : if next available seq # in

window, send pkt

timeout(n): resend pkt n, restart

timer

ACK(n) in [sendbase,sendbase+N]:

mark pkt n as received if n smallest unACKed

pkt, advance window base to next unACKed seq #

senderpkt n in [rcvbase, rcvbase+N-

1]

send ACK(n) out-of-order: buffer in-order: deliver (also

deliver buffered, in-order pkts), advance window to next not-yet-received pkt

pkt n in [rcvbase-N,rcvbase-1]

ACK(n)

otherwise: ignore

receiver

SELECTIVE REPEAT IN ACTION

3-30

Tra

nsp

ort La

yer

SELECTIVE REPEAT: DILEMMA

Tra

nsp

ort La

yer

3-31

Example: seq #’s: 0, 1, 2, 3 window size=3

receiver sees no difference in two scenarios!

incorrectly passes duplicate data as new in (a)

Q: what relationship between seq # size and window size?

SELECTIVE REPEAT DEMO

3-32

Tra

nsp

ort La

yer

http://www.eecis.udel.edu/~amer/450/TransportApplets/SR/SRindex.html

CHAPTER 3 OUTLINE

Tra

nsp

ort La

yer

3-33

3.1 Transport-layer services

3.2 Multiplexing and demultiplexing

3.3 Connectionless transport: UDP

3.4 Principles of reliable data transfer

3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control Congestion control

TCP: OVERVIEW RFCS: 793, 1122, 1323, 2018, 2581

Tra

nsp

ort La

yer

3-34

full duplex data:

connection-oriented:

flow controlled:

point-to-point:

reliable, in-order byte steam:

pipelined:

send & receive buffers

socketdoor

T C Psend buffer

T C Preceive buffer

socketdoor

segm ent

applicationwrites data

applicationreads data

TCP SEQ. #’S AND ACKS

Tra

nsp

ort La

yer

3-35

Seq. #’s: byte stream

“number” of first byte in segment’s data

ACKs: seq # of next byte

expected from other side

cumulative ACK

Host A Host B

Seq=42, ACK=79, data = ‘C’

Seq=79, ACK=43, data = ‘C’

Seq=43, ACK=80

Usertypes

‘C’

host ACKsreceipt

of echoed‘C’

host ACKsreceipt of

‘C’, echoesback ‘C’

timesimple telnet scenario

TCP RELIABLE DATA TRANSFER

Tra

nsp

ort La

yer

3-36

TCP creates rdt service on top of IP’s unreliable service

pipelined segments cumulative ACKs TCP uses single

retransmission timer

retransmissions are triggered by: timeout events duplicate ACKs

TCP: RETRANSMISSION SCENARIOS

3-37

Tra

nsp

ort La

yer

Host A

Seq=100, 20 bytes data

ACK=100

timepremature timeout

Host B

Seq=92, 8 bytes data

ACK=120

Seq=92, 8 bytes data

Seq=

92

tim

eout

ACK=120

Host A

Seq=92, 8 bytes data

ACK=100

loss

tim

eout

lost ACK scenario

Host B

X

Seq=92, 8 bytes data

ACK=100

time

Seq=

92

tim

eout

SendBase= 100

SendBase= 120

SendBase= 120

Sendbase= 100

TCP RETRANSMISSION SCENARIOS (MORE)

3-38

Tra

nsp

ort La

yer

Host A

Seq=92, 8 bytes data

ACK=100

loss

tim

eout

Cumulative ACK scenario

Host B

X

Seq=100, 20 bytes data

ACK=120

time

SendBase= 120

TCP FLOW CONTROL

Tra

nsp

ort La

yer

3-39

receive side of TCP connection has a receive buffer:

speed-matching service: matching send rate to receiving application’s drain rate app process may be

slow at reading from buffer

sender won’t overflow

receiver’s buffer bytransmitting too

much, too fast

flow control

IPdatagrams

TCP data(in buffer)

(currently)unused buffer

space

applicationprocess

CHAPTER 3 OUTLINE

Tra

nsp

ort La

yer

3-40

3.1 Transport-layer services

3.2 Multiplexing and demultiplexing

3.3 Connectionless transport: UDP

3.4 Principles of reliable data transfer

3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control congestion control

PRINCIPLES OF CONGESTION CONTROL

Tra

nsp

ort La

yer

3-41

Congestion: informally: “too many sources sending too

much data too fast for network to handle” different from flow control! manifestations:

lost packets (buffer overflow at routers) long delays (queueing in router buffers)

TCP CONGESTION CONTROL:

3-42

Tra

nsp

ort La

yer

goal: TCP sender should transmit as fast as possible, but without congesting network Q: how to find rate just below congestion level

decentralized: each TCP sender sets its own rate, based on implicit feedback: ACK: segment received (a good thing!),

network not congested, so increase sending rate

lost segment: assume loss due to congested network, so decrease sending rate

TCP CONGESTION CONTROL: BANDWIDTH PROBING

3-43

Tra

nsp

ort La

yer

“probing for bandwidth”: increase transmission rate on receipt of ACK, until eventually loss occurs, then decrease transmission rate continue to increase on ACK, decrease on loss (since

available bandwidth is changing, depending on other connections in network)

ACKs being received, so increase rate

X

X

XX

Xloss, so decrease rate

send

ing r

ate

time

TCP’s“sawtooth”behavior

CHAPTER 3: SUMMARY

Tra

nsp

ort La

yer

3-44

principles behind transport layer services: multiplexing, demultiplexing reliable data transfer flow control congestion control

instantiation and implementation in the Internet UDP TCP

Next: leaving the network

“edge” (application, transport layers)

into the network “core”