|
| 1 | +# TCP BBR v3 Release |
| 2 | + |
| 3 | +This document gives a quick overview of Google's TCP BBR v3 release for Linux, |
| 4 | +and how to download, build, install, and test it. |
| 5 | + |
| 6 | +The TCP BBR v3 release is intended to enable research collaboration and wider |
| 7 | +testing. We encourage researchers to dive in and help evaluate/improve the BBR |
| 8 | +algorithm and code. We welcome patches with good solutions to issues. |
| 9 | + |
| 10 | +This document shows how to download, build, install, and test |
| 11 | +a Linux kernel running TCP BBR v3. |
| 12 | + |
| 13 | +## License |
| 14 | + |
| 15 | +Like Linux TCP BBR v1, the v3 code is dual-licensed as both GPLv2 (like the |
| 16 | +Linux kernel) and BSD. You may use it under either license. |
| 17 | + |
| 18 | +## Viewing the TCP BBR v3 sources |
| 19 | + |
| 20 | +You can view the current sources here: |
| 21 | +[tcp_bbr.c](https://github.com/google/bbr/blob/v3/net/ipv4/tcp_bbr.c) |
| 22 | + |
| 23 | +## Obtaining kernel sources with TCP BBR v3 |
| 24 | + |
| 25 | +There are two main options for downloading the code: |
| 26 | + |
| 27 | +1. To create a new git repo starting from a Linux kernel with TCP BBR v3, |
| 28 | +you can run: |
| 29 | + |
| 30 | +``` |
| 31 | +git clone -o google-bbr -b v3 https://github.com/google/bbr.git |
| 32 | +cd bbr/ |
| 33 | +``` |
| 34 | + |
| 35 | +2. To download the code into an existing git repo, you can use: |
| 36 | + |
| 37 | +``` |
| 38 | +git remote add google-bbr https://github.com/google/bbr.git |
| 39 | +git fetch google-bbr |
| 40 | +git checkout google-bbr/v3 |
| 41 | +``` |
| 42 | + |
| 43 | +Note that if you already have a git repo that has imported the Linux source |
| 44 | +tree, then the second option will be much faster and use much less space, since |
| 45 | +it will only need to download the small deltas relative to the mainline Linux |
| 46 | +source distribution. |
| 47 | + |
| 48 | +## Building and installing the kernel |
| 49 | + |
| 50 | +To build a Linux kernel with TCP BBR v3 support, copy that kernel to a target |
| 51 | +(Debian or Ubuntu) test machine (bare metal or GCE), and reboot that machine, |
| 52 | +you can use the following script, included in the TCP BBR v3 distribution: |
| 53 | + |
| 54 | +``` |
| 55 | +./gce-install.sh -m ${HOST} |
| 56 | +``` |
| 57 | + |
| 58 | +## Checking the kernel installation |
| 59 | + |
| 60 | +Once the target test machine has finished rebooting, then ssh to the target |
| 61 | +test machine and become root with sudo or equivalent. First check that the |
| 62 | +machine booted the kernel you built above: |
| 63 | + |
| 64 | +``` |
| 65 | +uname -a |
| 66 | +``` |
| 67 | + |
| 68 | +You should see the branch name SHA1 hash, and build time stamp from the kernel |
| 69 | +you built above. |
| 70 | + |
| 71 | + |
| 72 | +Then check what congestion control modules are available with: |
| 73 | +``` |
| 74 | +sysctl net.ipv4.tcp_available_congestion_control |
| 75 | +``` |
| 76 | + |
| 77 | +You should see something like: |
| 78 | +``` |
| 79 | +net.ipv4.tcp_available_congestion_control = reno bbr cubic dctcp |
| 80 | +``` |
| 81 | + |
| 82 | +## Install test dependencies |
| 83 | + |
| 84 | +Next, copy the test scripts to the target test machine with: |
| 85 | + |
| 86 | +``` |
| 87 | +scp -r gtests/net/tcp/bbr/nsperf/ ${HOST}:/tmp/ |
| 88 | +``` |
| 89 | + |
| 90 | +Before running the tests for the first time, as a one-time step you'll need to |
| 91 | +install the dependencies on the test machine, as root: |
| 92 | + |
| 93 | +``` |
| 94 | +mv /tmp/nsperf /root/ |
| 95 | +cd /root/nsperf |
| 96 | +./configure.sh |
| 97 | +``` |
| 98 | + |
| 99 | +## Running TCP BBR v3 tests and generating graphs |
| 100 | + |
| 101 | +To run the tests, ssh to the target test machine and become root with sudo or |
| 102 | +equivalent. Then run the tests and generate graphs with: |
| 103 | + |
| 104 | +``` |
| 105 | +cd /root/nsperf |
| 106 | +./run_tests.sh |
| 107 | +./graph_tests.sh |
| 108 | +``` |
| 109 | + |
| 110 | +This will run for hours, and place the graphs in the ./graphs/ directory. |
| 111 | + |
| 112 | +You can run and graph a subset of the tests by specifying the test by name as |
| 113 | +an environment variable. For example: |
| 114 | + |
| 115 | +``` |
| 116 | +cd /root/nsperf |
| 117 | +tests=random_loss ./run_tests.sh |
| 118 | +tests=random_loss ./graph_tests.sh |
| 119 | +``` |
| 120 | + |
| 121 | +Enjoy! |
| 122 | + |
| 123 | +## Release Notes and Details |
| 124 | + |
| 125 | +### Introducing the ecn_low per-route feature |
| 126 | + |
| 127 | +This new "ecn_low" per-route feature indicates that the given destination |
| 128 | +network is a low-latency ECN environment, meaning both that (a) ECN CE marks |
| 129 | +are applied by the network using a low-latency marking threshold and also that |
| 130 | +(b) TCP endpoints provide precise per-data-segment ECN feedback in ACKs (where |
| 131 | +the ACK ECE flag echoes the received CE status of all newly-acknowledged data |
| 132 | +segments). This feature indication can be used by congestion control algorithms |
| 133 | +to decide how to interpret ECN signals over the given destination network. |
| 134 | + |
| 135 | +Basically, this "ecn_low" feature is for use when you know that any ECN marks |
| 136 | +that the connections experience will be DCTCP/L4S-style ECN marks, rather than |
| 137 | +RFC3168 ECN marks. |
| 138 | + |
| 139 | +A patch for the iproute2 package to support the "ecn_low" feature is included |
| 140 | +in the BBRv3 source branch |
| 141 | +[here](https://github.com/google/bbr/blob/v3/0002-ip-introduce-the-ecn_low-per-route-feature.patch) |
| 142 | + |
| 143 | +### iproute2 patches to support functionality in the BBRv3 source release |
| 144 | + |
| 145 | +The BBRv3 source release includes several patches for the iproute2 package to |
| 146 | +support functionality in the BBRv3 test kernel: |
| 147 | + |
| 148 | +- patch "ss" tool to output congestion control state for BBRv3: |
| 149 | + - [0001-ss-output-TCP-BBRv3-diag-information.patch](https://github.com/google/bbr/blob/v3/gtests/net/tcp/bbr/nsperf/0001-ss-output-TCP-BBRv3-diag-information.patch) |
| 150 | +- patch "ip" tool to support ecn_low per-route feature: |
| 151 | + - [0002-ip-introduce-the-ecn_low-per-route-feature.patch](https://github.com/google/bbr/blob/v3/gtests/net/tcp/bbr/nsperf/0002-ip-introduce-the-ecn_low-per-route-feature.patch) |
| 152 | +- patch "ss" tool to show "ecn_low" state in TCP socket: |
| 153 | + - [0003-ss-display-ecn_low-if-tcp_info-tcpi_options-TCPI_OPT.patch](https://github.com/google/bbr/blob/v3/gtests/net/tcp/bbr/nsperf/0003-ss-display-ecn_low-if-tcp_info-tcpi_options-TCPI_OPT.patch) |
| 154 | + |
| 155 | +### Enabling ECN support |
| 156 | + |
| 157 | +You can enable BBRv3 ECN support with commands like the following: |
| 158 | + |
| 159 | +``` |
| 160 | +# 1: negotiate TCP ECN for active and passive connections: |
| 161 | +sysctl net.ipv4.tcp_ecn=1 |
| 162 | +# 2: enable BBRv3 ECN logic using the "ecn_low" per-route feature, e.g. : |
| 163 | +alias ip=/root/iproute2/iproute2/ip/ip |
| 164 | +ip route change default via 192.168.0.100 dev ens4 features ecn_low |
| 165 | +``` |
| 166 | + |
| 167 | +## FAQ |
| 168 | + |
| 169 | +If you have questions about BBR, check the [BBR |
| 170 | +FAQ](https://github.com/google/bbr/blob/master/Documentation/bbr-faq.md). |
0 commit comments