Chapter 24 of 28

TCP Congestion Control

Imagine a highway with thousands of cars. If too many cars enter the highway at the same time, traffic jams start to happen.

A computer network can have the same problem. If too much data is sent into the network at once, routers and links can become overloaded. Packets may be delayed or dropped.

This situation is called network congestion.

TCP Congestion Control is the set of mechanisms TCP uses to control its sending rate so that it does not overwhelm the network.

In simple words:

TCP Congestion Control prevents a sender from putting too much traffic into the network at once.


What Is Network Congestion?

Network congestion happens when the amount of traffic entering a network is greater than what the network can handle.

For example:

Many Senders
     ↓
   Router
     ↓
  [Overloaded]
     ↓
Packets delayed/dropped

When congestion occurs:

  • Packets may be delayed

  • Packets may be dropped

  • Queues at routers can grow

  • Network performance can decrease

TCP tries to detect signs of congestion and adjust its sending rate.


Why Does TCP Need Congestion Control?

Suppose a server can send data at a very high speed, but the network path between the server and client can handle only a limited amount of traffic.

If the server keeps sending at maximum speed:

Sender
  ↓
Too much traffic
  ↓
Network becomes congested
  ↓
Packets are dropped
  ↓
Retransmissions
  ↓
More traffic

This can make the situation even worse.

TCP therefore increases its sending rate carefully and reduces it when it detects signs of congestion.


Congestion Window (cwnd)

One of the most important concepts in TCP congestion control is the congestion window, commonly written as cwnd.

The congestion window limits how much data TCP can have in flight based on its estimate of network capacity.

There are actually two important limits:

  • Receive Window (rwnd) → Protects the receiver

  • Congestion Window (cwnd) → Helps protect the network

TCP's effective sending window is constrained by both.

A simplified relationship is:

Effective Sending Window
        ≈
minimum(rwnd, cwnd)

So even if the receiver can accept a lot of data, TCP may still limit transmission because of network congestion.


Main TCP Congestion Control Mechanisms

Traditional TCP congestion control is commonly explained using four major ideas:

  1. Slow Start

  2. Congestion Avoidance

  3. Fast Retransmit

  4. Fast Recovery

Different TCP implementations use different algorithms and improvements, but these concepts are important for understanding the basics.


1. Slow Start

Despite its name, Slow Start can increase the congestion window quite rapidly.

When a TCP connection begins, the sender does not know how much traffic the network can handle.

So it starts with a relatively small congestion window and increases it as acknowledgments arrive.

Conceptually:

1 → 2 → 4 → 8 → 16 → ...

This behavior is commonly described as exponential growth, although the exact behavior depends on the TCP implementation and conditions.

The purpose is to quickly discover available network capacity without immediately sending a huge amount of traffic.


2. Congestion Avoidance

Once the congestion window reaches a certain threshold, TCP generally changes to a more cautious growth strategy.

This phase is called Congestion Avoidance.

Instead of rapidly increasing the window, TCP increases it more gradually.

A simplified example:

16 → 17 → 18 → 19 → 20 → ...

This helps TCP use available bandwidth while reducing the risk of causing congestion.


3. Fast Retransmit

TCP can detect packet loss without always waiting for a retransmission timer to expire.

If a receiver receives later data while an earlier segment is missing, it can send duplicate acknowledgments for the missing portion.

For example:

Sender → Segment 1
Sender → Segment 2
Sender → Segment 3
Sender → Segment 4

Receiver receives:
1, 3, 4

Receiver → Duplicate ACK
Receiver → Duplicate ACK

Multiple duplicate acknowledgments can indicate that a segment was probably lost.

Fast Retransmit allows TCP to retransmit the missing segment sooner instead of waiting for the retransmission timeout.


4. Fast Recovery

After detecting packet loss through duplicate acknowledgments, some TCP congestion-control algorithms reduce their sending rate and then recover without returning all the way to the initial slow-start behavior.

This is known as Fast Recovery.

The exact behavior depends on the TCP congestion-control algorithm being used.

The general idea is:

Normal Transmission
       ↓
Packet Loss Detected
       ↓
Reduce Sending Rate
       ↓
Recover Gradually

What Happens When Congestion Is Detected?

TCP treats packet loss and other signals as evidence that the network may be congested.

A simplified view is:

Increase Sending Rate
        ↓
Network Congestion?
      /     \
    No       Yes
    ↓         ↓
Increase    Reduce
further     sending rate
              ↓
        Increase gradually

This continuous adjustment allows TCP to adapt to changing network conditions.


AIMD

A common concept associated with traditional TCP congestion control is AIMD, which stands for:

Additive Increase, Multiplicative Decrease

Additive Increase

When the network appears healthy, TCP gradually increases its congestion window.

Multiplicative Decrease

When congestion is detected, TCP reduces its congestion window significantly.

A simplified example:

10 → 11 → 12 → 13 → 14
                         ↓
                    Congestion
                         ↓
                         7
                    ↓
                  8 → 9 → 10

The exact values and behavior depend on the TCP algorithm.

AIMD helps TCP find a balance between using available bandwidth and avoiding excessive congestion.


Flow Control vs Congestion Control

This is one of the most important distinctions in TCP.

Flow Control

Flow control protects the receiver.

It asks:

"Can the receiving device handle this much data?"

TCP uses the receive window (rwnd) for this purpose.

Congestion Control

Congestion control protects the network.

It asks:

"Can the network path handle this much traffic?"

TCP uses the congestion window (cwnd) and congestion-control algorithms.

Flow Control

Congestion Control

Protects receiver

Protects network

Based on receiver capacity

Based on network conditions

Uses receive window

Uses congestion window

Prevents receiver overload

Helps prevent network overload


Simple Example

Imagine you are downloading a large file.

At first, TCP sends data cautiously:

Small amount
     ↓
Network
     ↓
ACKs received
     ↓
Send more

As long as the network appears healthy, TCP increases its sending rate.

If packet loss suggests congestion:

Packet Loss
     ↓
Congestion Detected
     ↓
Reduce Sending Rate
     ↓
Recover Gradually

So TCP is constantly trying to find a good sending rate for the current network conditions.


Modern TCP Congestion Control

It is important to know that TCP congestion control is not one single algorithm.

Different operating systems and network environments can use different algorithms, such as:

  • Reno

  • New Reno

  • CUBIC

  • BBR

They use different strategies to estimate network capacity and respond to congestion.

For beginners, however, the most important concepts are congestion window, slow start, congestion avoidance, packet loss, and rate reduction.

Conclusion

TCP Congestion Control is used to prevent TCP from overwhelming the network with too much traffic.

TCP adjusts its sending rate based on signals about network conditions.

The key concepts are:

  • cwnd → Controls the amount of data TCP can have in flight based on congestion conditions

  • Slow Start → Rapidly increases the sending window when starting or recovering

  • Congestion Avoidance → Increases the sending rate more cautiously

  • Fast Retransmit → Quickly retransmits likely-lost data

  • Fast Recovery → Recovers after certain loss events without restarting from the beginning

  • AIMD → Traditional principle of increasing gradually and decreasing significantly after congestion

The easiest way to remember it is:

Flow Control → Don't overwhelm the receiver.

Congestion Control → Don't overwhelm the network.