如何提升SS/SSR速度

安装锐速

参照以下教程

2款锐速安装脚本+教程

内核参数优化

1.增加系统文件描述符的最大限数

编辑文件 limits.conf

vi /etc/security/limits.conf

最后新增两行添加命令:

* soft nofile 51200

* hard nofile 51200

复制代码

如发现limits.conf文件内容已经有,请修改为上。

编辑文件 profile

vi /etc/profile

最后新增一行添加命令:

ulimit -SHn 51200

修改后重启,检查是否生效命令:ulimit -n

2.调整内核参数

修改配置文件sysctl.conf

vi /etc/sysctl.conf

最后新增一行添加命令:

fs.file-max = 51200

net.core.rmem_max = 67108864

net.core.wmem_max = 67108864

net.core.rmem_default = 65536

net.core.wmem_default = 65536

net.core.netdev_max_backlog = 4096

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 = 4096

net.ipv4.tcp_max_tw_buckets = 5000

net.ipv4.tcp_fastopen = 3

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 使配置生效。

其中最后的hybla是为高延迟网络算法,欧美地区,需要内核支持,测试内核是否支持,

执行命令:sysctl net.ipv4.tcp_available_congestion_control

如果结果中有hybla,则证明你的内核已开启hybla,如果没有hybla,可以用命令modprobe tcp_hybla开启。

对于低延迟的网络亚洲地区,可以使用htcp,有非常显著的提高速度,首先使用modprobe tcp_htcp开启,再将net.ipv4.tcp_congestion_control = hybla改为

net.ipv4.tcp_congestion_control = htcp

(高于平均ping 90ms用hybla,低于平均ping 100ms用htcp)

使用其他加密方式

若选择使用chacha20或salsa20加密,则需要额外安装libsodium到vps

1,编译并安装libsodium。

https://download.libsodium.org/libsodium/releases/

下载libsodium.tar.gz,目前最新的版本是libsodium-1.0.9.tar.gz。

运行以下命令:

wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.9.tar.gz

tar zxvf libsodium-1.0.9.tar.gz

cd libsodium-1.0.9

./configure

make

make install

若配置失败,可能是未安装gcc 编译器。运行命令:apt-get install gcc-multilib

2,修复动态链接库。

执行命令:

vi /etc/ld.so.conf

添加一行:

/usr/local/lib

复制代码

保存退出后,运行命令:ldconfig

3,修改Shadowsocks的配置文件,把加密方式(method)改为“chacha20”或“salsa20”。

保存之后reboot重启VPS即可。记得客户端的加密方式也要改哦。

锐速的配置

使用方法命令:

启动锐速 /appex/bin/lotServer.sh start

重启锐速 /appex/bin/lotServer.sh restart

停止锐速 /appex/bin/lotServer.sh stop

状态查询 /appex/bin/lotServer.sh status

加速状态 /appex/bin/lotServer.sh stats

刷新配置 /appex/bin/lotServer.sh reload

修改锐速配置参数(很多人安装锐速后,没多少效果,主要就是没有修改锐速配置文件的核心参数。)

以下要修改的参数可能你的VPS部分不支持,请看这里 http://www.tcpedge.com/manual.html 锐速各项参数的说明详解

vi /appex/etc/config

所需要设置的各项参数如下

acc=”1″

advacc=”1″

advinacc=”1″

maxmode=”1″

initialCwndWan=”44″

l2wQLimit=”256 2048″

w2lQLimit=”256 2048″

shaperEnable=”0″

SmBurstMS=”25″

rsc=”1″

gso=”1″

engineNum=”0″

shortRttMS=”60″

让你的SS更猛烈些吧,黑科技。

ping测试站:

http://tool.chinaz.com/ping

initialCwndWan=”44″

平均ping ms÷3=数值

l2wQLimit=”256 2048″

w2lQLimit=”256 2048″

VPS内存

内存MB值

缓存KB值

256M

256

2048

512M

512

4096

1G

1024

8192

2G

2048

16384

4G

4096

32768

VPS内存MB×8=缓存数值

SmBurstMS=”15″

平均ping ms÷9=数值

engineNum=”0″

CPU核心 0=1核 1=2核 2=3核 3=4核,你的VPS是多少核心的就按这样以此类推。

shortRttMS=”0″

平均ping ms÷3=数值,最高100,再高也没啥效果了。