Some Bits: Nelson's log

Starlink and BBR congestion control

I improved my download throughput with a simple change, enabling TCP BBR on the server. This all from a tip from an online friend who I’ve been sharing technical Starlink info with, I’ve been learning a lot from him. There’s a guide here.

I didn’t test this very carefully but casually observing an rsync transfer at 8am, when Starlink is quiet... With the default cubic congestion algorithm the transfer was bouncing around between 5 MBytes/s and 12 MBps. After enabling BBR I got more like a steady 12 MBps. Eyeballing it, I got 2x the throughput! Could be coincidence though, Starlink performance is so variable. I should test more carefully with iperf3 -C but am too lazy.

Ubuntu 22.10 by default uses the cubic congestion algorithm, use sysctl net.ipv4.tcp_congestion_control to verify. Enabling BBR is as simple as running sysctl -w net.ipv4.tcp_congestion_control=bbr. This will load the tcp_bbr kernel module and enable it. You can edit /etc/sysctl.conf to make it permanent.

Worth noting BBR is a change you need to make on the high bandwidth sender, typically the server. It can’t hurt on the receiver but I don’t think it will help either. There doesn’t seem to be an easily installable BBR for Windows. But it’s very easy to enable on a Linux server!

The guide I linked also suggests using FQ queueing and considers TCP window scaling. I didn’t change those. FQ has a good reputation on a router device.

What is TCP BBR?

TCP congestion control is one of the more important parts of Internet magic that makes things work. Basically it detects when a network link is getting overloaded and slows down transmits, trying to find the optimal throughput. The details of how it does that are remarkably subtle and have changed over the years. I’ve often wondered if Starlink’s wildly variable throughput and ambient packet loss were bad for existing algorithms. Maybe so, and maybe BBR is better?

TCP BBR is a Google innovation dating to 2016 or so on its way to becoming an IETF standard. They reported a 4-14% improvement after deploying it on YouTube. An analysis here shows the improvements are not big for a high quality link but are enormous at 1.5% and 3% packet loss; that’s more like my Starlink situation. Classic TCP congestion control interpreted packet loss as a sign of congestion. But it could also just be a flaky wireless medium. A modern algorithm designed to do more subtle modelling of the connection could definitely improve things, particularly for a Starlink client with 1%+ packet loss, 100% jitter, and varying maximum throughput.

I didn’t do a deep dive into understanding all of TCP BBR. Geoff Huston has a great writeup. And there’s Neal Cardwell’s formal paper and this video about the paper. The gloss I got from looking at these is that BBR is explicitly building up a model of the link characteristics and testing to update or revalidate it frequently. That’s a good deal more complex than “react to lost packets by halving the rate”, the core of the classical algorithm. It’s no surprise that as computers have gotten better there’s more room for doing more sophisticated traffic shaping.

Comments

Nice Starlink hack!

The other notoriously tricky bit about developing congestion control algorithms is testing them. When you deploy a new one in the wild, alongside flows using existing algorithms, if it seems to improve throughput or latency, it's hard to know whether that improvement was net positive, ie global across all flows, or net zero, ie taking away from them. Lots of older history of people developing congestion control alternatives that looked good at first, then turned out to be overly aggressive and saturated links at the expense of everyone else.

(Also Geoff Huston's blog is my favorite neckbeard entertainment reading material, bar none. So good!)

Yeah I didn't get into this but I gather one issue with BBR v1 is folks fear it's selfish and deprives other TCP connections. I'm not worried about that on my private server but if I were operating a major public site I'd be thinking about it.