Lecture 21-TCP Congestion Control
Lecture 21-TCP Congestion Control
Lecture 21
TCP Congestion Control
Lecture 21:Congestion Control
Principles of congestion
control
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)
• a top-10 problem!
Transport Layer 2
Lecture 21:Congestion Control
Approaches towards congestion
control
two broad approaches towards congestion control:
Transport Layer 3
Lecture 21:Congestion Control
TCP congestion control
• Each sender limits the rate at which it sends traffic into its connection as a function of perceived network congestion.
Transport Layer 4
Lecture 21:Congestion Control
TCP congestion control
Transport Layer 5
Lecture 21:Congestion Control
TCP Congestion Control: details
sender sequence number space
cwnd TCP sending rate:
• roughly: send cwnd
bytes, wait RTT for
last byte last byte ACKS, then send more
ACKed sent, not- sent
yet ACKed
(“in-flight”)
bytes
cwnd
• sender limits transmission: rate ~
~ bytes/sec
RTT
LastByteSent - LastByteAcked
< min{cwnd, rwnd}
• cwnd is dynamic, function of
perceived network congestion
Transport Layer 6
Lecture 21:Congestion Control
TCP congestion control
Transport Layer 7
Lecture 21:Congestion Control
How does sender perceive
congestion?
• Let us define a “loss event” at a TCP sender as
the occurrence of either a timeout or the receipt
of three duplicate ACKs from the receiver.
Transport Layer 8
Lecture 21:Congestion Control
TCP congestion control
Transport Layer 9
Lecture 21:Congestion Control
Transport Layer 10
Lecture 21:Congestion Control
RTT
loss event:
two segm
– double cwnd every RTT en ts
– done by incrementing
cwnd for every ACK
four segm
received ents
Transport Layer 11
Lecture 21:Congestion Control
When does the Slow Start
end?
• First, if there is a loss event (i.e., congestion) indicated by a timeout,
– TCP sender sets the value of cwnd to 1, restart Slow Start
– ssthresh variable (“slow start threshold”) to cwnd/2
• The second way in which slow start may end is directly tied to the value of ssthresh
– When cwnd equals ssthresh, slow start ends and TCP transitions into congestion avoidance
mode.
– Why not keep doubling?
Transport Layer 12
Lecture 21:Congestion Control
When does the Slow Start
end?
• The final way in which slow start can end is if three
duplicate ACKs are detected,
– TCP performs a fast retransmit and enters the fast recovery
state.
Transport Layer 13
Lecture 21:Congestion Control
TCP Congestion Control - Congestion
Avoidance
• When do we get to this state
– value of cwnd is approximately half its value when congestion was last
encountered
– congestion could be just around the corner!
• Rather than doubling the value of cwnd every RTT, TCP adopts a
more conservative approach and increases the value of cwnd by just
a single MSS every RTT (i.e MSS/cwnd bytes)
Transport Layer 14
Lecture 21:Congestion Control
TCP Congestion Control - Congestion
Avoidance
• This can be accomplished in several ways.
– TCP sender increases cwnd by MSS bytes (MSS/cwnd) when- ever a new acknowledgment
arrives.
– For example, if MSS is 1,460 bytes and cwnd is 14,600 bytes, then 10 segments are being sent
within an RTT.
– Each arriving ACK (assuming one ACK per segment) increases the congestion window size by
1/10 MSS.
Transport Layer 15
Lecture 21:Congestion Control
Transport Layer 16
Lecture 21:Congestion Control
Transport Layer 17
Lecture 21:Congestion Control
TCP Congestion Control - Fast
Recovery
• Fast recovery is a recommended, but not
required, component of TCP
– Early version of TCP, TCP Tahoe, unconditionally cut
its congestion window to 1 MSS.
– The newer version of TCP, TCP Reno, incorporated
fast recovery.
Transport Layer 18
Lecture 21:Congestion Control
TCP Congestion Control - Fast
Recovery
Transport Layer 19
Lecture 21:Congestion Control
Transport Layer 20
Lecture 21:Congestion Control
Summary: TCP Congestion
Control
New
New ACK!
duplicate ACK
ACK! new ACK
.
cwnd = cwnd + MSS (MSS/cwnd)
dupACKcount++ new ACK dupACKcount = 0
cwnd = cwnd+MSS transmit new segment(s), as allowed
dupACKcount = 0
transmit new segment(s), as allowed
cwnd = 1 MSS
ssthresh = 64 KB cwnd > ssthresh
dupACKcount = 0
slow congestion
start timeout
avoidance
ssthresh = cwnd/2
cwnd = 1 MSS duplicate ACK
timeout dupACKcount = 0 dupACKcount++
retransmit missing segment
ssthresh = cwnd/2
cwnd = 1 MSS
dupACKcount = 0
retransmit missing segment
timeout
New
ACK!
ssthresh = cwnd/2
cwnd = 1 New ACK
dupACKcount = 0
retransmit missing segment cwnd = ssthresh dupACKcount == 3
dupACKcount == 3 dupACKcount = 0
ssthresh= cwnd/2 ssthresh= cwnd/2
cwnd = ssthresh + 3.MSS cwnd = ssthresh + 3.MSS
retransmit missing segment retransmit missing segment
fast
recovery
duplicate ACK
cwnd = cwnd + MSS
transmit new segment(s), as allowed
21
Lecture 21:Congestion Control
TCP congestion control:
additive increase multiplicative decrease
approach: sender increases transmission rate (window size),
probing for usable bandwidth, until loss occurs
additive increase: increase cwnd by 1 MSS every RTT until
loss detected
multiplicative decrease: cut cwnd in half after loss
behavior: probing
for bandwidth
time
Transport Layer 22
Lecture 21:Congestion Control
Transport Layer 23
Lecture 21:Congestion Control
TCP throughput
• avg. TCP thruput as function of window
size, RTT?
– ignore slow start, assume always data to send
• W: window size (measured in bytes) where loss
occurs
– avg. window size 3 W
(# in-flight bytes) is ¾ W
avg TCP thruput = bytes/sec
4 RTT
– avg.Wthruput is 3/4W per RTT
W/2
1.22 . MSS
TCP throughput =
RTT L
TCP Fairness
fairness goal: if K TCP sessions share same
bottleneck link of bandwidth R, each should
have average rate of R/K
TCP connection 1
bottleneck
router
capacity R
TCP connection 2
R
Connection 2 throughput equal bandwidth share
Connection 1 throughput R