การปรับจูนการควบคุมความแออัดของ TCP
ทำความเข้าใจและปรับจูนอัลกอริทึมควบคุมความแออัดของ TCP บน Linux เช่น CUBIC และ BBR เพื่อเพิ่มอัตรารับส่งข้อมูลและลดเวลาแฝงบนเครือข่ายจริง
การปรับจูนการควบคุมความแออัดของ TCP เป็นบทเรียน Linux Networking & TCP/IP for Developers ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน 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_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.
คำถามที่พบบ่อย
บทเรียน “การปรับจูนการควบคุมความแออัดของ TCP” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “การปรับจูนการควบคุมความแออัดของ TCP” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Linux Networking & TCP/IP for Developers ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Linux Networking & TCP/IP for Developers มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “การปรับจูนการควบคุมความแออัดของ TCP”
ทำความเข้าใจและปรับจูนอัลกอริทึมควบคุมความแออัดของ TCP บน Linux เช่น CUBIC และ BBR เพื่อเพิ่มอัตรารับส่งข้อมูลและลดเวลาแฝงบนเครือข่ายจริง คุณปฏิบัติ Linux Networking & TCP/IP for Developers ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Linux Networking & TCP/IP for Developers หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน Linux Networking & TCP/IP for Developers บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน
บทเรียน “การปรับจูนการควบคุมความแออัดของ TCP” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Linux Networking & TCP/IP for Developers นี้ได้ไหม
ได้ บทเรียน Linux Networking & TCP/IP for Developers ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- พารามิเตอร์เครือข่ายของเคอร์เนล
- การปรับแต่งและเพิ่มประสิทธิภาพ NIC
- การวัดประสิทธิภาพอัตราการรับส่งข้อมูลเครือข่าย
- การปรับจูนการควบคุมความแออัดของ TCP