HiBlog Networking and Protocols

BBR vs CUBIC: Which TCP Congestion Control Is Better for a Linux Server?

  • A. MounesiAuthor
  • Release Date
  • 6 minutesReading time
  • 20Views
  • A. Mounesi
  • Published:
  • 6 min read
  • 20 views
BBR vs CUBIC: Which TCP Congestion Control Is Better for a Linux Server?

You’ve put large files on your virtual server for download. Users close to the data center are happy, but a customer downloading from far away says the speed keeps jumping up and down, and every time the nightly backup starts, the admin panel takes a few seconds longer to open. One of the things behind this is the TCP congestion control algorithm: the rule that decides how fast the server pushes data onto the network.

In this article we explain the difference between BBR and CUBIC in plain terms, see which suits which kind of server, and test and enable BBR on a Linux server step by step, with a way back if the result isn’t better.

Short answer: CUBIC, Linux’s default algorithm, keeps raising the sending rate until a packet is lost, then backs off. Instead of waiting for packet loss, BBR measures how fast data arrives and the round-trip time, and sends at that rate. On long, unstable paths, BBR usually gives steadier downloads and shorter queues. Turning it on with sysctl takes a few seconds, and the same command turns it back.

What is congestion control and why does it matter?

Between a server and a user, one part of the path is always narrower than the rest, say a link that carries at most 100 megabits per second. If the server sends faster than that, packets queue up behind this bottleneck, and if the queue fills, some are dropped and have to be sent again. The congestion control algorithm on the server, the sending side, decides how much data can be in flight at once, so the path’s capacity is used without making the queue needlessly long.

Packets queue behind the narrow part of the path until it’s their turn to pass

A long queue means delay: even a small panel response or web page has to wait behind the backup’s packets. If TCP and round-trip time (RTT) are new to you, read our TCP/IP guide first.

How does CUBIC work?

CUBIC has been Linux’s default algorithm for years and is standardized in RFC 9438. It gradually grows the amount of data in flight, called the congestion window, until a packet is lost. It reads the loss as a sign of congestion, shrinks the window and climbs again along a cubic curve, which is where the name comes from.

After a congestion signal, CUBIC reduces the amount of data in flight at once

CUBIC has two weak spots: on paths where packets are lost to line errors rather than congestion, it slows down for no reason; and because it pushes until the queue is full, it builds long queues and high delay on links with big buffers.

How is BBR different?

BBR was built by Google and has been in Linux since kernel 4.9. Instead of waiting for packet loss, it keeps measuring two things: how fast data reaches the destination and what the path’s shortest round-trip time is. It then sends at about that rate, and every so often it speeds up a little to see whether more capacity has opened up.

BBR measures the delivery rate and round-trip time and sets its sending rate from them

On long, unstable paths the result is usually steadier downloads and shorter queues. But BBR isn’t magic: on a short, quiet path you won’t see much difference, and its first version, the one in most distributions’ kernels, can take a bigger share of a shared path’s bandwidth than CUBIC connections.

CUBICBBR
Sign of congestionPacket lossMeasured rate and round-trip time
On LinuxDefaultYou have to enable it
Long, unstable pathsSpeed drops with every lost packetUsually steadier
Queue and delayPushes until the queue is fullKeeps the queue short

Will BBR help my server?

  • File downloads, streaming or remote backups: this is where it helps most. BBR works on the sending side, so it affects data leaving your server.
  • Users uploading to the server: no effect, because the sender is the user’s device.
  • A site behind a CDN or reverse proxy: the user’s connection ends at the CDN, so your server’s setting only affects the path from the CDN to the server.
  • Container-based VPS such as OpenVZ or LXC: the kernel is shared with the host, so you usually can’t change the algorithm. On a KVM virtual server, the kernel is your own.
  • HTTP/3 traffic: it runs over QUIC and UDP, so the TCP setting doesn’t affect it; its congestion control is up to the web server itself.

Testing BBR and CUBIC on Linux

First, see which algorithm is active and which ones the kernel offers:

sysctl net.ipv4.tcp_congestion_control
sysctl net.ipv4.tcp_available_congestion_control

If bbr isn’t in the second list, load its module with sudo modprobe tcp_bbr. To compare, run iperf3 -s on the server and run two tests from a Linux system in the same place as your users:

iperf3 -c 192.0.2.10 -R -C cubic -t 30
iperf3 -c 192.0.2.10 -R -C bbr -t 30

The -R option makes the server send, like a download from the server, and -C picks the algorithm for that test. Repeat each test several times, alternating them; read the speed on the receiver line and the retransmissions in the Retr column. If you open your panel or site during the tests, you’ll feel the difference in queueing too. Stop iperf3 afterwards so port 5201 doesn’t stay open.

Enabling BBR on the server

If BBR did better, note the current value and turn BBR on temporarily:

sudo sysctl -w net.core.default_qdisc=fq
sudo sysctl -w net.ipv4.tcp_congestion_control=bbr

This change applies to new connections and is undone by a reboot. To make it permanent, put these two lines in /etc/sysctl.d/99-bbr.conf and run sudo sysctl --system:

net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr

The fq queue paces the packets evenly and BBR works better with it; this setting fully applies to the network card after a reboot. To go back, delete the file and run the sysctl -w command with cubic.

FAQ

Does BBR make the server’s internet faster?

It doesn’t add bandwidth; it helps use the path’s existing capacity better, especially for distant users and unstable connections.

Should I enable BBR on all my servers?

Not without testing. Test each server’s user paths separately; if downloads reach the speed you need with CUBIC and the panel responds well under load, there’s no reason to switch.

Linux virtual servers at HiData

HiData’s Iran NVMe virtual servers run on KVM, so the kernel and root access are yours; you can run this same test on your own server and keep whichever algorithm works better. See them among our virtual servers, and if a question comes up along the way, our 24/7 ticket support has your back!

Share Post

hidata.org/en/blog/bbr-vs-cubic/
In Social Media

Add Comment

Related Articles