官网中关于如何在EC2中开启BBR的说明。Amazon Linux AMI 2017.09 Release Notes

开启方法

开启方法摘录如下:

The Kernel has been updated to latest 4.9.y stable tree, new ENA driver 1.3.0 as well as support for TCP Bottleneck Bandwidth and RTT (BBR) which improve network performance.
BBR is not enabled by default. You can enable it on your EC2 Instance via:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$ sudo modprobe tcp_bbr
$ sudo modprobe sch_fq
$ sudo sysctl -w net.ipv4.tcp_congestion_control=bbr
Persistent configuration should look like:
$ sudo su -
# cat <<EOF>> /etc/sysconfig/modules/tcpcong.modules
>#!/bin/bash
> exec /sbin/modprobe tcp_bbr >/dev/null 2>&1
> exec /sbin/modprobe sch_fq >/dev/null 2>&1
> EOF
# chmod 755 /etc/sysconfig/modules/tcpcong.modules
# echo "net.ipv4.tcp_congestion_control = bbr" >> /etc/sysctl.d/00-tcpcong.conf

额外的命令

Amazon Linux AMI中查看系统中拥塞控制的命令如下

1
2
3
4
5
6
7
8
9
# 查看系统支持的拥塞控制方法
$ sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = bbr cubic reno
$
# 查看当前使用的拥塞控制方法
$ sysctl net.ipv4.tcp_congestion_control
net.ipv4.tcp_congestion_control = bbr
$

其中

用命令lsmod | grep bbr查看bbr是否已经启动

1
2
3
$ lsmod | grep bbr
tcp_bbr 20480 15
$

Reference

留言