VPS服务器常用性能一键测试脚本
一、superbench测试VPS服务器配置信息、IO性能、到国内节点的网速
wget https://raw.githubusercontent.com/oooldking/script/master/superbench.sh chmod +x superbench.sh ./superbench.sh
二、superspeed测试VPS服务器到国内节点的网速
wget https://raw.githubusercontent.com/oooldking/script/master/superspeed.sh chmod +x superspeed.sh ./superspeed.sh
三、serverreview-benchmark测试VPS服务器配置信息、CPU/内存/硬盘性能、全球节点测速
yum install curl -y curl -LsO https://raw.githubusercontent.com/sayem314/serverreview-benchmark/master/bench.sh chmod +x bench.sh ./bench.sh -a share
四、Best Trace可视化路由跟踪工具
可视化路由跟踪工具besttrace和besttrace4linux详细介绍
#Windows操作系统下载 https://cdn.ipip.net/17mon/besttrace.exe
MacOS下载:https://itunes.apple.com/us/app/best-trace/id1037779758?l=zh&ls=1&mt=12
五、ZBench版一键测试
# 中文版: wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/ZBench/master/ZBench-CN.sh && bash ZBench-CN.sh # 或者英文版: wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/ZBench/master/ZBench.sh && bash ZBench.sh
六、91yuntest一键测试
测试包含:常规系统参数检测,带宽测试,IO测试和全国ping测试、下载测试、路由测试、回程路由测试。下面代码直接复制到机器使用即可,默认会生成html页。
wget -N --no-check-certificate https://raw.githubusercontent.com/91yun/91yuntest/master/test.sh && bash test.sh -i "io,bandwidth,chinabw,download,traceroute,backtraceroute,allping,gotoping"
七、SuperSpeed 全面测速版
国内多城市多线路测试。
bash <(curl -Lso- https://git.io/superspeed)
CentOS7 开启Google BBR加速 让你的VPS更快
BBR 是 Google 提出的一种新型拥塞控制算法,可以使 Linux 服务器显著地提高吞吐量和减少 TCP 连接的延迟。
BBR解决了两个问题:
再有一定丢包率的网络链路上充分利用带宽。非常适合高延迟,高带宽的网络链路。
降低网络链路上的buffer占用率,从而降低延迟。非常适合慢速接入网络的用户。
项目地址:https://github.com/google/bbr
升级内核
开启 BBR 要求 4.10 以上版本 Linux 内核,可使用如下命令查看当前内核版本:
- uname -r
可以得到类似如下的结果:
- 3.10.0-514.10.2.el7.x86_64
如果当前内核版本低于 4.10,可使用 ELRepo 源更新:
- sudo rpm –import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
- sudo rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
- sudo yum –enablerepo=elrepo-kernel install kernel-ml -y
安装完成后,查看已安装的内核:
- rpm -qa | grep kernel
得到结果如下:
- kernel-3.10.0-123.el7.x86_64
- kernel-headers-3.10.0-514.16.1.el7.x86_64
- kernel-ml-4.11.0-1.el7.elrepo.x86_64
- kernel-tools-3.10.0-514.16.1.el7.x86_64
- kernel-3.10.0-514.16.1.el7.x86_64
- kernel-tools-libs-3.10.0-514.16.1.el7.x86_64
在输出中看到 kernel-ml-4.11.0-1.el7.elrepo.x86_64 类似的内容,表示安装成功。
修改grub2引导
执行:
- sudo egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \’
会得到如下结果:
- CentOS Linux 7 Rescue a0cbf86a6ef1416a8812657bb4f2b860 (4.11.0-1.el7.elrepo.x86_64)
- CentOS Linux (4.11.0-1.el7.elrepo.x86_64) 7 (Core)
- CentOS Linux (3.10.0-514.16.1.el7.x86_64) 7 (Core)
- CentOS Linux (3.10.0-123.el7.x86_64) 7 (Core)
- CentOS Linux (0-rescue-2d3f9371c20d3e90a544ccc814d485e3) 7 (Core)
由于序号从0开始,设置默认启动项为1并重启系统:
- sudo grub2-set-default 1
- reboot
重启完成后,重新登录并重新运行uname命令来确认你是否使用了正确的内核:
- uname -r
得到如下结果则升级成功:
- 4.11.0-1.el7.elrepo.x86_64
开启BBR
执行:
- echo ‘net.core.default_qdisc=fq’ | sudo tee -a /etc/sysctl.conf
- echo ‘net.ipv4.tcp_congestion_control=bbr’ | sudo tee -a /etc/sysctl.conf
- sudo sysctl -p
完成后,分别执行如下命令来检查 BBR 是否开启成功:
- sudo sysctl net.ipv4.tcp_available_congestion_control
- # 输出应为 net.ipv4.tcp_available_congestion_control = bbr cubic reno
- sudo sysctl -n net.ipv4.tcp_congestion_control
- # 输出应为 bbr
- lsmod | grep bbr
- # 输出应类似 tcp_bbr 16384 28
速度测试
- # 需先在 firewalld 中开启 http 服务
- sudo dd if=/dev/zero of=500mb.zip bs=1024k count=500
CentOS7配置BBR加速
1. 安装ELRepo
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
# install ELRepo for RHEL-8 or CentOS-8
# rpm -Uvh https://www.elrepo.org/elrepo-release-8.0-2.el8.elrepo.noarch.rpm
# install ELRepo for RHEL-7 or CentOS-7
rpm -Uvh https://www.elrepo.org/elrepo-release-7.0-4.el7.elrepo.noarch.rpm
# install ELRepo for RHEL-6, SL-6 or CentOS-6
rpm -Uvh https://www.elrepo.org/elrepo-release-6-9.el6.elrepo.noarch.rpm
2. 升级 CentOS 7 内核
yum --enablerepo=elrepo-kernel -y install kernel-ml kernel-ml-devel
3. 更新grub引导
# 查询当前内核版本
uname -r
> 3.10.0-957.27.2.el7.x86_64
# 查询可用内核版本
egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'
> CentOS Linux (5.2.14-1.el7.elrepo.x86_64) 7 (Core)
> CentOS Linux (3.10.0-957.27.2.el7.x86_64) 7 (Core)
> CentOS Linux (3.10.0-514.26.2.el7.x86_64) 7 (Core)
> CentOS Linux (3.10.0-514.el7.x86_64) 7 (Core)
> CentOS Linux (0-rescue-963c2c41b08343f7b063dddac6b2e486) 7 (Core)
# 更换默认启动内核
grub2-set-default 0
# 重启
reboot
4. 写入BBR配置文件
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
# 保存配置文件
sysctl -p
5. 检查BBR是否启用成功
# 当返回结果包含bbr,则启用成功
sysctl net.ipv4.tcp_available_congestion_control
> net.ipv4.tcp_available_congestion_control = reno cubic bbr
# 当能查询到bbr,则启用成功
lsmod | grep bbr
> tcp_bbr 20480 6