本文最后更新于 2019-06-12【1773 天前】,文中所描述的信息可能已发生改变,请谨慎使用。如有问题或建议,欢迎在文章底部留言参与讨论!

干货!汇总下常见的 VPS 的速度测试脚本,包括一键综合测试脚本、性能测试脚本和网络测试脚本。

Linux Bench 性能测试一键脚本

综合测试脚本

这类脚本是综合测试 VPS 基础信息、硬盘 IO、带宽和网络延迟等项目的一键式脚本

Bench.sh

秋水逸冰大佬的 Bench.sh 脚本,bench.sh 已经几乎全面适用于各种 Linux 发行版,可以查看 Linux 系统信息,以及网络带宽及硬盘读写速率(IO)测试,并将测试结果以较为美观的方式显示出来。
Github 地址:https://github.com/teddysun/across/blob/master/bench.sh
作者介绍链接:https://teddysun.com/444.html

特点

  • 显示当前测试的各种系统信息
  • 取自世界多处的知名数据中心的测试点,下载测试比较全面
  • 支持 IPv6 下载测速
  • IO 测试三次,并显示平均值
配合 unixbench.sh 脚本测试,即可全面测试 VPS 的性能

使用方法

wget -qO- bench.sh | bash
#或者
curl -Lso- bench.sh | bash

测试结果展示

Bench 测试脚本结果

SuperBench.sh

老鬼大佬的这个脚本是在基于秋水大佬 Bench.sh 脚本的基础上,加入了独服通电时间,服务器虚拟化架构等内容
Github 地址:https://github.com/oooldking/script/blob/master/superbench.sh
作者介绍链接:https://www.oldking.net/350.html

特点

  • 改进了显示的模式,基本参数添加了颜色,方面区分与查找。
  • I/O 测试,更改了原来默认的测试的内容,采用小文件,中等文件,大文件,分别测试 IO 性能,然后取平均值。
  • 速度测试替换成了 Superspeed 里面的测试,第一个默认节点是,Speedtest 默认,其他分别测试到中国电信,联通,移动,各三个不同地区的速度。

    使用方法

    wget -qO- git.io/superbench.sh | bash
    或者
    wget -qO- --no-check-certificate https://raw.githubusercontent.com/oooldking/script/master/superbench.sh | bash
    #或者
    curl -Lso- -no-check-certificate https://raw.githubusercontent.com/oooldking/script/master/superbench.sh | bash

    使用参数

    # 查看系统相关信息,如 CPU、OS、内核、内存、开机时间和负载等
    ./superbench.sh info 
    # IO 测试
    ./superbench.sh io
    # 网络速度测试
    ./superbench.sh speed
    # 带分享的测试
    ./superbench.sh share

    测试结果展示

    SuperBench测试脚本结果

ZBench

漏水和 kirito 大佬结合了 Bench.sh 和 SuperBench 测试脚本,并加入了 Ping 以及路由测试功能,还能生成测评报告,分享给其他人查看测评数据
Github 地址:https://github.com/FunctionClub/ZBench

特点

  • 自带 ping 以及路由测试
  • 会生成测评报告,可以很方便地分享给其他朋友看自己的测评数据

使用方法

如果中文版出现乱码等情况,请换成英文版
中文版命令
wget https://raw.githubusercontent.com/FunctionClub/ZBench/master/ZBench-CN.sh && bash ZBench-CN.sh 
英文版命令
wget https://raw.githubusercontent.com/FunctionClub/ZBench/master/ZBench.sh && bash ZBench.sh

测试结果展示

ZBench 测试脚本结果

ZBench 测试脚本结果html版

LinuxTest

本脚本最大的特点是测试全面,运行迅速,不会因为硬盘i/o低下或者网络状况不好,造成测试时间较长的问题,无论是什么机器,不带 UnixBench 都能保持在 15 分钟以内执行完
Github地址:https://github.com/chiakge/Linux-Server-Bench-Test
作者介绍链接:https://www.94ish.me/1752.html

测试项目

  • 获取系统基本信息
  • 测试硬盘存取延迟、iops、存取速度
  • 测试本机带宽
  • 测试本机到25个国外节点下载速度
  • 测试本机到8个国内节点下载速度
  • 测试本机到国内9个节点的路由
  • 测试本机到国内9个节点的延迟与丢包

使用方法

## 默认不含 UnixBench 的测试,无网页分享
wget https://raw.githubusercontent.com/chiakge/Linux-Server-Bench-Test/master/linuxtest.sh -N --no-check-certificate && bash linuxtest.sh

使用参数

## 不含 UnixBench 的测试,带网页分享
bash linuxtest.sh s
## 含 UnixBench 的测试,不带网页分享
bash linuxtest.sh a
## 含UnixBench的测试,带网页分享
bash linuxtest.sh as
网页分享不包含任何 VPS IP 信息

测试结果

https://www.imtqy.com/demo/LinuxTest_94ish.txt

LemonBench

LemonBench 工具(别名 LBench、柠檬 Bench),是一款针对 Linux 服务器设计的服务器性能测试工具。通过综合测试,可以快速评估服务器的综合性能,为使用者提供服务器硬件配置信息
作者介绍链接:https://blog.ilemonrain.com/linux/LemonBench.html

特点

  • 服务器基础信息 (CPU 信息/内存信息/ Swap 信息/磁盘空间信息等)
  • Speedtest网速测试 (本地到最近源及国内各地域不同线路的网速)
  • 磁盘测试 (4K 块/ 1M 块 直接写入测试)
  • 路由追踪测试 (追踪到国内和海外不同线路的路由信息)
  • Spoofer 测试 (获取详细网络信息,快速判断服务器接入线路)

    使用方法

    # 快速测试
    curl -fsSL https://ilemonrain.com/download/shell/LemonBench.sh | bash -s fast
    ## 或者
    wget -qO- https://ilemonrain.com/download/shell/LemonBench.sh | bash -s fast
    
    # 完整测试
    curl -fsSL https://ilemonrain.com/download/shell/LemonBench.sh | bash -s full
    ## 或者
    wget -qO- https://ilemonrain.com/download/shell/LemonBench.sh | bash -s full

    测试结果

    https://www.imtqy.com/demo/LemonBench.html

性能测试

UnixBench

UnixBench 是一个类 unix 系(Unix,BSD,Linux)统下的性能测试工具,一个开源工具,被广泛用与测试 Linux 系统主机的性能。
Github 地址:https://github.com/teddysun/across/blob/master/unixbench.sh
作者介绍链接:https://teddysun.com/245.html

特点

  • Unixbench 的主要测试项目有:系统调用、读写、进程、图形化测试、2D、3D、管道、运算、C 库等系统基准性能提供测试数据。

    使用方法

    wget --no-check-certificate https://github.com/teddysun/across/raw/master/unixbench.sh
    chmod +x unixbench.sh
    ./unixbench.sh

内存测试

检测 VPS 真实可分配内存的小工具,适用于检测 VPS 超售情况。本程序检测的可分配内存指的是用户使用时最大能占用的内存量
Github 地址:https://github.com/FunctionClub/Memtester

使用方法

CentOS / RHEL 系统

yum install wget -y
yum groupinstall "Development Tools" -y
wget https://raw.githubusercontent.com/FunctionClub/Memtester/master/memtester.cpp
gcc -l stdc++ memtester.cpp
./a.out

Ubuntu / Debian 系统

apt-get update
apt-get install wget build-essential -y
wget https://raw.githubusercontent.com/FunctionClub/Memtester/master/memtester.cpp
gcc -l stdc++ memtester.cpp
./a.out

网络测试脚本

SpeedTest

SpeedTest 是用来测试网络上传/下载速率的一款工具,在 Windows 上能很方便的测试本地网络的上传/下载速率,而在 Linux 上,也可以很方便的使用命令行 SpeedTest来测试。
Github地址:https://github.com/sivel/speedtest-cli
主页链接:https://www.speedtest.net/

使用方法

wget https://raw.github.com/sivel/speedtest-cli/master/speedtest.py
chmod a+rx speedtest.py
python speedtest.py
在默认情况下,SpeedTest是选择离测试机最近的一个节点进行测试的

使用参数

## 生成一张图片,并分享给其他人
python speedtest.py --share

## 列出目前可用的SpeedTest服务器
python speedtest.py --list

## 自定义测试到某个地区/节点的上传/下载速率
python speedtest.py --server 指定节点号

SuperSpeed.sh

Oldking 大佬的脚本,一键测试网络速度!
Github 地址:https://github.com/oooldking/script/blob/master/superspeed.sh
作者介绍链接:https://www.oldking.net/305.html

特点

  • 利用 Speedtest 测试你的国外主机到国内不同省市的速度
  • 集成了 Speedtest 提供的电信,联通,移动线路
  • 一键选择,一键测试

    使用方法

    wget https://raw.githubusercontent.com/oooldking/script/master/superspeed.sh && chmod +x superspeed.sh && ./superspeed.sh

    测试结果展示

    SuperSpeed 测试脚本结果

uping - Ping 值测试

uPing 是一个 24 小时监测 VPS 延迟的工具
Github 地址:https://github.com/FunctionClub/uPing

使用方法

wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/uPing/master/uping.py
python uping.py

回程路由测试

从 Linux(X86/ARM)/Mac/BSD 系统环境下发起 traceroute 请求,附带链路可视化,兼容性更好,支持 JSON 格式
主页链接:https://www.ipip.net/product/client.html#besttrace

使用方法

# 下载
https://cdn.ipip.net/17mon/besttrace4linux.zip
# 解压
unzip besttrace4linux.zip
# 使用
./besttrace -q 目标IP

参考



推荐使用:阿里云 云翼计划学生优惠、ECS、轻量应用等产品与服务【 点击注册

本文作者:Quanyin Tang

本文链接:整理:Linux VPS 速度/网络/性能测试脚本合集 - https://www.imtqy.com/linux-bench.html

版权声明:如无特别声明,本文即为原创文章,仅代表个人观点,版权归 Quanyin 所有,未经允许禁止转载,经授权转载请注明出处!