分享几个搬瓦工 VPS 性能一键测试脚本
目 录
今天分享几个 VPS 性能一键测试脚本,可以快速的测试搬瓦工 VPS 的性能,当然也可以适用于其他任何的 VPS 上面。购买一台 VPS 之后,我们都希望大致了解一下当前的 VPS 的性能怎么样,通过下面这些脚本,可以整体了解一下
这些脚本由各位大佬进行维护,本站仅作分享,所有脚本的出处都已经给出,并且脚本运行后的示例输出也附上了,有需要的可以自取
wget 是必须的,请先安装:
CentOS:
1 | yum -y install wget |
Ubuntu / Debian:
1 | apt install -y wget |
一、搬瓦工 VPS 性能测试一键脚本
1、Bench.sh
测试命令:
1 | wget -qO- bench.sh | bash |
效果图:
2、Superbench.sh
测试命令:
1 | wget -qO- git.io/superbench.sh | bash |
效果图:
3、ZBench.sh
ZBench 基本上是把上面两个脚本的功能合并了一下,再自己加了些许新的功能,可以说是集大成者,可以一次性测试上面两个脚本的测试项。
测试命令:
中文版:
1 | wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/ZBench/master/ZBench-CN.sh && bash ZBench-CN.sh |
英文版:
1 | wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/ZBench/master/ZBench.sh && bash ZBench.sh |
来源:/ZBench
效果图:
4、UnixBench
测试命令:
1 | wget --no-check-certificate https://github.com/teddysun/across/raw/master/unixbench.sh chmod +x unixbench.sh ./unixbench.sh |
这个耗时太久,一般不做测试,如果真的需要,可以自己进行测试,一般来说搬瓦工的跑分都能在 1000 以上
二、搬瓦工 VPS 回程路由一键测试
1、路由测试
测试命令:
1 | wget -qO- git.io/besttrace | bash |
来源:分享一个一键测试搬瓦工等所有 VPS 路由回程信息的脚本
部分效果图:
三、一键安装开启谷歌 BBR 脚本
顺便分享几个其他脚本。
一键安装谷歌 BBR:
搬瓦工 VPS 安装并开启 Google BBR 教程(KVM)
使用环境
虚拟化:KVM、Xen等,除了OpenVZ基本都行
系统:CentOS 6+,Debian 7+,Ubuntu 12+
内存:128MB以上
方法
使用root登陆VPS,输入下面命令:
1 | wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh chmod +x bbr.sh ./bbr.sh |
完成后,提示重启,输入y并重启VPS
重启后,验证是否成功安装,输入:
1 | uname -r |
查看内核版本,含有 4.10 就表示 OK 了
1 | sysctl net.ipv4.tcp_available_congestion_control |
返回值一般为:
net.ipv4.tcp_available_congestion_control = bbr cubic reno
1 | sysctl net.ipv4.tcp_congestion_control |
返回值一般为:
net.ipv4.tcp_congestion_control = bbr
1 | sysctl net.core.default_qdisc |
返回值一般为:
net.core.default_qdisc = fq
1 | lsmod | grep bbr |
返回值有 tcp_bbr 模块即说明bbr已启动
搬瓦工 OpenVZ 版本安装 BBR 的教程
下面开始进入正题。
已测试通过的系统: Ubuntu 14.04 x64、Ubuntu 16.04 x64、CentOS 6 x64、CentOS 7 x64 只支持 64 位系统,要求 glibc 版本 2.14 以上
安装:
1 2 3 | wget https://raw.githubusercontent.com/kuoruan/shell-scripts/master/ovz-bbr/ovz-bbr-installer.sh chmod +x ovz-bbr-installer.sh ./ovz-bbr-installer.sh |
需要配置的选项:
1.端口,即你用到的端口。开启后,流量先经过 BBR 处理,然后发送给指定端口。
2.可能需要配置“公网接口名称”,即你服务器上具有公网 IP 的接口名称。搬瓦工 OpenVZ 上默认都是 venet0,不需要配置。
好了,搬瓦工的 VPS 上,至此应该已经安装成功了。下面继续介绍一些使用方法以及问题排除。
在有 firewalld 的服务器上安装的时候,firewalld 会干扰 iptables 的规则,造成网络不通(现在具体原因未知,谁有解决方案可以提示一下)。所以在装有 firewalld 的服务器上需要先退出 firewalld:
1 2 | systemctl disable firewalld systemctl stop firewalld |
其他使用说明
卸载:
1 | ./ovz-bbr-installer.sh uninstall |
多端口配置:
安装的时候只配置了一个加速端口,但是你可以配置多端口加速,配置方法非常简单。 修改文件
1 | vim /usr/local/haproxy-lkl/etc/port-rules |
在文件里添加需要加速的端口,每行一条,可以配置单个端口或者端口范围,以 # 开头的行将被忽略。 例如:8800 或者 8800-8810 配置完成之后,只需要重启 haproxy-lkl 即可
启动、停止、重启 HAproxy-lkl:
1 | systemctl {start|stop|restart} haproxy-lkl |
或者:
1 | service haproxy-lkl {start|stop|restart} |
如果想自定义配置(新手请忽略):
1 | /usr/local/haproxy-lkl/sbin/haproxy-lkl |
更新 glibc
如果 glibc 版本过低,可以进行更新。
CentOS 6:
1 2 3 4 5 6 7 8 9 10 11 | wget http://ftp.redsleeve.org/pub/steam/glibc-2.15-60.el6.x86_64.rpm \ http://ftp.redsleeve.org/pub/steam/glibc-common-2.15-60.el6.x86_64.rpm \ http://ftp.redsleeve.org/pub/steam/glibc-devel-2.15-60.el6.x86_64.rpm \ http://ftp.redsleeve.org/pub/steam/glibc-headers-2.15-60.el6.x86_64.rpm \ http://ftp.redsleeve.org/pub/steam/nscd-2.15-60.el6.x86_64.rpm rpm -Uvh glibc-2.15-60.el6.x86_64.rpm \ glibc-common-2.15-60.el6.x86_64.rpm \ glibc-devel-2.15-60.el6.x86_64.rpm \ glibc-headers-2.15-60.el6.x86_64.rpm \ nscd-2.15-60.el6.x86_64.rpm |
如果无法更新,手动编译:
1 2 3 4 5 6 7 8 9 | wget http://ftp.gnu.org/gnu/glibc/glibc-2.15.tar.gz wget http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz tar -zxf glibc-2.15.tar.gz tar -zxf glibc-ports-2.15.tar.gz mv glibc-ports-2.15 glibc-2.15/ports mkdir glibc-build-2.15 cd glibc-build-2.15 ../glibc-2.15/configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin make all && make install |
检查一下:
1 2 3 4 5 6 | ldd --version ldd (GNU libc) 2.15 Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Written by Roland McGrath and Ulrich Drepper. |
判断 BBR 是否工作
判断 bbr 是否正常启动可以尝试 ping 10.0.0.2,如果能通,说明 bbr 已经启动
检查一下 iptables 规则:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | iptables -t nat -nL Chain PREROUTING (policy ACCEPT) target prot opt source destination LKL_IN all -- 0.0.0.0/0 0.0.0.0/0 Chain POSTROUTING (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination Chain LKL_IN (1 references) target prot opt source destination DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8989 to:10.0.0.2 |
里边会看到多了一张链表 LKL_IN,里边有相应的端口规则
常见问题FAQ
- 免费下载或者VIP会员专享资源能否直接商用?