Chapter 3
Chapter 3
Chapter 3
Transport Layer our goals:
v understand v learn about Internet
principles behind transport layer protocols:
transport layer § UDP: connectionless
A note on the use of these ppt slides:
services: transport
We’re making these slides freely available to all (faculty, students, readers). Computer § multiplexing, § TCP: connection-oriented
They’re in PowerPoint form so you see the animations; and can add, modify,
and delete slides (including this one) and slide content to suit your needs. Networking: A Top demultiplexing reliable transport
They obviously represent a lot of work on our part. In return for use, we only
ask the following: Down Approach § reliable data transfer § TCP congestion control
v If you use these slides (e.g., in a class) that you mention their source
(after all, we’d like people to use our book!)
6th edition § flow control
v If you post any slides on a www site, that you note that they are adapted Jim Kurose, Keith Ross
from (or perhaps identical to) our slides, and note our copyright of this
material.
Addison-Wesley § congestion control
March 2012
Thanks and enjoy! JFK/KWR
lo
transport protocols run in
gi
v
ca
demultiplexing § reliable data transfer end systems
le
nd
§ flow control
-e
3.3 connectionless § send side: breaks app
nd
messages into segments,
tra
transport: UDP § connection management
ns
passes to network layer
po
3.4 principles of reliable 3.6 principles of congestion
rt
control § rcv side: reassembles
data transfer segments into messages,
application
transport
communication physical
network
between hosts 12 kids in Ann’s house sending § congestion control network data link
lo
data link physical
letters to 12 kids in Bill’s
gi
physical
§ flow control
ca
v transport layer:
network
house:
le
data link
nd
logical v hosts = houses § connection setup physical
-e
nd
network
tra
v physical
ns
between processes v app messages = letters in delivery: UDP network
po
data link
envelopes
rt
physical
§ relies on, enhances, v transport protocol = Ann
§ no-frills extension of network
data link application
network layer and Bill who demux to in- “best-effort” IP physical
network transport
network
services house siblings v services not available:
data link
physical data link
physical
v network-layer protocol =
postal service § delay guarantees
§ bandwidth guarantees
host: IP source IP,port: B,80 host: IP host: IP source IP,port: B,80 host: IP
address A dest IP,port: A,9157 source IP,port: C,5775 address C address A dest IP,port: A,9157 source IP,port: C,5775 address C
dest IP,port: B,80 dest IP,port: B,80
source IP,port: A,9157 source IP,port: A,9157
dest IP, port: B,80 dest IP, port: B,80
source IP,port: C,9157 source IP,port: C,9157
dest IP,port: B,80 dest IP,port: B,80
three segments, all destined to IP address: B,
dest port: 80 are demultiplexed to different sockets Transport Layer 3-13 Transport Layer 3-14
v characteristics of unreliable channel will determine v characteristics of unreliable channel will determine
complexity of reliable data transfer protocol (rdt) complexity of reliable data transfer protocol (rdt)
Transport Layer 3-21 Transport Layer 3-22
send receive
side side
rdt2.0: channel with bit errors rdt2.0: channel with bit errors
v underlying channel may flip bits in packet v underlying channel may flip bits in packet
§ checksum to detect bit errors § checksum to detect bit errors
v the question: how to recover from errors: v the question: how to recover from errors:
§ acknowledgements (ACKs): receiver explicitly tells sender § acknowledgements (ACKs): receiver explicitly tells sender
that pkt received OK
that pkt received OK
§ negative acknowledgements (NAKs): receiver explicitly tells
sender that pkt had errors § negative acknowledgements (NAKs): receiver explicitly tells
§ sender sender that pkt had errors
Howretransmits
do humans recover
pkt on receipt from
of NAK“errors” § sender retransmits pkt on receipt of NAK
v new mechanisms in rdt2.0 (beyond rdt1.0):
§ error detection
during conversation? v new mechanisms in rdt2.0 (beyond rdt1.0):
§ receiver feedback: control msgs (ACK,NAK) rcvr- § error detection
>sender § feedback: control msgs (ACK,NAK) from receiver to
sender
U L/R .008
sender = = = 0.00027
RTT + L / R 30.008
v two generic forms of pipelined protocols: go-Back-N,
selective repeat
Transport Layer 3-43 Transport Layer 3-44
Pipelining: increased utilization Pipelined protocols: overview
sender receiver
first packet bit transmitted, t = 0 Go-back-N: Selective Repeat:
last bit transmitted, t = L / R v sender can have up to v sender can have up to N
N unacked packets in unack’ed packets in
first packet bit arrives pipeline pipeline
RTT last packet bit arrives, send ACK
last bit of 2nd packet arrives, send ACK v receiver only sends v rcvr sends individual ack
last bit of 3rd packet arrives, send ACK cumulative ack for each packet
ACK arrives, send next § doesn’t ack packet if
packet, t = RTT + L / R
there’s a gap
3-packet pipelining increases
utilization by a factor of 3!
v sender has timer for v sender maintains timer
oldest unacked packet for each unacked packet
3L / R .0024 § when timer expires, § when timer expires,
U = 0.00081 retransmit only that
sender = =
30.008
retransmit all unacked
RTT + L / R packets unacked packet
Selective repeat:
sender window receiver window
(after receipt) (after receipt)
RTT (milliseconds)
timeout, unnecessary v
timeout
SendBase = InitialSeqNum for ACK=100
event timeout X
ACK=100
retransmit not-yet-acked segment ACK=120
with smallest seq. #
start timer Seq=92, 8 bytes of data Seq=92, 8
ACK received, with ACK field value y SendBase=100 bytes of data
if (y > SendBase) { SendBase=120
ACK=100
SendBase = y ACK=120
/* SendBase–1: last cumulatively ACKed byte */
SendBase=120
if (there are currently not-yet-acked segments)
start timer
lost ACK scenario premature timeout
else stop timer
} Transport Layer 3-67 Transport Layer 3-68
TCP: retransmission scenarios TCP ACK generation [RFC 1122, RFC 2581]
Host A Host B
event at receiver TCP receiver action
arrival of in-order segment with delayed ACK. Wait up to 500ms
Seq=92, 8 bytes of data expected seq #. All data up to for next segment. If no next segment,
expected seq # already ACKed send ACK
Seq=100, 20 bytes of data
ACK=100 arrival of in-order segment with immediately send single cumulative
timeout
timeout
ACK=100
many segments back- seq # ACK=100
to-back ACK=100
§ likely that unacked
§ if segment is lost, there segment lost, so don’t Seq=100, 20 bytes of data
SYNACK(seq=y,ACKnum=x+1)
number");
v simultaneous FIN exchanges can be handled
create new socket for SYN(seq=x)
communication back to client
listen
SYN SYN
rcvd sent
SYNACK(seq=y,ACKnum=x+1)
ESTAB ACK(ACKnum=y+1)
ACK(ACKnum=y+1)
L
CLOSED
v informally: “too many sources sending too much v one router, infinite
buffers
unlimited shared
output link buffers
data too fast for network to handle” v output link capacity: R
v different from flow control! v no retransmission
v manifestations: Host B
delay
a top-10 problem!
lout
v
lout
§ application-layer input = application-layer output: lin = v sender sends only when
lout router buffers available
lin R/2
§ transport-layer input includes retransmissions : l‘in lin
lout
to full buffers to full buffers retransmissions but
asymptotic goodput
v sender only resends if v sender only resends if is still R/2 (why?)
packet known to be lost packet known to be lost lin R/2
Host B Host B
Transport Layer 3-89 Transport Layer 3-90
lout
v sender times out prematurely, retransmissions
including duplicated
v sender times out prematurely, retransmissions
including duplicated
sending two copies, both of that are delivered! sending two copies, both of that are delivered!
which are delivered lin R/2 which are delivered lin R/2
lin
copy
timeout
l'in lout
“costs” of congestion:
v more work (retrans) for given “goodput”
A free buffer space! v unneeded retransmissions: link carries multiple copies of pkt
§ decreasing goodput
Host B
Transport Layer 3-91 Transport Layer 3-92
Causes/costs of congestion: scenario 3 Causes/costs of congestion: scenario 3
v four senders Q: what happens as lin and lin’
increase ? C/2
v multihop paths
A: as red lin’ increases, all arriving
v timeout/retransmit blue pkts at upper queue are
lout
dropped, blue throughput g 0
Host A
lin : original data lout Host B
l'in: original data, plus
retransmitted data lin’ C/2
Approaches towards congestion control Case study: ATM ABR congestion control
two broad approaches towards congestion control: ABR: available bit rate: RM (resource management)
v “elastic service” cells:
end-end congestion network-assisted v if sender’s path v sent by sender, interspersed
control: congestion control: “underloaded”: with data cells
v no explicit feedback v routers provide § sender should use v bits in RM cell set by switches
from network feedback to end systems available bandwidth (“network-assisted”)
v congestion inferred § single bit indicating v if sender’s path § NI bit: no increase in rate
from end-system congestion (SNA, congested: (mild congestion)
observed loss, delay DECbit, TCP/IP ECN, § sender throttled to § CI bit: congestion
v approach taken by ATM) minimum guaranteed indication
TCP § explicit rate for rate v RM cells returned to sender
sender to send at by receiver, with bits intact
LastByteSent-
cwnd: TCP sender
RTT
§ initially cwnd = 1 MSS two segm
ents
to threshold, then grows linearly
§ double cwnd every RTT v loss indicated by 3 duplicate ACKs: TCP RENO
§ done by incrementing § dup ACKs indicate network capable of delivering
cwnd for every ACK four segm
ents
received some segments
v summary: initial rate is § cwnd is cut in half window then grows linearly
slow but ramps up v TCP Tahoe always sets cwnd to 1 (timeout or 3
exponentially fast time
duplicate acks)
exponential
duplicate ACK
dupACKcount++
ACK!
new ACK
new ACK
.
cwnd = cwnd + MSS (MSS/cwnd)
dupACKcount = 0
L
linear? cwnd = 1 MSS
variable ssthresh
cwnd = 1 New ACK
dupACKcount = 0
v dupACKcount == 3 retransmit missing segment cwnd = ssthresh dupACKcount == 3
dupACKcount = 0
v on loss event, ssthresh ssthresh= cwnd/2
cwnd = ssthresh + 3
ssthresh= cwnd/2
cwnd = ssthresh + 3
Connection 1 throughput R
Transport Layer 3-107 Transport Layer 3-108
Fairness (more) Chapter 3: summary
Fairness and UDP Fairness, parallel TCP v principles behind
v multimedia apps often connections transport layer services:
do not use TCP v application can open § multiplexing,
§ do not want rate multiple parallel demultiplexing next:
throttled by congestion connections between two v leaving the
control § reliable data transfer
hosts network “edge”
v instead use UDP: § flow control (application,
v web browsers do this
§ send audio/video at § congestion control transport layers)
constant rate, tolerate v e.g., link of rate R with 9
packet loss
v instantiation, v into the network
existing connections: implementation in the
§ new app asks for 1 TCP, gets rate
“core”
R/10
Internet
§ new app asks for 11 TCPs, gets R/2 § UDP
§ TCP
Transport Layer 3-109 Transport Layer 3-110