Implement BBR Acceleration Through Docker on OpenVZ Architecture

In October last year, I bought a small OpenVZ architecture host in Los Angeles with 768M memory, and Kcptun was configured in early November when the speed was increased from 100Kb/s to 1.7Mb/s. At the same time, it also brings several inconvenient problems like the retransmission rate is high, which is a little better than the bilateral tools such as Finalspeed, bug it is still much higher than the simple use of Shadowsocks. In addition, as a bilateral acceleration tool on Android, Kcptun is still easy to install on the client, but there are some obstacles on Linux and Windows. It is often not working properly after the lock screen or the network is reconnected.

Although there are a few minor problems, consider that Kcptun’s acceleration effect is really great, so there is no substitute until I heard that BBR. The kernel version of OpenVZ architecture is too old to use BBR which is mostly to used under KVM architecture. Yesterday I accidentally find that I could run it on Docker alone because the HostUS service provider supported the Docker image, so I rebuild it into Docker and start installing BBR.

Introduction

BBR is the abbreviation of Bottleneck Bandwidth and RTT. It is a new TCP congestion control algorithm provided by Google. It can efficiently detect the bandwidth and run full and is incorporated into the 4.9 kernels. Therefore, the KVM architecture upgrades the kernel to 4.9. be usable.

Step

Preparation

First, you need to make sure that the host has TUN/TAP turned on.

Use the following command to check if it is open. It usually needs to be opened on the host’s settings page.

1
cat /dev/net/tun

Install Shadowsocks

Install any version of Shadowsocks, it is recommended to Docker.io to find a popular version, I am using the following version where $SSName is the name of the Container, $SSPort is the port it wants to occupy, and $Password is the password for the SS.

1
docker run -d --name $SSName -p $SSPort:$SSPort oddrationale/docker-shadowsocks -s 0.0.0.0 -p $SSPort -k $Password -m aes-256-cfb

Install BBR

Install BBR using the llk solution, open source address sees [here] (https://github.com/dabiaoge/lkl).

Use the following command to install, Where $HostName just names, $Port is the accelerated port, $BBRName is the name of the Container, and 8888 is the default acceleration port for the Container.

1
docker run -d --privileged --link $SSName:$HostName -e TARGET_HOST=$HostName -e TARGET_PORT=$SSPort -p $Port:8888 --name $BBRName wuqz/lkl:latest

The configuration can be used personally now. If you want to divide the traffic among people, you need to configure multiple users.

Multi-user configuration

There are a variety of options, such as running an SS Container and then configuring it as a multi-user, mapping multiple ports out, and then running multiple accelerated containers. Because I only need four or five users and 768M of memory at the same time, so the direct SS Container and the accelerated Container each run four.

Still the same as the above command, note that each Container has its own $SSName, $BBRName, $SSPort, and $Port.

Effect

After measured Youtube 4K video which played at the same speed as KCP, the difference is that its speed is slowly rising, and it is higher than KCP to the highest speed. In general, when it is required to have a high instantaneous speed and is insensitive to high bandwidth consumption, it is more advantageous to use KCPtun. In other scenarios, it is very good to use BBR to accelerate.

Reference

  1. Open BBR with LKL for network acceleration (Docker version)

2.Linux Kernel Library for speed up

  1. Analysis of TCP BBR Congestion Control Algorithm from Google