搬瓦工SS速度优化可行方案

2016年6月2日星期四

搬瓦工SS速度优化可行方案


Bandwagonhost搬瓦工vps属于OpenVZ架构,所以不能安装锐速来优化速度,安装netspeeder对流量的消耗是成倍的,所以要是一边做站一边ss不建议使用。

后期跟进:发现openvz优化并没有什么卵用速度还是那个样!唯一有效的方法是安装netspeederFinalSpeed,后者加速更明显

首先修复一下否则会报错,只要删除原来的sysctl并且新建一个软连接就行了。(注意,在删除前请备份/sbin/sysctl)
rm -f /sbin/sysctl
ln -s /bin/true /sbin/sysctl

有些朋友还喜欢添加net bridge相关命令在sysctl中并且得到下面的错误,
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
error: "net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables" is an unknown key

可以运行如下命令解决,
modprobe bridge
lsmod|grep bridge

如果继续得到如下错误,
FATAL: Module bridge not found.

还是用同样的方法新建软链接来解决。(注意,在删除前请备份/sbin/modprobe)
rm -f /sbin/modprobe
ln -s /bin/true /sbin/modprobe

TCP优化

vi /etc/sysctl.conf


fs.file-max = 51200

net.core.rmem_max = 67108864

net.core.wmem_max = 67108864

net.core.netdev_max_backlog = 250000

net.core.somaxconn = 4096

net.ipv4.tcp_syncookies = 1

net.ipv4.tcp_tw_reuse = 1

net.ipv4.tcp_tw_recycle = 0

net.ipv4.tcp_fin_timeout = 30

net.ipv4.tcp_keepalive_time = 1200

net.ipv4.ip_local_port_range = 10000 65000

net.ipv4.tcp_max_syn_backlog = 8192

net.ipv4.tcp_max_tw_buckets = 5000

net.ipv4.tcp_fastopen = 3

net.ipv4.tcp_mem = 25600 51200 102400

net.ipv4.tcp_rmem = 4096 87380 67108864

net.ipv4.tcp_wmem = 4096 65536 67108864

net.ipv4.tcp_mtu_probing = 1

net.ipv4.tcp_congestion_control = hybla

最后别忘了用如下命令重新加载下修改后的文件

sysctl -p

优化以后搬瓦工ss速度明显提升,白天油管720p不卡。

0 评论 :

发表评论