Meocat 发表于 2024-10-10 17:57:17

分享一下我用的sysctl.conf

本帖最后由 Meocat 于 2024-10-10 17:59 编辑

网络参数是从 google pixel 9 开源的代码抄的,google 给它的安卓手机用的网络参数,我认为比较适合现代的网络环境
https://cs.android.com/android/platform/superproject/main/+/main:device/google/zumapro/conf/init.zumapro.board.rc;l=100

net.ipv4.tcp_slow_start_after_idle=0 是针对代理设置的,代理不需要慢启动
https://github.com/klzgrad/naiveproxy/wiki/Performance-Tuning#turn-off-tcp_slow_start_after_idle

net.ipv4.tcp_notsent_lowat = 16384,naive 作者推荐 131072,我选择保守些的 16384,是 cloudflare 推荐的
https://blog.cloudflare.com/http-2-prioritization-with-nginx

net.ipv4.tcp_ecn=1 则是我用了 bbr v3,支持 ecn 就试了下,对网速没什么影响而且从原理上能降低网络拥塞,外国的网站服务器也普遍开了 ecn,
用 bbr v3
的可以打开试试,需要本地设备也打开 ecn

用bbr v1
的不需要打开 ecn
https://github.com/google/bbr/tree/v3?tab=readme-ov-file#enabling-ecn-support


[*]net.core.default_qdisc = fq
[*]net.ipv4.tcp_congestion_control = bbr
[*]net.core.rmem_default = 1310720
[*]net.core.rmem_max = 8388608
[*]net.core.wmem_default = 327680
[*]net.core.wmem_max = 8388608
[*]net.core.optmem_max = 20480
[*]net.core.netdev_max_backlog = 10000
[*]net.ipv4.tcp_rmem = 2097152 4194304 8388608
[*]net.ipv4.tcp_wmem = 262144 524288 8388608
[*]net.ipv4.tcp_mem = 44259 59012 88518
[*]net.ipv4.udp_mem = 88518 118025 177036
[*]net.ipv4.tcp_slow_start_after_idle = 0
[*]net.ipv4.tcp_notsent_lowat = 16384
[*]net.ipv4.tcp_ecn=1复制代码

以上我 sysctl.conf 参数改动的来源都附链接说明了
页: [1]
查看完整版本: 分享一下我用的sysctl.conf