Advanced Computer Networks: TCP Congestion Control Thanks To Kamil Sarac
Advanced Computer Networks: TCP Congestion Control Thanks To Kamil Sarac
What is congestion?
Increase in network load results in decrease
of useful work done
Different sources compete for resources inside
network
Why is it a problem?
Sources are unaware of current state of resource
Sources are unaware of each other
In many situations, this will result in decrease in
throughput
Source (congestion collapse)
1 1 0 -M
bps
Ethe
rnet Router Destination
1.5-Mbps T1 link
FD DI
ps
Source -Mb
100
2
Issues
How to deal with congestion?
pre-allocate resources so as to avoid
congestion (avoidance)
control congestion if (and when) it occurs
(control)
Two points of implementation
hosts at the edges of the network (transport
protocol)
routers inside the network (queuing discipline)
Underlying service model
best-effort data delivery
MaxWin = MIN(CongestionWindow,
AdvertisedWindow)
EffWin = MaxWin - (LastByteSent -
LastByteAcked)
Slow Start
Initial value: Set cwnd = 1
Note: Unit is a segment size. TCP actually is based on bytes
and increments by 1 MSS (maximum segment size)
cw nd = 2
14 cw nd = 4
12
10 ssthresh cw nd = 8
Cwnd (in segments)
8
6
4 cw nd = 9
2
0
0
6
t=
t=
t=
t=
Roundtrip times cw nd = 10
Responses to Congestion
So, TCP assumes there is congestion if it detects a
packet loss
A TCP sender can detect lost packets via:
Expiration of a retransmission timer
Receipt of a duplicate ACK (why?)
1K SeqNo=204
segment has been lost. 8
1K SeqNo=30
72
AckNo=1024
1K SeqNo=40
96
Timeout:
Retransmit
Slow Start
Fast Recovery
Fast recovery avoids slow 1K SeqNo=0
start after a fast
retransmit AckNo=1024
1K SeqNo=10
24
Tahoe
time
Reno
cwnd
time
TCP CC
TCP New Reno
When multiple packets are dropped, Reno has problems
Partial ACK:
Occurs when multiple packets are lost
A partial ACK acknowledges some, but not all packets that are
outstanding at the start of a fast recovery, takes sender out of
fast recovery
Sender has to wait until timeout occurs
New Reno:
Partial ACK does not take sender out of fast recovery
Partial ACK causes retransmission of the segment
following the acknowledged segment
New Reno can deal with multiple lost segments without
going to slow start
SACK
SACK = Selective acknowledgment
TCP SACK:
Enters fast recovery upon 3 duplicate ACKs
Sender keeps track of SACKs and infers if segments are lost.
Sender retransmits the next segment from the list of
segments that are deemed lost.
Congestion Avoidance
TCPs strategy
control congestion once it happens
repeatedly increase load in an effort to find the point at
which congestion occurs and then back off
Alternative strategy
predict when congestion is about to happen
reduce rate before packets start being discarded
call this congestion avoidance, instead of congestion
control
Two possibilities
host-centric: TCP Vegas
router-centric: DECbit and RED Gateways
g1100
nr
ie 900
sending dt
700
n 500
u
rate eo 300
Sr 100
n 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5
i Time (seconds)
e
z
i 10
s
buffer at e 5
bottleneck router u
e
u
Q 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5
Time (seconds)
Algorithm
Let BaseRTT be the minimum of all measured RTTs
(commonly the RTT of the first packet)
If not overflowing the connection, then
ExpectRate = CongestionWindow/BaseRTT
Source calculates sending rate (ActualRate) once
per RTT
Source compares ActualRate with ExpectRate