BBR TCP Congestion Control

From Mage
Jump to: navigation, search

Bottleneck Bandwidth and RTT (BBR) is a TCP congestion control algorithm introduced in Linux 4.9. BBR is a relatively new congestion control algorithm written by software engineers at Google. It is the latest solution out of Google’s persistent attempts to make the Internet faster via the TCP protocol – the workhorse of the Internet.

The primary aim of BBR is to boost network utilization and reduce queues (that result into slow network activity): it should be deployed on servers, but not in the network or the client side.


Check your current state

sysctl -n net.ipv4.tcp_congestion_control
lsmod | grep bbr

More than likely your Linux distribution is using the cubic TCP congestion control algorithm by default. You can check with lsmod to see if the BBR kernel module has been loaded (it usually isn't by default).



Load the BBR module by default

This step is only required if your lsmod | grep bbr output returned nothing. This step will load the tcp_bbr module into the Linux kernel if it was compiled as an option.

echo "# Load Google's BBR network congestion algorithm
tcp_bbr" > /etc/modules-load.d/bbr.conf

This puts tcp_bbr in a .conf file under the /etc/modules-load.d/ directory. If after rebooting your lsmod | grep bbr command still returns nothing, you will need to switch to a kernel that includes the tcp_bbr module or custom compile your own.

Alternatively, you can manually load the BBR module for just this running session by issuing:

sudo modprobe tcp_bbr

This will load the tcp_bbr module, if available, without requiring a reboot. Using this method will not retain module between reboots. For the setting to be persistent it must be loaded via the /etc/modules-load.d/ config listed above.



Use the BBR module by default

Once the BBR module has been loaded we need to switch the Linux kernel's active TCP congestion control algorithm to it. We can accomplish this without rebooting the server.

echo "# Load Google's BBR network congestion algorithm.
# Google probably knows a little something about network congestion.
net.ipv4.tcp_congestion_control = bbr" > /etc/sysctl.d/03-tcpcong.conf

You can then load this file without a reboot via:

sudo sysctl -p /etc/sysctl.d/03-tcpcong.conf


Verify the active algorithm

Double check that BBR is the currently active TCP congestion control algorithm:

sysctl -n net.ipv4.tcp_congestion_control

This command should return the value bbr.