海外云服务器tcp优化参数(私房菜)

自用版本(晚上 实测能从700KB 提升到 11MB)

# 套接字缓冲区增大
net.core.rmem_max = 25000000
net.core.wmem_max = 25000000
net.ipv4.tcp_rmem = 4096 87380 25000000
net.ipv4.tcp_wmem = 4096 65536 25000000

# 开启 TCP 快速打开
net.ipv4.tcp_fastopen = 3

# TIME-WAIT 优化
net.ipv4.tcp_tw_reuse = 1

# 默认队列为 fq(必须,否则 BBR 效果降低)
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr

某海外vps预设值

# 文件描述符限制
fs.file-max = 655350

# TCP连接优化
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
net.ipv4.tcp_ecn = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_max_orphans = 262144
net.core.somaxconn = 65535

# 内存缓冲区配置
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 8388608
net.core.wmem_max = 8388608
net.ipv4.tcp_rmem = 4096 87380 8388608
net.ipv4.tcp_wmem = 4096 87380 8388608

# 其他核心参数
net.ipv4.ip_local_port_range = 1024 65535
net.core.netdev_max_backlog = 16384

net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.all.rp_filter = 0
net.ipv4.ip_forward = 1

其他相关知识

    # 查看当前拥塞算法
    sysctl net.ipv4.tcp_congestion_control

    # 查看系统已加载的算法(支持的算法)
    root@la-vps:/home# sysctl net.ipv4.tcp_available_congestion_control
    net.ipv4.tcp_available_congestion_control = reno cubic bbr

    # 验证 BBR 是否真正生效
    ss -ti      # 若是看到 cubic → bbr  或者 cong=bbr 表示bbr生效
    root@la-vps:~# ss -ti
    State                  Recv-Q                  Send-Q                                               Local Address:Port                                             Peer Address:Port                                                                                                                                                                                                                          
    ESTAB                  0                       68                                                  104.168.15.151:65535                                             27.9.30.205:58997                  
        cubic wscale:7,7 rto:400 rtt:198.201/10.079 ato:40 mss:1440 pmtu:1500 rcvmss:1344 advmss:1448 cwnd:7 ssthresh:4 bytes_sent:159565 bytes_retrans:7312 bytes_acked:152185 bytes_received:26584 segs_out:840 segs_in:1066 data_segs_out:715 data_segs_in:399 send 407kbps lastsnd:8 lastrcv:8 lastack:8 pacing_rate 488kbps delivery_rate 433kbps delivered:689 app_limited busy:73576ms unacked:1 retrans:0/17 dsack_dups:1 reord_seen:1 rcv_space:14480 rcv_ssthresh:62464 minrtt:182.302 rcv_ooopack:2 snd_wnd:64128 rcv_wnd:62464
    ESTAB                  0                       22278336                                   [::ffff:104.168.15.151]:8080                                     [::ffff:27.9.30.205]:54548                  
        bbr wscale:7,9 rto:388 rtt:184.898/0.312 ato:40 mss:1440 pmtu:1500 rcvmss:536 advmss:1448 cwnd:4470 ssthresh:2146 bytes_sent:66814177 bytes_retrans:984960 bytes_acked:62650177 bytes_received:146 segs_out:46405 segs_in:9914 data_segs_out:46404 data_segs_in:1 bbr:(bw:130Mbps,mrtt:180.628,pacing_gain:1.25,cwnd_gain:2) send 279Mbps lastrcv:7368 pacing_rate 161Mbps delivery_rate 125Mbps delivered:43513 busy:7364ms rwnd_limited:2420ms(32.9%) unacked:2208 retrans:0/684 reordering:16 reord_seen:10 rcv_space:14480 rcv_ssthresh:42242 notsent:19099296 minrtt:180.628 snd_wnd:3192704 rcv_wnd:43520
声明:本文为原创,作者为 辣条①号,转载时请保留本声明及附带文章链接:https://boke.wsfnk.com/archives/1597.html
谢谢你请我吃辣条谢谢你请我吃辣条

如果文章对你有帮助,欢迎点击上方按钮打赏作者

最后编辑于:2025/11/29作者: 辣条①号

目标:网络规划设计师、系统工程师、ceph存储工程师、云计算工程师。 不负遇见,不谈亏欠!

暂无评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

arrow grin ! ? cool roll eek evil razz mrgreen smile oops lol mad twisted wink idea cry shock neutral sad ???

文章目录