Linux Networking & TCP/IP for Developers · Lekcja

Dostrajanie kontroli przeciążenia TCP

Poznaj i dostrój algorytmy kontroli przeciążenia TCP w systemie Linux, takie jak CUBIC i BBR, aby poprawić przepustowość i opóźnienia w rzeczywistych sieciach.

Lekcja 4 z 413 kroki

Dostrajanie kontroli przeciążenia TCP to bezpłatna lekcja Linux Networking & TCP/IP for Developers na CoddyKit. To lekcja 4 z 4. Możesz przeczytać całą lekcję poniżej za darmo — a potem ćwiczyć ją interaktywnie w przeglądarce z wbudowanym edytorem kodu i tutorem AI dostępnym 24/7. To część ścieżki edukacyjnej Linux Networking & TCP/IP for Developers, a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs Linux Networking & TCP/IP for Developers zawiera 4 lekcji w sumie.

Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.

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.

Bezpłatny start

Ucz się Linux Networking & TCP/IP for Developers dzięki korepetycjom AI — za darmo

Pisz i uruchamiaj kod w przeglądarce, otrzymuj natychmiastową pomoc od korepetytora AI dostępnego 24/7 i kontynuuj naukę w sieci lub w aplikacji.

Kursy
12
Lekcje
48

Często zadawane pytania

Czy lekcja „Dostrajanie kontroli przeciążenia TCP” jest bezpłatna?

Tak — pełny tekst „Dostrajanie kontroli przeciążenia TCP” jest dostępny za darmo tutaj w sieci. Aby ćwiczyć ją interaktywnie (wbudowany edytor kodu i tutor AI dostępny 24/7) i odblokować resztę kursu Linux Networking & TCP/IP for Developers, przejdź na CoddyKit PRO. Kurs Linux Networking & TCP/IP for Developers zawiera 4 lekcji w sumie.

Co nauczysz się w „Dostrajanie kontroli przeciążenia TCP”?

Poznaj i dostrój algorytmy kontroli przeciążenia TCP w systemie Linux, takie jak CUBIC i BBR, aby poprawić przepustowość i opóźnienia w rzeczywistych sieciach. Ćwiczysz Linux Networking & TCP/IP for Developers z praktycznym kodem, który uruchamiasz bezpośrednio w przeglądarce, a tutor AI dostępny 24/7 odpowiada na Twoje pytania podczas pracy nad lekcją.

Czy potrzebuję doświadczenia, aby zacząć Linux Networking & TCP/IP for Developers?

Nie wymagamy żadnego doświadczenia. Linux Networking & TCP/IP for Developers w CoddyKit jest strukturyzowany dla początkujących i zaawansowanych użytkowników, więc możesz zacząć tutaj lub od początku i uczyć się w swoim tempie. To lekcja 4 z 4.

Ile czasu zajmuje lekcja „Dostrajanie kontroli przeciążenia TCP”?

Większość lekcji CoddyKit trwa około 5–10 minut. Każda lekcja to mały, interaktywny krok, dzięki czemu robisz systematyczne postępy i zawsze wracasz dokładnie do tego samego miejsca — na webie i w aplikacji.

Czy mogę pisać i uruchamiać kod w tej lekcji Linux Networking & TCP/IP for Developers?

Tak. Każda lekcja Linux Networking & TCP/IP for Developers zawiera wbudowany edytor kodu, więc piszesz i uruchamiasz prawdziwy kod bezpośrednio w przeglądarce i od razu otrzymujesz sprzężenie zwrotne od AI — bez konfiguracji na komputerze.

Wszystkie lekcje w tym kursie

  1. Parametry sieciowe jądra
  2. Dostrajanie i optymalizacja NIC
  3. Pomiar przepustowości sieci
  4. Dostrajanie kontroli przeciążenia TCP
← Powrót do Linux Networking & TCP/IP for Developers