Lesson 9 of 18 · 22m
Congestion Control and Bufferbloat: Why the Fast Link Feels Slow
Throughput is cwnd divided by RTT, not the link's marketing number — slow start, CUBIC vs BBR, 40 ms Nagle stalls, and queues that trade loss for latency.
A gigabit pipe, a 200 KB response, and 80 ms of RTT cannot finish in under ~10 round trips no matter what the link's marketing says — TCP starts every connection in slow start, roughly doubling its congestion window each RTT from an initial cwnd of 10 segments (IW10, RFC 6928). Bandwidth is the ceiling. Round trips are the staircase.
The window is the speed limit
TCP self-limits by cwnd: at most cwnd unacknowledged bytes in flight, so throughput ≈ cwnd / RTT. On an 80 ms path you need ~1.2 MB outstanding to fill a gigabit pipe; a fresh connection owns ~14 KB. Short flows die before reaching steady state — which is why connection reuse and CDNs (shorter RTT) beat "more bandwidth" for page latency.
Loss is the steering wheel. Loss-based algorithms — CUBIC, Linux's default since 2.6.19 — treat a dropped packet as "too fast" and cut cwnd: additive increase, multiplicative decrease. The flaw: on long-fat networks a random drop isn't congestion, and on wireless it's just radio noise. Either way you halve your window for a lie.
BBR (Google, 2016, Linux 4.9; running on google.com and youtube.com) replaces loss-as-signal with measurement: it models bottleneck bandwidth and minimum RTT, paces sends to BtlBw × RTTmin, and ignores losses that don't move the model. BBRv3 exists as Google patches from 2023 onward; what your distro ships is still v1. Setting it is two sysctls — net.ipv4.tcp_congestion_control=bbr and net.core.default_qdisc=fq, because BBR needs the fq qdisc for pacing.
Bufferbloat: the latency you bought on purpose
Big buffers feel safe — packets never drop — but a queue that never drops converts loss into latency. Under saturation, a 500 ms queue means every packet waits 500 ms while throughput graphs look perfect. That's bufferbloat: ping explodes exactly when the link saturates, and nothing measured in Mbps tells you why. Active queue management exists for this: CoDel (RFC 8289) and CAKE drop or ECN-mark packets by sojourn time — how long a packet sat — not queue length. Inspect yours with tc -s qdisc; on links you control, fq_codel or cake is the correct default.
Fast retransmit vs the timeout cliff
Two retransmit paths behave nothing alike. Fast retransmit fires on three duplicate ACKs — roughly one RTT of delay, invisible to most apps. RTO fires when the timer expires — 200 ms minimum, and Linux doubles the wait per retry. A connection alternating between the two tells you the loss is bursty; a connection living at RTO is a path that's effectively down. ss -ti exposes both sides of this: rto (current timer value), rtt/rttvar, retrans, cwnd, and ssthresh — the per-socket story no aggregate dashboard shows you.
The 40 ms stall that isn't congestion
Two defaults collide into a famous stall: Nagle's algorithm holds small writes hoping to coalesce them, and delayed ACK holds acknowledgments ~40 ms hoping to piggyback. A write-ack-write-ack pattern deadlocks into a 40 ms wait per iteration — the classic "fast on localhost, exactly 40 ms slower per hop on the wire" bug. TCP_NODELAY exists because this still bites gRPC, Redis pipelines, and every small-write RPC in production today.
Try this
ss -ti dst your.peer.ip # cwnd, rtt, retransmits on live connections
sysctl net.ipv4.tcp_congestion_control net.core.default_qdisc
tc -s qdisc show dev eth0 # drops, marks, backlog
iperf3 -c target # bandwidth ceiling — not production truth
nstat -az | grep -i retrans # kernel retransmit countersField notes
- On a struggling connection,
ss -ishowing collapsedcwndand climbingretransdistinguishes congestion from a dead peer faster than any app log. - One RTO (~200 ms minimum) is a visible hiccup; a chain of RTOs is your outage. Retransmission timeout is where "slow" becomes "dead."
- Don't raise
initcwndglobally for short connections on shared infrastructure — IW10 exists because bigger initial bursts overflow shallow buffers, which loops you right back into bufferbloat.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
What is a Web Server? Apache, Nginx, and How the Internet Delivers Web Pages
A web server accepts HTTP requests and returns responses. Apache has been doing this since 1995. Nginx rebuilt the model in 2004 and took over the cloud. Here's how they work, how they differ, and how to pick between them.
How to Install NGINX on Debian & Ubuntu: Server Blocks, HTTPS and Reverse Proxy
When it comes to running a web server for all of my online projects, NGINX is the first that comes to mind for me. By default, it follows my guidelines of running a piece of software – meaning that the software is security-minded, performance-driven, and honestly, really easy to manage all the aspects of it. NGINX is most likely the most popular web server software in the world, and it's well known for being the backbone of some of the biggest sites on the internet to date. It is a lightweight
Minecraft 26.4 Replaced Its Decade-Old Login Crypto. Here's What key-rotation-period-seconds Actually Does.
26.4 Snapshot 9 rewrote how a Java Edition client and server agree on an encryption key. RSA-1024 is out, X25519 is in, and a new key-rotation-period-seconds setting decides how often the server's key changes. I opened the snapshot server jar, timed the login crypto, and checked what changes for...
The Same Researcher Broke apt the Same Way Twice, Seven Years Apart
In 2019 Max Justicz showed apt would install a package an attacker swapped in over a redirect. In November 2026 he did it again, CVE-2026-109518, through a different door that ends in the same place: code as root from a man in the middle. The fix shows how apt reuses files on disk.