TCP Congestion Control Tuning
Understand and tune Linux TCP congestion control algorithms like CUBIC and BBR to improve throughput and latency on real-world networks.
TCP Congestion Control Tuning is a free Linux Networking & TCP/IP for Developers lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Linux Networking & TCP/IP for Developers learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
What Congestion Control Does
TCP congestion control decides how fast a sender may transmit without overwhelming the network.
It governs the trade-off between throughput and latency, and the right algorithm can dramatically change performance.
The Congestion Window
The congestion window (cwnd) limits how many unacknowledged bytes are in flight. Algorithms grow and shrink cwnd in response to ACKs and loss signals.
Too small wastes bandwidth; too large causes loss and bufferbloat.
Loss-Based vs Latency-Based
Two families exist:
- Loss-based (CUBIC, Reno) grow until packets drop
- Latency/model-based (BBR) estimate bandwidth and RTT to avoid filling buffers
BBR often wins on long-distance, lossy links.
Listing Available Algorithms
See which algorithms the kernel has loaded.
sysctl net.ipv4.tcp_available_congestion_controlChecking the Current Algorithm
CUBIC is the Linux default. Confirm what is active.
sysctl net.ipv4.tcp_congestion_controlEnabling BBR
Load the BBR module, then set it as the default. BBR pairs best with the fq queue discipline.
sudo modprobe tcp_bbr
sudo sysctl -w net.ipv4.tcp_congestion_control=bbr
sudo sysctl -w net.core.default_qdisc=fqMaking Changes Persistent
Runtime sysctl changes are lost on reboot. Persist them in /etc/sysctl.d/.
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbrTuning Buffer Sizes
Congestion control can only fill a window the buffers allow. For high bandwidth-delay-product paths, raise the autotuning maximums.
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216The Bandwidth-Delay Product
Optimal window size = bandwidth x round-trip time. A 1 Gbps link with 100 ms RTT needs about 12.5 MB of buffer to stay full.
Undersized buffers cap throughput regardless of the algorithm.
Observing Connections
Inspect live socket state, cwnd, and RTT with ss to confirm tuning is taking effect.
ss -tinMeasuring the Impact
Benchmark before and after with a tool like iperf3 across a real path. Always measure both throughput and latency, since aggressive tuning can trade one for the other.
iperf3 -c remote-host -t 30Quick Check
Test your congestion control knowledge.
Recap
You can now tune TCP congestion control:
- Understand cwnd and the bandwidth-delay product
- Compare loss-based (CUBIC) vs model-based (BBR)
- Enable BBR with the
fqqdisc and persist it - Size
tcp_rmem/tcp_wmembuffers correctly - Verify with
ss -tinand benchmark withiperf3
This extends your kernel parameter and benchmarking lessons.
Frequently asked questions
Is the “TCP Congestion Control Tuning” lesson free?
Yes — the full text of “TCP Congestion Control Tuning” is free to read here on the web, and the Linux Networking & TCP/IP for Developers course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Linux Networking & TCP/IP for Developers course, upgrade to CoddyKit PRO.
What will I learn in “TCP Congestion Control Tuning”?
Understand and tune Linux TCP congestion control algorithms like CUBIC and BBR to improve throughput and latency on real-world networks. You practise Linux Networking & TCP/IP for Developers with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Linux Networking & TCP/IP for Developers?
No prior experience is required. Linux Networking & TCP/IP for Developers on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “TCP Congestion Control Tuning” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Linux Networking & TCP/IP for Developers lesson?
Yes. Every Linux Networking & TCP/IP for Developers lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Kernel Network Parameters
- NIC Tuning & Optimization
- Benchmarking Network Throughput
- TCP Congestion Control Tuning