0Pricing
Linux Networking & TCP/IP for Developers · 课时

TCP 拥塞控制调优

了解并调优 Linux TCP 拥塞控制算法,例如 CUBIC 和 BBR,从而改善真实网络中的吞吐量和延迟。

TCP 拥塞控制调优 是 CoddyKit 上的免费 Linux Networking & TCP/IP for Developers 课时。 这是第 4 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 Linux Networking & TCP/IP for Developers 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 Linux Networking & TCP/IP for Developers 课程共包含 4 节课。

本课时的部分内容尚未翻译,以英文显示。

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_control

Checking the Current Algorithm

CUBIC is the Linux default. Confirm what is active.

sysctl net.ipv4.tcp_congestion_control

Enabling 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=fq

Making 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=bbr

Tuning 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 16777216

The 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 -tin

Measuring 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 30

Quick 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 fq qdisc and persist it
  • Size tcp_rmem/tcp_wmem buffers correctly
  • Verify with ss -tin and benchmark with iperf3

This extends your kernel parameter and benchmarking lessons.

常见问题解答

「TCP 拥塞控制调优」课时是免费的吗?

是的 — 「TCP 拥塞控制调优」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 Linux Networking & TCP/IP for Developers 课程的其余内容,请升级到 CoddyKit PRO。 Linux Networking & TCP/IP for Developers 课程共包含 4 节课。

「TCP 拥塞控制调优」这节课中我会学到什么?

了解并调优 Linux TCP 拥塞控制算法,例如 CUBIC 和 BBR,从而改善真实网络中的吞吐量和延迟。 你通过在浏览器中直接运行的动手代码来练习 Linux Networking & TCP/IP for Developers,全天候 AI 导师会在你学习这节课的过程中回答你的问题。

学习 Linux Networking & TCP/IP for Developers 需要有经验吗?

无需任何先前经验。CoddyKit 上的 Linux Networking & TCP/IP for Developers 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 4 节课,共 4 节。

「TCP 拥塞控制调优」课时需要多长时间?

大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。

我能在这节 Linux Networking & TCP/IP for Developers 课中编写并运行代码吗?

能。每节 Linux Networking & TCP/IP for Developers 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。

此课程中的所有课时

  1. 内核网络参数
  2. NIC 调优与优化
  3. 网络吞吐量基准测试
  4. TCP 拥塞控制调优
← 返回 Linux Networking & TCP/IP for Developers