TCP
Congestion Control Algorithms One big difference between TCP and UDP is the
congestion control algorithm. The TCP congestion algorithm prevents a sender
from overrunning the capacity of the network (for example, slower WAN links).
TCP can adapt the sender's rate to network capacity and attempt to avoid
potential congestion situations. In order to understand the difference between
TCP and UDP, understanding basic TCP congestion control algorithms is very
helpful. Several congestion control enhancements have been added and suggested
to TCP over the years. This is still an active and ongoing research area, but
modern implementations of TCP contain four intertwined algorithms as basic
Internet standards:
·
Slow
·
Congestion
·
Fast
·
Fast recovery
Slow
Start: Old
implementations of TCP start a connection with the sender injecting multiple
segments into the network, up to the window size advertised by the receiver.
Although this is OK when the two hosts are on the same LAN, if there are
routers and slower links between the sender and the receiver, problems can
arise. Some intermediate routers cannot handle it, packets get dropped, and
retransmission results and performance is degraded.
Congestion
Avoidance: The
assumption of the algorithm is that packet loss caused by damage is very small
(much less than 1%). Therefore, the loss of a packet signals congestion
somewhere in the network between the source and destination. There are two
indications of packet loss:
A timeout occurs.
Duplicate ACKs are received.
Congestion avoidance and slow start are independent algorithms with different
objectives. But when congestion occurs, TCP must slow down itstransmission rate
of packets into the network and invoke slow start to get things going again. In
practice, they are implemented together. Congestion avoidance and slow start
require that two variables be maintained for each connection:
A congestion window, cwnd
A slow start threshold size, ssthresh
Fast Retransmit: Fast retransmit avoids having TCP
wait for a timeout to resend lost segments. Modifications to the congestion
avoidance algorithm were proposed in 1990. Before describing the change,
realize that TCP can generate an immediate acknowledgment (a duplicate ACK)
when an out-of-order segment is received. This duplicate ACK should not be
delayed. The purpose of this duplicate ACK is to let the other end know that a
segment was received out of order and to tell it what sequence number is
expected.
Fast
recovery: After
fast retransmit sends what appears to be the missing segment, congestion
avoidance, but not slow start, is performed. This is the fast recovery
algorithm. It is an improvement that allows high throughput under moderate
congestion, especially for large windows. The reason for not performing slow
start in this case is that the receipt of the duplicate ACKs tells TCP more
than just a packet has been lost. Because the receiver can only generate the
duplicate ACK when another segment is received, that segment has left the
network and is in the receiver's buffer. That is, there is still data flowing
between the two ends, and TCP does not want to reduce the flow abruptly by
going into slow start.