TCP Congestion Control

Runs in browser

Visualize AIMD and other algorithms

Algorithm

Parameters

cwnd
1.0
ssthresh
32.0
Phase
slow start
Step
0

Events

How to Use

Select algorithm and start simulation.

You will see:

  • Congestion Window (cwnd) growth
  • Packet Loss events & Recovery
  • Algorithm behavior (AIMD/CUBIC)
Congestion Window Over Time
0 16 32 48 64Time (RTT)
cwnd
ssthresh
Packet Loss

AIMD (Additive Increase, Multiplicative Decrease)

Slow Start: cwnd doubles every RTT until ssthresh

Congestion Avoidance: cwnd increases by 1 per RTT

On Loss: ssthresh = cwnd/2, cwnd = ssthresh

Algorithm
aimd
Current cwnd
1.0
ssthresh
32.0
Phase
slow start
Loss Events
0

TCP Congestion Control: The Traffic Cop of the Internet

TCP Congestion Control is the fundamental mechanism that prevents the global Internet from collapsing under its own weight. While Flow Control (the receiver throttling the sender) protects a slow device from being overwhelmed, Congestion Control protects the network (the routers and switches between them) from being saturated with more data than it can physically carry.

Key Concepts

  • Congestion Window (cwnd): Max data in flight without ACK
  • Slow Start: Exponential growth until threshold
  • Congestion Avoidance: Linear growth after threshold
  • Fast Retransmit: Retransmit on 3 duplicate ACKs
  • Fast Recovery: Avoid slow start after packet loss

Common Algorithms

AIMD (Reno)

Additive Increase, Multiplicative Decrease. Classic algorithm: increase by 1, halve on loss.

CUBIC

Linux default. Uses cubic function for window growth. Better for high-bandwidth networks.

BBR

Google's Bottleneck Bandwidth and RTT. Measures available bandwidth directly.

When Congestion Occurs

TCP detects congestion through:

  • Timeout: No ACK received — severe congestion, reset to slow start
  • 3 Duplicate ACKs: Packet lost but network flowing — fast recovery
  • ECN: Explicit Congestion Notification from routers

💡 Pro Tips

  • Use BBR for better performance on lossy networks
  • Tune initial cwnd for faster startup (Linux: tcp_initcwnd)
  • Monitor retransmission rates to detect congestion
  • Consider QUIC for applications needing lower latency

References & Further Reading