Categories
Linux Technology

Use BBR to Improve the Connection With VPS

BBR (Bottleneck Bandwidth and Round-trip propagation time) is a cutting-edge new congestion control algorithm, which is developed by Google. It helps your VPS to achieve higher bandwidths and lower latencies for internet traffic.

BBR allows the 500,000 WordPress sites on our digital experience platform to load at lightning speed. According to Google’s tests, BBR’s throughput can reach as much as 2,700x higher than today’s best loss-based congestion control; queueing delays can be 25x lower.

Jason Cohen, Founder and CTO, WP Engine

Hence, BBR solves the problem of packet loss before actual congestion, thus result in faster packet transfer and connection for most VPS.

To decide how fast to send data over the network, BBR considers how fast the network is delivering data. For a given network connection, it uses recent measurements of the network’s delivery rate and round-trip time to build an explicit model that includes both the maximum recent bandwidth available to that connection and its minimum recent round-trip delay. BBR then uses this model to control both how fast it sends data and the maximum amount of data it’s willing to allow in the network at any time.

Installation

If you have Linux kernel version >= 4.9

Congrats! You can enable BBR directly:

# add kernel module
modprobe tcp_bbr

# Configure kernel modules to load at boot
echo "tcp_bbr" | sudo tee --append /etc/modules-load.d/modules.conf

# Configure sysctl preload/configuration file
echo "net.core.default_qdisc=fq" | sudo tee --append /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" | sudo tee --append /etc/sysctl.conf

# configure default kernel parameters
sysctl -p

If you have Snell proxy service running, you may need to restart it or reboot:

systemctl restart snell
For Linux kernel version < 4.9

You may need to change the kernel, then enable BBR. There’s a one-step tool to achieve this (all in one command):

wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh && chmod +x bbr.sh && ./bbr.sh

VPS will reboot after installation. To check if BBR works, type command:

sysctl net.ipv4.tcp_congestion_control

If the terminal shows net.ipv4.tcp_congestion_control = bbr, BBR is running now.

BBR Variations

For some reason, there are few BBR variations to optimize the special network condition (proxy services). It’s for specific usage, if you don’t know what you are going to do, don’t use BBR variations, as it may cause your system malfunction.

tcp-nanqinlang

Supported Platform: KVM virtualization VPS, Debian 7+ (32bit/64bit), CentOS 6+ (64bit) (Other versions not tested)

# Debian
wget --no-check-certificate https://github.com/tcp-nanqinlang/general/releases/download/3.4.2.1/tcp_nanqinlang-fool-1.3.0.sh bash tcp_nanqinlang-fool-1.3.0.sh

# CentOS
wget --no-check-certificate https://raw.githubusercontent.com/tcp-nanqinlang/general/master/General/CentOS/bash/tcp_nanqinlang-1.3.2.sh bash tcp_nanqinlang-1.3.2.sh
  • When executing the command, choose “1” to install the kernel.
  • When asked whether to abort the process of removing the same kernel, select NO.
  • When prompt to input, type “reboot” and click “Enter” to reboot the system.

After reboot, reconnect to your VPS, run command:

# Debian
bash tcp_nanqinlang-fool-1.3.0.sh

# CentOS
bash tcp_nanqinlang-1.3.2.sh
  • When executing the command, choose “2” to enable BBR.
  • Wait until prompt “tcp_nanqinlang is running !”.
BBR Plus

BBR Plus is customized based on original BBR, and it’s even more powerful and very effective in improving transmission speed. The script is from cx9208, it contains four versions of BBR.

Supported Platform: KVM/ZEN virtualization VPS, CentOS 7、Debian 8、Debian 9、Ubuntu 16.04、Ubuntu 18.04 (Other versions not tested)

wget --no-check-certificate -O tcp.sh https://github.com/cx9208/Linux-NetSpeed/raw/master/tcp.sh && chmod +x tcp.sh && ./tcp.sh
  • Select “2” to install the BBR Plus version kernel.
  • When the new kernel has been installed, type “Y” to reboot.

After reboot, reconnect to your VPS, run command:

./tcp.sh
  • When executing the command, choose “7” to enable BBR Plus.
  • Wait until prompt “BBRplus is running !”.

You can change to other BBR variants using the same script and follow the same process (install kernel-reboot-enable BBR).


This tutorial is inspired by Nickname233.

By 533

♥️•🏊•💪🏻 •🐈•📷
•IG: @53333_ @xᴜɴxᴜɴ_ɢʀᴀᴄᴇ
•TW: @SimonNg533

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.