Changed From nexstorm/magicTCP
bash <(curl -sSL https://raw.githubusercontent.com/qiuxiuya/magicTCP/main/main.sh)
- Debian 11
- 500MB of free disk space
- 1GB of RAM
This is a kernel that is optimised for TCP throughput. It is based on (usually) the latest LTS kernel with patches that optimise parts of the kernel and enable some of the tweaks used.
We apply the following changes to your sysctl file when you run the script
net.ipv4.tcp_rmem = 8192 262144 536870912
net.ipv4.tcp_wmem = 8192 262144 536870912
net.ipv4.tcp_adv_win_scale = -2
net.ipv4.tcp_collapse_max_bytes = 6291456
net.ipv4.tcp_notsent_lowat = 131072
net.ipv4.tcp_window_scaling = 1
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
-
net.ipv4.tcp_rmem = 8192 262144 536870912
This line specifies the minimum, default, and maximum receive socket buffer sizes for TCP connections. Increasing buffer sizes can help improve performance for high-throughput applications.
-
net.ipv4.tcp_wmem = 8192 262144 536870912
Similar to the previous line, this one sets the minimum, default, and maximum send socket buffer sizes for TCP connections. Increasing these values can allow for larger send buffers, improving the performance of applications that send data over TCP.
-
net.ipv4.tcp_adv_win_scale = -2
Set to 0.25x of memory in the receive buffer to account for the overhead when processing packets. -2 is used to reduce the frequency of TCP collapse
-
net.ipv4.tcp_collapse_max_bytes = 6291456
From Cloudflare's blog
-
net.ipv4.tcp_notsent_lowat = 131072
This sets the low-water mark for the amount of unsent data in TCP sockets. Raising this threshold can reduce the number of small packets sent.
-
net.ipv4.tcp_window_scaling = 1
Enables TCP window scaling
-
net.core.default_qdisc = fq
Uses fair-queue as the queuing discipline
-
net.ipv4.tcp_congestion_control = bbr
Uses BBR as the CCA. BBR is a Google algorithm that generally has the best throughput. We use it basically because it is unfairly aggressive.
This script also does some tuning to UDP and also enables forwarding.