调整CentOS 7的initcwnd数值

initcwnd为TCP连接时的拥塞窗口数量,默认为10

我们为了提高传输容量,可以修改数值,以减少ACK请求

这里提供脚本可以修改
新建一个脚本 /root/changecwnd.sh

#!/bin/bash 
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/sbin:/root
export  PATH
sleep 60
defrt=`ip route | grep "^default" | head -1`
ip route change $defrt  initcwnd 42 initrwnd 42

添加到crontab
@reboot  bash  /root/changecwnd.sh

或者添加到开机运行
echo "/root/changecwnd.sh" >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local

或者移动脚本
chmod +x  /root/changecwnd.sh
mv /root/changecwnd.sh  /etc/init.d

数值可以自定义,数值越大越耗性能

参考来源
https://serverfault.com/questions/546523/linux-initcwnd-and-initrwnd-via-etc-sysctl-conf
https://www.cdnplanet.com/blog/tune-tcp-initcwnd-for-optimum-performance/
https://www.cdnplanet.com/tools/initcwndcheck

此处评论已关闭