User Tools

Site Tools


os:linux:kernel-tuning

Linux Kernel-Tuning

BBR Congestion Control Algorithm

BBR is included since Linux 4.10. It won't show in net.ipv4.tcp_allowed_congestion_control or net.ipv4.tcp_available_congestion_control if the module tcp_bbr isn't loaded. This module is loaded automatically if activate bbr.

Check the current algorithm.

# sysctl net.ipv4.tcp_congestion_control
net.ipv4.tcp_congestion_control = bbr

Switch to bbr.

sysctl -w net.ipv4.tcp_congestion_control=bbr

Permanently activate bbr.

echo "net.ipv4.tcp_congestion_control = bbr" > /etc/sysctl.d/90-bbr.conf

Additional Information

You will find a lot of instructions which set “net.core.default_qdisc” to “fq”. The reason is, the first implementation was specifically designed for fq and you can still find references in the source code:

NOTE: BBR might be used with the fq qdisc (“man tc-fq”) with pacing enabled, otherwise TCP stack falls back to an internal pacing using one high resolution timer per TCP socket and may use more resources.

tcp_bbr.c

According to the official documentation, BBR doesn't require fq anymore. It also works with fq_codel for example.

This means that there is no longer a strict requirement to install the “fq” qdisc to use BBR. Any qdisc will work, though “fq” performs better for highly-loaded servers.

TCP BBR Quick-Start: Building and Running TCP BBR on Google Compute Engine

Links

FQ - Fair Queue traffic policing

FQ (sometimes referred to as sch_fq because of the name of its kernel module name) is a packet scheduler which was implemented by Eric Dumazet like FQ_Codel and can be configured as queueing discipline (qdisc). FQ can be used as a drop in replacement for pfifo_fast.

The CoDel wiki says this:

For servers with tcp-heavy workloads, particularly at 10GigE speeds, for queue management, we recomend sch_fq instead of fq_codel as of linux 3.12.

CoDel Overview

  • fq_codel - best for routers, hypervisors and best general purpose qdisc
  • fq - best for fat servers

Activate on the current system and replace qdisc on eth0 (not recommended).

sysctl -w net.core.default_qdisc=fq
tc qdisc replace dev eth0 root fq

Persistent configuration. Reboot required to activate (recommended).

echo "net.core.default_qdisc = fq"  > /etc/sysctl.d/90-fq.conf

Links

Ephemeral Ports

sysctl -w net.ipv4.ip_local_port_range="1024 65000"

Permanently set this configuration.

echo "net.ipv4.ip_local_port_range = 1024 65000" > /etc/sysctl.d/90-ephemeral_ports.conf

Links

os/linux/kernel-tuning.txt · Last modified: 2021-04-26 00:28 by Manuel Frei