
BBR is a TCP network congestion optimization algorithm open-sourced by Google, which can accelerate the access speed of visitors to your server. Especially for overseas servers, enabling the BBR algorithm can beWebsite Optimizationhas some help.
Here, Naiba uses the CentOS7 system to demonstrate how to install a new kernel (because BBR requires kernel 4.9 or above) and enable BBR acceleration.
Steps to Install the New Kernel on CentOS7
First, check the current server's kernel version.
uname -sr
The uname command is used to print information about the current system (kernel version, hardware architecture, hostname, and operating system type, etc.).
-a或--all:显示全部的信息; -m或--machine:显示电脑类型; -n或-nodename:显示在网络上的主机名称; -r或--release:显示操作系统的发行编号; -s或--sysname:显示操作系统名称; -v:显示操作系统的版本; -p或--processor:输出处理器类型或"unknown"; -i或--hardware-platform:输出硬件平台或"unknown"; -o或--operating-system:输出操作系统名称; --help:显示帮助; --version:显示版本信息。
BBR kernel requirement is 4.9+, usually the kernel version you get from the above command is around 3.x.
Next, enable the ELRepo repository
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org rpm -Uvh https://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm

Then install the new stable version of the kernel.
yum --enablerepo=elrepo-kernel install kernel-ml -y
After installation, use the following command to check if the installation was successful.
rpm -qa | grep kernel
My display is as follows:
kernel-3.10.0-862.14.4.el7.x86_64 kernel-ml-5.3.8-1.el7.elrepo.x86_64 kernel-3.10.0-1062.4.1.el7.x86_64 kernel-headers-3.10.0-1062.4.1.el7.x86_64 kernel-3.10.0-957.5.1.el7.x86_64 kernel-3.10.0-1062.1.2.el7.x86_64 kernel-tools-3.10.0-1062.4.1.el7.x86_64 kernel-tools-libs-3.10.0-1062.4.1.el7.x86_64 kernel-3.10.0-957.1.3.el7.x86_64
Inside, kernel-ml-5.3.8-1.el7.elrepo.x86_64 is the newly installed kernel version (when you see this tutorial, the kernel version may have changed, adapt accordingly)
Next, you need to set the system boot order, use the following command.
sudo egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'
My display is as follows:
CentOS Linux (5.3.8-1.el7.elrepo.x86_64) 7 (Core) CentOS Linux (3.10.0-1062.4.1.el7.x86_64) 7 (Core) CentOS Linux (3.10.0-1062.1.2.el7.x86_64) 7 (Core) CentOS Linux (3.10.0-957.5.1.el7.x86_64) 7 (Core) CentOS Linux (3.10.0-957.1.3.el7.x86_64) 7 (Core) CentOS Linux (3.10.0-862.14.4.el7.x86_64) 7 (Core) CentOS Linux (0-rescue-618ca2de6e204efbb013b592564ef36a) 7 (Core)
The first one is CentOS Linux (5.3.8-1.el7.elrepo.x86_64) 7 (Core), counting from the first line as 0, 0, 1, 2, 3, etc., see which number your new kernel is.
Then enter the following command (command example for the first line)
sudo grub2-set-default 0
Next, restart the server.
reboot
Check the kernel version again.
uname -r
The kernel version shows 4.9 or above. At the time of this update, the new version is 5.3.8, which proves the installation was successful.
Rebuild kernel configuration
grub2-mkconfig -o /boot/grub2/grub.cfg
Restart the system to verify, and if there are no issues, it's done.
Enable BBR on the New Kernel in CentOS7
To enable the new kernel on the freshly installed CentOS7, simply copy and execute the code below.
echo 'net.core.default_qdisc=fq' | sudo tee -a /etc/sysctl.conf echo 'net.ipv4.tcp_congestion_control=bbr' | sudo tee -a /etc/sysctl.conf sudo sysctl -p
Then enter the following command to check if BBR was successfully enabled.
sudo sysctl net.ipv4.tcp_available_congestion_control
If successful, the output should look like this.
net.ipv4.tcp_available_congestion_control = bbr cubic reno
Continue verification.
sudo sysctl -n net.ipv4.tcp_congestion_control
The output should be.
bbr
Finally, check if the kernel module is loaded.
lsmod | grep bbr
The output should be similar to the following.
tcp_bbr 16384 0
What is the use of enabling BBR?
Simply put, enabling BBR can optimize your website's access speed to some extent. For example, Naiba's notes use WordPress, and BBR can also provide some acceleration optimization for WordPress sites. Of course, Naiba uses domestic servers, so the BBR acceleration effect won't be very noticeable.
BBR is a TCP network congestion optimization algorithm open-sourced by Google. TCP BBR aims to solve two problems: fully utilizing bandwidth on network links with a certain packet loss rate, and reducing buffer occupancy on network links to lower latency. The goal of TCP congestion control is to maximize the utilization of the bottleneck link bandwidth on the network.
Open Source Address:https://github.com/google/bbr
BBR and BBR2 One-Click Packages
What is BBR2?
BBR2 is currently a preview version, an upgrade of BBR. It is not yet mature and is not recommended for production environments.
For detailed BBR2 instructions, see:https://github.com/google/bbr/blob/v2alpha/README.md
The documentation also includes a tutorial and steps for manually installing BBR2, which won't be copied here.
bbr2 one-click package
Warning: Changing the kernel carries risks. If using this script results in system failure to boot, we are not responsible for any losses.
Recommended system: Debian 10 x86_64, theoretically supports Debian 8+, Ubuntu 16.04+
Only applicable to KVM virtual architecture VPS. Do not try on OVZ, Xen, or dedicated servers.
Only applicable to 64-bit (x86_64) systems, does not support x86.CentOS and other systems are not supported。
Tested on BandwagonHost Debian 8, 9, 10, Ubuntu 16.04, 18.04 (Ubuntu 14.04 failed).
Tested on Debian 10 systems from the following providers: Oracle Public Cloud, DMIT, OLVPS, AlibabaCloud.
Debian 10 installation success rate 100%.
CentOS users are advised to use BBR or try manually installing BBR2.
wget --no-check-certificate -q -O bbr2.sh "https://raw.githubusercontent.com/yeyingorg/bbr2.sh/master/bbr2.sh" && chmod +x bbr2.sh && bash bbr2.sh auto
Important! Please restart the system after enabling/disabling BBR/ECN. It has been found that the script may have bugs causing it not to take effect or coexist with old acceleration methods like BBR.
BBR one-click package
The BBR one-click script supports more systems, but the prerequisite is that the kernel version supports BBR. If the kernel version is not suitable, you still need to manually update the kernel.
System support: CentOS 6+, Debian 7+, Ubuntu 12+.
Virtualization technology: Other than OpenVZ, such as KVM, Xen, VMware, etc.
Memory requirement: ≥128M.
wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh && chmod +x bbr.sh && ./bbr.sh
bbr plus one-click package
BBR Plus is based on the original BBR with parameter optimization, providing better acceleration on some machines compared to the original.
The BBR Plus one-click installation script introduced in this article comes from netizen cx9208. In addition to BBR Plus, it also integrates the original BBR one-click installation, modified BBR one-click installation, and LotServer one-click installation, making it a four-in-one version that allows switching between the four versions.
Applicable architecture: KVM / Xen, does not support OpenVZ (OVZ).
Applicable systems: CentOS 7, Debian 8, Debian 9, Ubuntu 16.04, Ubuntu 18.04.
wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh && chmod +x bbr.sh && ./bbr.sh