3.7 KiB
Advanced usage: Deploy Google BBR congestion control algorithm
Google BBR is a congestion control algorithm that could significantly increase server throughput and reduce latency.
Google BBR has been built into Linux kernel 4.9 and higher, but needs to be manually turned on.
To learn more about the Google BBR algorithm, see this official blog or this official repository.
Prepare
You can check the current Linux kernel version with the command uname -r
. When the version is greater than or equal to 4.9, you can deploy BBR directly by referring to the instructions below.
Generally speaking, the kernel versions of Ubuntu 18.04+, Debian 10+, CentOS 8+ and RHEL 8+ are greater than 4.9. But for CentOS 7 or Amazon Linux 2, you need to update the kernel in the following ways before deploying Google BBR.
Amazon Linux 2
Amazon Linux 2 provides newer versions of the verified Linux kernel, which can be installed from the Extras repository.
- Install
kernel-ng
from the Extras repositorysudo amazon-linux-extras install kernel-ng
- Update packages
sudo yum update
- Restart the system
sudo reboot
- Check the Linux kernel version
uname -r
CentOS 7
When using CentOS 7, a newer Linux kernel provided by the ELRepo Project needs to be installed. More information about the Linux kernels provided by the ELRepo Project can be found at this page.
Refer to the installation instructions below.
- Import ELRepo Project's public key.
sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
- Install ELRepo for RHEL-7, SL-7 or CentOS-7.
sudo yum install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
- Install
kernel-ml
.sudo yum --enablerepo=elrepo-kernel install kernel-ml
- Confirm the result.
You should seerpm -qa | grep kernel
kernel-ml-xxx
in output. - Show all entries in the grub2 menu and setup
kernel-ml
.
Indexing starts atsudo egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'
0
.
For example, when thekernel-ml
is located at1
, use the command below to activatekernel-ml
.sudo grub2-set-default 1
- Reboot.
sudo reboot
- Check Linux kernel version.
uname -r
Deploy Google BBR
In this section, we will start Google BBR by modifying the configuration file.
- Backup
/etc/sysctl.conf
sudo cp /etc/sysctl.conf /etc/sysctl.conf.backup
- Modify
/etc/sysctl.conf
Add the following lines to the filesudo vim /etc/sysctl.conf
net.core.default_qdisc = fq net.ipv4.tcp_congestion_control = bbr
- Enable Google BBR
First, check your server's kernel version usinguname -r
.
For kernel versions >= 4.20, applysysctl
settings:
For kernel versions < 4.20, you must reboot the server:sudo sysctl -p
sudo reboot
- Check Google BBR status
sudo sysctl net.ipv4.tcp_available_congestion_control # net.ipv4.tcp_available_congestion_control = reno cubic bbr sudo sysctl -n net.ipv4.tcp_congestion_control # bbr lsmod | grep bbr # tcp_bbr 16384 0