Retune BBRv3 Max for usable throughput

This commit is contained in:
byjoey
2026-06-15 20:51:04 +08:00
parent 07c246922c
commit af2d3d678b
4 changed files with 33 additions and 33 deletions
+3 -3
View File
@@ -8,7 +8,7 @@
bash <(curl -fsSL https://raw.githubusercontent.com/byJoey/Actions-bbr-v3/main/install.sh) bash <(curl -fsSL https://raw.githubusercontent.com/byJoey/Actions-bbr-v3/main/install.sh)
``` ```
脚本会自动识别当前系统架构,从本仓库 GitHub Releases 下载匹配的 BBRv3 内核 `.deb` 包,并提供安装、指定版本安装、状态检查、加速模式切换和卸载功能。安装内核时可选择标准 BBRv3 或 BBRv3 Max 极限内核。 脚本会自动识别当前系统架构,从本仓库 GitHub Releases 下载匹配的 BBRv3 内核 `.deb` 包,并提供安装、指定版本安装、状态检查、加速模式切换和卸载功能。安装内核时可选择标准 BBRv3 或 BBRv3 Max 激进吞吐内核。
## 支持环境 ## 支持环境
@@ -90,7 +90,7 @@ bash <(curl -fsSL https://raw.githubusercontent.com/byJoey/Actions-bbr-v3/main/i
- 检查系统是否为 Debian/Ubuntu。 - 检查系统是否为 Debian/Ubuntu。
- 检查架构是否为 `x86_64``aarch64` - 检查架构是否为 `x86_64``aarch64`
- 让用户选择标准 BBRv3 或 BBRv3 Max 极限内核。 - 让用户选择标准 BBRv3 或 BBRv3 Max 激进吞吐内核。
- 从 GitHub Releases 获取当前架构和内核类型匹配的最新版本。 - 从 GitHub Releases 获取当前架构和内核类型匹配的最新版本。
- 下载非 debug 的内核 `.deb` 包。 - 下载非 debug 的内核 `.deb` 包。
- 安装新内核并更新引导配置。 - 安装新内核并更新引导配置。
@@ -122,7 +122,7 @@ x86_64-7.0.11-max
arm64-7.0.11-max arm64-7.0.11-max
``` ```
其中不带 `-max` 的 tag 是标准 BBRv3 内核,带 `-max` 的 tag 是 BBRv3 Max 极限内核。Max 版会极度弱化 BBRv3 的降速、ECN、loss/inflight 收敛力度,但保留反馈闭环,只适合自有链路极限测速挑战,不建议日常生产使用。 其中不带 `-max` 的 tag 是标准 BBRv3 内核,带 `-max` 的 tag 是 BBRv3 Max 激进吞吐内核。Max 版会提高 Startup、ProbeBW 和 cwnd 策略的进攻性,但保留 BBRv3 的 loss、ECN、inflight 和 ProbeBW 反馈闭环,只适合自有链路吞吐测试,不建议日常生产使用。
## 检查 BBRv3 状态 ## 检查 BBRv3 状态
+3 -3
View File
@@ -968,7 +968,7 @@ get_arch_filter() {
get_profile_label() { get_profile_label() {
case "${1:-standard}" in case "${1:-standard}" in
max) echo "BBR v3 Max极限内核)" ;; max) echo "BBR v3 Max激进吞吐内核)" ;;
*) echo "BBR v3 标准版" ;; *) echo "BBR v3 标准版" ;;
esac esac
} }
@@ -994,7 +994,7 @@ select_kernel_profile() {
echo -e "\033[36m请选择要安装的内核类型:\033[0m" echo -e "\033[36m请选择要安装的内核类型:\033[0m"
echo -e "\033[33m 1. BBR v3 标准版(推荐日常使用)\033[0m" echo -e "\033[33m 1. BBR v3 标准版(推荐日常使用)\033[0m"
echo -e "\033[33m 2. BBR v3 Max 极限版(只为暴力测速,不管稳定性\033[0m" echo -e "\033[33m 2. BBR v3 Max 激进吞吐版(自有链路测速实验\033[0m"
echo -n -e "\033[36m请输入选项 (1-2,默认 1): \033[0m" echo -n -e "\033[36m请输入选项 (1-2,默认 1): \033[0m"
read -r PROFILE_CHOICE read -r PROFILE_CHOICE
@@ -1004,7 +1004,7 @@ select_kernel_profile() {
;; ;;
2) 2)
KERNEL_PROFILE="max" KERNEL_PROFILE="max"
echo -e "\033[31m警告:BBR v3 Max 会极度弱化降速与惩罚逻辑但保留反馈闭环只适合极限测速挑战,不建议日常生产使用。\033[0m" echo -e "\033[31m警告:BBR v3 Max 会提高探测和窗口策略的进攻性,但仍保留 loss/ECN/inflight 反馈闭环只适合自有链路吞吐测试,不建议日常生产使用。\033[0m"
;; ;;
*) *)
echo -e "\033[31m输入无效,取消安装。\033[0m" echo -e "\033[31m输入无效,取消安装。\033[0m"
+26 -26
View File
@@ -23,37 +23,37 @@ text = path.read_text()
replacements = { replacements = {
r"static const u32 bbr_probe_rtt_win_ms = .*?;": "static const u32 bbr_probe_rtt_win_ms = 10000;", r"static const u32 bbr_probe_rtt_win_ms = .*?;": "static const u32 bbr_probe_rtt_win_ms = 10000;",
r"static const u32 bbr_probe_rtt_cwnd_gain = .*?;": "static const u32 bbr_probe_rtt_cwnd_gain = BBR_UNIT * 2;", r"static const u32 bbr_probe_rtt_cwnd_gain = .*?;": "static const u32 bbr_probe_rtt_cwnd_gain = BBR_UNIT;",
r"static const u32 bbr_probe_rtt_mode_ms = .*?;": "static const u32 bbr_probe_rtt_mode_ms = 10;", r"static const u32 bbr_probe_rtt_mode_ms = .*?;": "static const u32 bbr_probe_rtt_mode_ms = 10;",
r"static const u32 bbr_tso_rtt_shift = .*?;": "static const u32 bbr_tso_rtt_shift = 2;", r"static const u32 bbr_tso_rtt_shift = .*?;": "static const u32 bbr_tso_rtt_shift = 2;",
r"static const int bbr_pacing_margin_percent = .*?;": "static const int bbr_pacing_margin_percent = 0;", r"static const int bbr_pacing_margin_percent = .*?;": "static const int bbr_pacing_margin_percent = 0;",
r"static const int bbr_startup_pacing_gain = .*?;": "static const int bbr_startup_pacing_gain = BBR_UNIT * 4;", r"static const int bbr_startup_pacing_gain = .*?;": "static const int bbr_startup_pacing_gain = BBR_UNIT * 3;",
r"static const int bbr_startup_cwnd_gain = .*?;": "static const int bbr_startup_cwnd_gain = BBR_UNIT * 4;", r"static const int bbr_startup_cwnd_gain = .*?;": "static const int bbr_startup_cwnd_gain = BBR_UNIT * 5 / 2;",
r"static const int bbr_drain_gain = .*?;": "static const int bbr_drain_gain = BBR_UNIT / 2;", r"static const int bbr_drain_gain = .*?;": "static const int bbr_drain_gain = BBR_UNIT / 2;",
r"static const int bbr_cwnd_gain = .*?;": "static const int bbr_cwnd_gain = BBR_UNIT * 4;", r"static const int bbr_cwnd_gain = .*?;": "static const int bbr_cwnd_gain = BBR_UNIT * 5 / 2;",
r"static const u32 bbr_cwnd_min_target = .*?;": "static const u32 bbr_cwnd_min_target = 64;", r"static const u32 bbr_cwnd_min_target = .*?;": "static const u32 bbr_cwnd_min_target = 64;",
r"static const u32 bbr_full_bw_thresh = .*?;": "static const u32 bbr_full_bw_thresh = BBR_UNIT * 101 / 100;", r"static const u32 bbr_full_bw_thresh = .*?;": "static const u32 bbr_full_bw_thresh = BBR_UNIT * 105 / 100;",
r"static const u32 bbr_full_bw_cnt = .*?;": "static const u32 bbr_full_bw_cnt = 16;", r"static const u32 bbr_full_bw_cnt = .*?;": "static const u32 bbr_full_bw_cnt = 8;",
r"static const int bbr_extra_acked_gain = .*?;": "static const int bbr_extra_acked_gain = BBR_UNIT * 4;", r"static const int bbr_extra_acked_gain = .*?;": "static const int bbr_extra_acked_gain = BBR_UNIT * 2;",
r"static const u32 bbr_extra_acked_max_us = .*?;": "static const u32 bbr_extra_acked_max_us = 750 * 1000;", r"static const u32 bbr_extra_acked_max_us = .*?;": "static const u32 bbr_extra_acked_max_us = 750 * 1000;",
r"static const bool bbr_precise_ece_ack = .*?;": "static const bool bbr_precise_ece_ack = true;", r"static const bool bbr_precise_ece_ack = .*?;": "static const bool bbr_precise_ece_ack = true;",
r"static const u32 bbr_ecn_max_rtt_us = .*?;": "static const u32 bbr_ecn_max_rtt_us = 0;", r"static const u32 bbr_ecn_max_rtt_us = .*?;": "static const u32 bbr_ecn_max_rtt_us = 0;",
r"static const u32 bbr_beta = .*?;": "static const u32 bbr_beta = BBR_UNIT * 5 / 100;", r"static const u32 bbr_beta = .*?;": "static const u32 bbr_beta = BBR_UNIT * 20 / 100;",
r"static const u32 bbr_ecn_alpha_gain = .*?;": "static const u32 bbr_ecn_alpha_gain = BBR_UNIT * 1 / 64;", r"static const u32 bbr_ecn_alpha_gain = .*?;": "static const u32 bbr_ecn_alpha_gain = BBR_UNIT * 1 / 32;",
r"static const u32 bbr_ecn_alpha_init = .*?;": "static const u32 bbr_ecn_alpha_init = BBR_UNIT * 1 / 4;", r"static const u32 bbr_ecn_alpha_init = .*?;": "static const u32 bbr_ecn_alpha_init = BBR_UNIT * 1 / 2;",
r"static const u32 bbr_ecn_factor = .*?;": "static const u32 bbr_ecn_factor = BBR_UNIT * 5 / 100;", r"static const u32 bbr_ecn_factor = .*?;": "static const u32 bbr_ecn_factor = BBR_UNIT * 20 / 100;",
r"static const u32 bbr_ecn_thresh = .*?;": "static const u32 bbr_ecn_thresh = BBR_UNIT * 9 / 10;", r"static const u32 bbr_ecn_thresh = .*?;": "static const u32 bbr_ecn_thresh = BBR_UNIT * 7 / 10;",
r"static const u32 bbr_ecn_reprobe_gain = .*?;": "static const u32 bbr_ecn_reprobe_gain = BBR_UNIT;", r"static const u32 bbr_ecn_reprobe_gain = .*?;": "static const u32 bbr_ecn_reprobe_gain = BBR_UNIT * 3 / 4;",
r"static const u32 bbr_loss_thresh = [^\n]*": "static const u32 bbr_loss_thresh = BBR_UNIT * 10 / 100; /* max: tolerate 10% loss before backing off */", r"static const u32 bbr_loss_thresh = [^\n]*": "static const u32 bbr_loss_thresh = BBR_UNIT * 3 / 100; /* max: tolerate 3% loss before backing off */",
r"static const bool bbr_loss_probe_recovery = .*?;": "static const bool bbr_loss_probe_recovery = true;", r"static const bool bbr_loss_probe_recovery = .*?;": "static const bool bbr_loss_probe_recovery = true;",
r"static const u32 bbr_full_loss_cnt = .*?;": "static const u32 bbr_full_loss_cnt = 24;", r"static const u32 bbr_full_loss_cnt = .*?;": "static const u32 bbr_full_loss_cnt = 8;",
r"static const u32 bbr_full_ecn_cnt = .*?;": "static const u32 bbr_full_ecn_cnt = 8;", r"static const u32 bbr_full_ecn_cnt = .*?;": "static const u32 bbr_full_ecn_cnt = 4;",
r"static const u32 bbr_inflight_headroom = .*?;": "static const u32 bbr_inflight_headroom = BBR_UNIT * 1 / 100;", r"static const u32 bbr_inflight_headroom = .*?;": "static const u32 bbr_inflight_headroom = BBR_UNIT * 10 / 100;",
r"static const u32 bbr_bw_probe_cwnd_gain = .*?;": "static const u32 bbr_bw_probe_cwnd_gain = 3;", r"static const u32 bbr_bw_probe_cwnd_gain = .*?;": "static const u32 bbr_bw_probe_cwnd_gain = 2;",
r"static const u32 bbr_bw_probe_max_rounds = .*?;": "static const u32 bbr_bw_probe_max_rounds = 4;", r"static const u32 bbr_bw_probe_max_rounds = .*?;": "static const u32 bbr_bw_probe_max_rounds = 16;",
r"static const u32 bbr_bw_probe_rand_rounds = .*?;": "static const u32 bbr_bw_probe_rand_rounds = 1;", r"static const u32 bbr_bw_probe_rand_rounds = .*?;": "static const u32 bbr_bw_probe_rand_rounds = 2;",
r"static const u32 bbr_bw_probe_base_us = .*?;": "static const u32 bbr_bw_probe_base_us = 100 * 1000;", r"static const u32 bbr_bw_probe_base_us = .*?;": "static const u32 bbr_bw_probe_base_us = 750 * 1000;",
r"static const u32 bbr_bw_probe_rand_us = .*?;": "static const u32 bbr_bw_probe_rand_us = 50 * 1000;", r"static const u32 bbr_bw_probe_rand_us = .*?;": "static const u32 bbr_bw_probe_rand_us = 250 * 1000;",
} }
missing = [] missing = []
@@ -69,10 +69,10 @@ pacing_pattern = re.compile(
re.S, re.S,
) )
pacing_replacement = """static const int bbr_pacing_gain[] = { pacing_replacement = """static const int bbr_pacing_gain[] = {
\tBBR_UNIT * 7 / 2,\t/* UP: extreme but still feedback-bound */ \tBBR_UNIT * 3 / 2,\t/* UP: aggressive but keep BBR's feedback usable */
\tBBR_UNIT / 2,\t\t/* DOWN: preserve a minimal drain phase */ \tBBR_UNIT * 3 / 4,\t/* DOWN: drain the queue after probing */
\tBBR_UNIT * 5 / 4,\t/* CRUISE: keep pressure on the pipe */ \tBBR_UNIT,\t\t/* CRUISE: hold the measured pipe */
\tBBR_UNIT * 2,\t\t/* REFILL: refill aggressively */ \tBBR_UNIT * 5 / 4,\t/* REFILL: refill faster than standard BBRv3 */
};""" };"""
text, pacing_count = pacing_pattern.subn(pacing_replacement, text, count=1) text, pacing_count = pacing_pattern.subn(pacing_replacement, text, count=1)
if pacing_count != 1: if pacing_count != 1:
+1 -1
View File
@@ -54,7 +54,7 @@ bash "$repo_root/scripts/apply-bbrv3-max-profile.sh"
grep -v "MODULE_DESCRIPTION" net/ipv4/tcp_bbr.c > net/ipv4/tcp_bbr.c.tmp grep -v "MODULE_DESCRIPTION" net/ipv4/tcp_bbr.c > net/ipv4/tcp_bbr.c.tmp
mv net/ipv4/tcp_bbr.c.tmp net/ipv4/tcp_bbr.c mv net/ipv4/tcp_bbr.c.tmp net/ipv4/tcp_bbr.c
echo 'MODULE_DESCRIPTION("TCP BBR v3 Max - extreme throughput profile by Joey");' >> net/ipv4/tcp_bbr.c echo 'MODULE_DESCRIPTION("TCP BBR v3 Max - aggressive throughput profile by Joey");' >> net/ipv4/tcp_bbr.c
IFS='.' read -r v p s <<< "$kernel_version" IFS='.' read -r v p s <<< "$kernel_version"
sed -i "s/^VERSION *=.*/VERSION = $v/" Makefile sed -i "s/^VERSION *=.*/VERSION = $v/" Makefile