0% found this document useful (0 votes)
41 views

Lecture 21-TCP Congestion Control

Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Lecture 21-TCP Congestion Control

Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 30

Lecture 21: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:

end-end congestion network-assisted


control: congestion control:
• no explicit feedback • routers provide feedback
from network to end systems
• congestion inferred from – single bit indicating
end-system observed congestion (ATM, TCP
loss, delay ECN)
• approach taken by TCP – explicit rate for sender to
send at

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.

• Three basic questions:


• First, how does a TCP sender limit the rate?
• Second, how does a TCP sender perceive that there is congestion on the path?
• And third, what algorithm should the sender use to change its send rate as a function of perceived end-to-end
congestion?

Transport Layer 4
Lecture 21:Congestion Control
TCP congestion control

• Three basic questions:


 First, how does a TCP sender limit the rate?
 Second, how does a TCP sender perceive that there is
congestion on the path?
 And third, what algorithm should the sender use to
change its send rate as a function of perceived end-to-
end congestion?

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

• Three basic questions:


 First, how does a TCP sender limit the rate?
 Second, how does a TCP sender perceive that
there is congestion on the path?
 And third, what algorithm should the sender use to
change its send rate as a function of perceived end-to-
end congestion?

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.

– which is taken by the sender to be an indication of


congestion on the sender-to-receiver path.

Transport Layer 8
Lecture 21:Congestion Control
TCP congestion control

• Three basic questions:


 First, how does a TCP sender limit the rate?
 Second, how does a TCP sender perceive that there is
congestion on the path?
 And third, what algorithm should the sender use to
change its send rate as a function of perceived
end-to-end congestion?

Transport Layer 9
Lecture 21:Congestion Control

TCP Slow Start


 When connection begins,
• When connection begins,
cwnd = 1 MSS increase rate
– Example: MSS = 500 bytes
exponentially fast until
& RTT = 200 msec first loss event
– initial rate = 20 kbps
• available bandwidth may
be >> MSS/RTT
– desirable to quickly ramp
up to respectable rate

Transport Layer 10
Lecture 21:Congestion Control

TCP Slow Start (more)


• When connection begins,
increase rate
Host A Host B
one s e gm
exponentially until first ent

RTT
loss event:
two segm
– double cwnd every RTT en ts

– done by incrementing
cwnd for every ACK
four segm
received ents

• Summary: initial rate is


slow but ramps up
exponentially fast
time

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.

• When does it end?


– TCP’s congestion-avoidance algorithm behaves the same when a timeout occurs.

Transport Layer 15
Lecture 21:Congestion Control

TCP Congestion Control - Fast Recovery

• When do we get to this state?


– loss event also can be triggered by a triple duplicate ACK event
– In this case, the network is continuing to deliver segments from
sender to receiver
– So TCP’s behavior to this type of loss event should be less
drastic than with a timeout-indicated loss

Transport Layer 16
Lecture 21:Congestion Control

TCP Congestion Control - Fast Recovery

• What does TCP do?


– TCP halves the value of cwnd (adding in 3 MSS)
– ssthresh half the value of cwnd
– cwnd is increased by 1 MSS for every duplicate ACK received for the missing segment that
caused TCP to enter the fast-recovery state.

• When does it end?


– when an ACK arrives for the missing segment, TCP enters the congestion-avoidance state.
– If a timeout event occurs, fast recovery transitions to the slow-start state

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

Summary: TCP Congestion


Control
• When cwnd is below ssthresh, sender in slow-start
phase, window grows exponentially.

• When cwnd is above ssthresh, sender is in


congestion-avoidance phase, window grows linearly.

• When a triple duplicate ACK occurs, ssthresh set


to cwnd/2 and cwnd set to ssthresh+3.
• When timeout occurs, ssthresh set to cwnd/2 and
cwnd is set to 1 MSS.

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

additively increase window size …


…. until loss occurs (then cut window in half)
congestion window size

AIMD saw tooth


cwnd: TCP sender

behavior: probing
for bandwidth

time
Transport Layer 22
Lecture 21:Congestion Control

Computer Networking: A Top Down Approach


6th edition
Jim Kurose, Keith Ross
Addison-Wesley
March 2012

A note on the origin of these ppt slides:


These slides are freely provided by the book authors and it represents a lot of work on their part.
We would like to thank J.F Kurose and K.W. Ross.

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

Transport Layer 3-24


Lecture 21:Congestion Control
TCP Futures: TCP over “long, fat
pipes”
• example: 1500 byte segments, 100ms RTT,
want 10 Gbps throughput
• requires W = 83,333 in-flight segments !!

• One of them can be lost, throughput still


possible?
• what fraction of segments could be lost that would
allow the TCP congestion-control algorithm still to
achieve the desired 10 Gbps rate ?
Lecture 21:Congestion Control
TCP Futures: TCP over “long, fat
pipes”

1.22 . MSS
TCP throughput =
RTT L

➜ to achieve 10 Gbps throughput, need a loss rate of L


= 2·10-10 – a very small loss rate!

• equivalently, one loss event for every 5,000,000,000


segments)— a very low rate
• new versions of TCP for high-speed

Transport Layer 3-26


Lecture 21:Congestion Control

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

Transport Layer 3-27


Lecture 21:Congestion Control

Why is TCP fair?

R
Connection 2 throughput equal bandwidth share

loss: decrease window by factor of 2


congestion avoidance: additive increase
loss: decrease window by factor of 2
congestion avoidance: additive increase

Connection 1 throughput R

Transport Layer 3-28


Lecture 21:Congestion Control
Fairness (more)

Fairness and UDP Fairness, parallel TCP


• multimedia apps often connections
do not use TCP • application can open multiple
– do not want rate throttled
parallel connections between
by congestion control
two hosts
• web browsers do this
• instead use UDP:
– send audio/video at
• e.g., link of rate R with 9
constant rate, tolerate existing connections:
packet loss – new app asks for 1 TCP, gets rate
R/10
– new app asks for 11 TCPs, gets
R/2

Transport Layer 3-29


Lecture 21:Congestion Control

Computer Networking: A Top Down Approach


6th edition
Jim Kurose, Keith Ross
Addison-Wesley
March 2012

A note on the origin of these ppt slides:


These slides are freely provided by the book authors and it represents a lot of work on their part.
We would like to thank J.F Kurose and K.W. Ross.

You might also like