Transport Layer 3-2
Principles of Congestion Control
Congestion: informally: “too many sources sending too
much data too fast for network to handle”
manifestations: lost packets (buffer overflow at routers) long delays (queuing in router buffers)
Transport Layer 3-3
Causes/costs of congestion: scenario 1
two senders, two receivers
one router, infinite buffers
large delays when congested
unlimited shared output link buffers
Host Ain : original data
Host B
out
Transport Layer 3-4
Causes/costs of congestion: scenario 2
one router, finite buffers sender retransmission of lost packet
finite shared output link buffers
Host A in : original data
Host B
out
'in : original data, plus retransmitted data
Transport Layer 3-5
Causes/costs of congestion: scenario 3 four senders multihop paths timeout/retransmit
Q: what happens as number of senders increase?
finite shared output link buffers
Host Ain : original data
Host B
out
'in : original data, plus retransmitted data
Transport Layer 3-6
TCP congestion control: cwnd goal: TCP sender should transmit as fast as
possible, but without congesting network Q: how to find rate just below congestion level
each TCP sender sets its own rate, called congestion window (cwnd) 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
Transport Layer 3-8
TCP: congestion avoidance
Increasing sending rate:
How far would the doubling of cwnd go?
Till, it reaches a threshold
After that it increases linearly
Decrease sending rate
Set the threshold value to half of current cwnd
loss: decrease cwnd to 1 and start the slow-start again
What if a loss happens?
Transport Layer 3-9
Popular “flavors” of TCP
ssthresh
ssthresh
TCP Tahoe
TCP Reno
Transmission round
cwnd w
indow
siz
e (
in
segm
ents
)
Transport Layer 3-10
Summary: TCP Congestion Control
when cwnd < ssthresh, sender in slow-start phase, window grows exponentially.
when cwnd >= ssthresh, sender is in congestion-avoidance phase, window grows linearly.
when loss/timeout occurs, ssthresh set to cwnd/2, cwnd set to 1
Transport Layer 3-11
TCP Congestion Control
Numerical example: Assume TCP Tahoe
Initial ssthreshold = 14
First loss occurrence after 9 transmissions. What would be the current congestion window and ssthreshold?
Transport Layer 3-12
TCP Flow Control
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
Transport Layer 3-13
TCP Flow control: how it works
(suppose TCP receiver discards out-of-order segments)
unused buffer space:= rwnd
= RcvBuffer-[LastByteRcvd - LastByteRead]
receiver: advertises unused buffer space by including rwnd value in segment header
sender: limits # of unACKed bytes to rwnd guarantees receiver’s
buffer doesn’t overflow
IPdatagrams
TCP data(in buffer)
(currently)unused buffer
space
applicationprocess
rwndRcvBuffer
Transport Layer 3-14
UDP multimedia apps often do not use TCP
do not want rate throttled by congestion control
instead use UDP: pump audio/video at constant rate, tolerate packet
loss
Transport Layer 3-15
UDP: User Datagram Protocol [RFC 768]
“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