freebsd:freebsd_bbr

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录前一修订版
后一修订版
前一修订版
freebsd:freebsd_bbr [2024/06/03 17:21] – added tags Hshhfreebsd:freebsd_bbr [2026/08/07 02:27] (当前版本) – Hshh
行 1: 行 1:
-====== 轻松在 FreeBSD 14.1+ 启用 BBR 功能 ======+====== 轻松在现代 FreeBSD 中启用 BBR 功能 ======
  
 从 14.1 开始 tcphpts, tcp_rack, tcp_bbr 都已经默认编译为模块, 需要用直接加载就可以了, 不需要重新编译内核. 从 14.1 开始 tcphpts, tcp_rack, tcp_bbr 都已经默认编译为模块, 需要用直接加载就可以了, 不需要重新编译内核.
行 27: 行 27:
 </code> </code>
  
-==== 使应用使用 BBR ==== +==== 过早启动的程序使用 BBR ==== 
-默认在切换前启动的应用并不会使用到切换后的 bbr, 一种方法是重启应用, 一种是设置+默认在切换前启动的程序并不会使用到切换后的 bbr, 一种方法是重启程序 
 + 
 +另一种是使用特定设置, 15.1 以前使用 sysctl
 <code> <code>
 sysctl net.inet.tcp.functions_inherit_listen_socket_stack=0 sysctl net.inet.tcp.functions_inherit_listen_socket_stack=0
 </code> </code>
  
-==== 系统启动时自动设置 sysctl ==== +15.1 及以后运行以下命令 
-添加以下内容至 /etc/sysctl.conf 或 /etc/sysctl.conf.local+<code>tcpsso -S freebsd TCP_FUNCTION_BLK bbr</code> 
 + 
 +==== 一些优化参数 ==== 
 +== 20241205 == 
 +关闭 net.inet.tcp.bbr.measure.use_google 后, 大多数情况不会出现断流<del>, 极小概率在某个系统出现极低速(该问题是接收端其他bug导致)</del>
 <code> <code>
-net.inet.tcp.functions_default=bbr +net.inet.tcp.bbr.measure.use_google=0
-net.inet.tcp.functions_inherit_listen_socket_stack=0+
 </code> </code>
 +
 +== 20260719 ==
 +可以通过优化 net.inet.tcp.bbr.cwnd.highspeed_min net.inet.tcp.bbr.cwnd.max_target_limit net.inet.tcp.bbr.probertt.cwnd, 使其在快速网络中接近 linux 的水平, 但是还是没 linux 能打
 +  * 1Gbps
 +<code>
 +# 1Gbps
 +net.inet.tcp.bbr.cwnd.highspeed_min=128
 +net.inet.tcp.bbr.cwnd.max_target_limit=16
 +net.inet.tcp.bbr.probertt.cwnd=16
 +net.inet.tcp.sendbuf_inc=262144
 +net.inet.tcp.sendbuf_max=16777216
 +net.inet.tcp.sendspace=4194304
 +</code>
 +  * 2.5Gbps
 +<code>
 +# 1Gbps
 +kern.ipc.maxsockbuf=33554432
 +net.inet.tcp.bbr.cwnd.highspeed_min=256
 +net.inet.tcp.bbr.cwnd.max_target_limit=16
 +net.inet.tcp.bbr.probertt.cwnd=32
 +net.inet.tcp.sendbuf_inc=524288
 +net.inet.tcp.sendbuf_max=33554432
 +net.inet.tcp.sendspace=2097152
 +</code>
 +  * 10Gbps
 +<code>
 +# 10Gbps
 +kern.ipc.maxsockbuf=67108864
 +net.inet.tcp.bbr.cwnd.highspeed_min=512
 +net.inet.tcp.bbr.cwnd.max_target_limit=32
 +net.inet.tcp.bbr.probertt.cwnd=128
 +net.inet.tcp.sendbuf_inc=1048576
 +net.inet.tcp.sendbuf_max=67108864
 +net.inet.tcp.sendspace=4194304
 +</code>
 +
 +== 20260807 ==
 +关于这个参数 net.inet.tcp.bbr.cwnd.tar_rtt, 测试出来有些争议, 移除了.
  
 {{tag>freebsd bbr rack}} {{tag>freebsd bbr rack}}
freebsd/freebsd_bbr.1717406498.txt.gz · 最后更改: 由 Hshh