Linux服务器/VPS性能和带宽测试脚本汇总

这年头VPS主机太多了,好多“二手”VPS开始横行其道,让人真假莫辨,想要购买某一个VPS主机,一般是先要看看这家的VPS主机的评测数据。

**高性价比和便宜的VPS/云服务器推荐:**[https://blog.zeruns.tech/archives/383.html](https://blog.zeruns.tech/archives/383.html)

**各大厂商云服务器性能评测对比,阿里云、腾讯云、华为云、Ucloud、天翼云:[https://blog.zeruns.tech/archives/670.html](https://blog.zeruns.tech/archives/670.html)**

雨云 13900K 宿迁高防云服务器性能测评,2核4G 5兆 150G防御 仅需75元/月:[https://blog.zeruns.tech/archives/701.html](https://blog.zeruns.tech/archives/701.html)

**下面我汇总了几个比较好用的测试脚本。**

## lemonbench

lemonbench提供比superbench更详细的测试,除了磁盘io和网速测试外,它还提供vps的cpu跑分,内存读写速度,回程路由追踪,流媒体解锁情况等测试,测试完之后还能生成分享链接 [例子](https://paste.ubuntu.com/p/hC3vF5wgjQ/),可以直接在浏览器上查看或是分享给他人。该脚本有两种模式。

使用`curl -fsL https://ilemonra.in/LemonBenchIntl | bash -s fast`进行快速测试,该模式下测试速度较快,但是结果没那么详细,部分测试的次数较少(如磁盘io测试),测速节点较少,路由追踪也不会测那么多个节点。使用`curl -fsL https://ilemonra.in/LemonBenchIntl | bash -s full`进行测试时,会进行更加详细全面的测试,测试次数会更多,使用的节点也更多,当然耗时会更长。

```bash
curl -fsL github.com/LemonBench/LemonBench/raw/main/LemonBench.sh | bash -s – --fast
curl -fsL github.com/LemonBench/LemonBench/raw/main/LemonBench.sh | bash -s – --full

备用:curl -fsL gitee.com/zeruns/Linux-shell/raw/master/LemonBench.sh | bash -s – --full

备用2:curl -fsL tc2.zeruns.tech/other/shell/LemonBench.sh | bash -s – --full

```

![](https://tc.zeruns.tech/images/2021/08/06/0434.png)

## yabs.sh

完整测试

```bash
curl -sL yabs.sh | bash

备用地址

curl -sL https://jsdelivr.zeruns.tech/gh/masonr/yet-another-bench-script@master/yabs.sh | bash
```

参数测试

```bash
## 添加需要的参数
curl -sL yabs.sh | bash -s – -{fdighr49}

例:(仅进行Geekbench 5测试)

curl -sL yabs.sh | bash -s – -fdi
```

可选参数列表

  • * </s>-f<e> 此选项禁用fio测试
  • * `-d` 此选项禁用磁盘性能测试
  • * `-i` 此选项禁用网络性能测试
  • * `-g` 此选项将禁用Geekbench系统性能测试
  • * `-h` 此选项打印包含用法、检测到的标志和本地包(fio/iperf)状态的帮助消息
  • * `-r` 此选项可减少iperf位置的数量(Online.net/Clouvider LON+NYC)以减少带宽使用
  • * `-4` 此选项覆盖geekbench5性能测试,而运行geekbench4测试
  • * `-9` 这个选项除了运行Geekbench 5测试之外,还运行Geekbench 4测试
  • ![](https://tc.zeruns.tech/images/2022/03/26/image2731539ef55ef0e4.png)

    ## Geekbench 5

    Geekbench 5 官方测试脚本

    bash</s><i> </i>wget --no-check-certificate https://img.zeruns.tech/down/Geekbench-5.4.3-Linux.tar.gz &amp;&amp; tar xf Geekbench-5.4.3-Linux.tar.gz &amp;&amp; cd Geekbench-5.4.3-Linux &amp;&amp; ./geekbench_x86_64<i> </i><e>

    ![](https://tc.zeruns.tech/images/2023/02/15/image35693545579f3e6b.png)

    ## Geekbench 6

    Geekbench这几年成为手机以及PC跑分的一大基准测试,可以方便对比安卓与iPhone处理器的性能差距,Geekbench 5版还是2019年发布的,刚刚Primal Labs发布了最新的Geekbench 6,跑分规则大改。

    Geekbench 6增加了对最新硬件的支持,追求的是更有真实意义的性能测试,这次的一大重点改进就是大幅弱化CPU单核跑分的重要性,开发商表示时代不一样了,主核心不再那么重要,而且机器学习正在兴起,多核性能变得更加重要。

    Geekbench 6 官方测试脚本

    ```bash
    wget --no-check-certificate https://img.zeruns.tech/down/Geekbench-6.2.1-Linux.tar.gz && tar xf Geekbench-6.2.1-Linux.tar.gz && cd Geekbench-6.2.1-Linux && ./geekbench_x86_64

    #备用下载地址
    wget --no-check-certificate https://cn-sy1.rains3.com/rainyun-assets/Pic/2023/11/Geekbench-6.2.1-Linux.tar_d719c196804f09e318c0ff436a66f31f.gz && tar xf Geekbench-6.2.1-Linux.tar_d719c196804f09e318c0ff436a66f31f.gz && cd Geekbench-6.2.1-Linux && ./geekbench_x86_64
    ```

    ARM版:

    shell</s><i> </i>wget https://img.zeruns.tech/down/Geekbench-6.1.0-LinuxARMPreview.tar.gz &amp;&amp; tar xf Geekbench-6.1.0-LinuxARMPreview.tar.gz &amp;&amp; cd Geekbench-6.1.0-LinuxARMPreview &amp;&amp; ./geekbench_aarch64<i> </i><e>

    ![](https://tc.zeruns.tech/images/2023/02/15/image.png)

    ## 流媒体解锁

    **全流媒体解锁测试**

    bahs</s><i> </i>bash &lt;(curl -L -s https://raw.githubusercontent.com/lmc999/RegionRestrictionCheck/main/check.sh)<i> </i><e>

    ![](https://tc.zeruns.tech/images/2022/03/26/image70202202b51cdab8.png)

    ## 综合工具箱

    </s><i> </i>wget -O box.sh https://raw.githubusercontent.com/BlueSkyXN/SKY-BOX/main/box.sh &amp;&amp; chmod +x box.sh &amp;&amp; clear &amp;&amp; ./box.sh<i> </i><e>

    ![](https://tc.zeruns.tech/images/2022/03/26/image1a6160aafa530c58.png)

    ## Superspeed.sh

    **一键测试服务器到国内的速度脚本Superspeed.sh :**

    shell</s><i> </i>bash &lt;(curl -Lso- https://raw.githubusercontent.com/BlueSkyXN/SpeedTestCN/main/superspeed.sh)<i> </i><e>

    ![](https://tc.zeruns.tech/images/2020/05/19/Superspeed.png)

    ## SuperBench.sh

    **一键检测VPS的CPU、内存、负载、IO读写、机房带宽和服务器类型等脚本SuperBench.sh:**

    shell</s><i> </i>wget -N --no-check-certificate https://raw.githubusercontent.com/oooldking/script/master/superbench.sh sudo bash superbench.sh #或者 curl -Lso- https://raw.githubusercontent.com/oooldking/script/master/superbench.sh | bash<i> </i><e>

    ![](https://tc.zeruns.tech/images/2020/05/19/SuperBench.png)

    ## Zench

    **Zench可以看作是Bench.sh 和 SuperBench的结合版本,加入 Ping 以及 路由测试 功能,会生成测评报告,可以很方便地分享给其他朋友看自己的测评数据 :**

    sh</s><i> </i>wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/ZBench/master/ZBench-CN.sh sudo bash ZBench-CN.sh #项目:https://github.com/FunctionClub/ZBench<i> </i><e>

    ![](https://tc.zeruns.tech/images/2020/05/19/Zench.png)

    ## speedtest-cli

    **一键带宽检测工具:speedtest-cli**

    **安装命令:**

    ```shell
    sudo apt-get update
    apt-get install python-pip
    sudo pip install speedtest-cli

    #CentOS
    yum update
    yum -y install epel-release
    yum install python-pip
    pip install speedtest-cli
    ```

    **使用方法:**

    shell</s><i> </i>speedtest-cli #后面也可以接以下参数: -h, --help show this help message and exit --share 分享你的网速,该命令会在speedtest网站上生成网速测试结果的图片。 --simple Suppress verbose output, only show basic information --list 根据距离显示speedtest.net的测试服务器列表。 --server=SERVER 指定列表中id的服务器来做测试。 --mini=MINI URL of the Speedtest Mini server --source=SOURCE Source ip address to bind to --version Show the version number and exit<i> </i><e>

    ## unixbench

    **VPS性能综合跑分工具unixbench:**
    Unixbench的主要测试项目有:系统调用、读写、进程、图形化测试、2D、3D、管道、运算、C库等系统基准性能提供测试数据。最新版本`UnixBench5.1.3`,包含`system和graphic`测试,如果你需要测试graphic,则需要修改Makefile。
    不要注释掉` GRAPHIC_TESTS = defined` ,同时需要系统提供` x11perf` 命令gl_glibs库。本文脚本注释了关于`graphic`的测试项(大多数VPS都是没有显卡或者是集显,所以图像性能无需测试),运行10-30分钟后(根据CPU内核数量,运算时间不等)得出分数,越高越好。

    **UnixBench性能跑分受版本影响较大。** UnixBench目前有不同的版本,而网上不少的版本也是经过人工修改过的,可能测试的项目不同导致的结果也会不同。大家在测试时记得找一个参照对比。

    ```shell
    yum -y install wget screen #for CentOS/Redhat

    apt-get -y install wget screen #for Debian/Ubuntu

    screen -S zeruns #如果网路出现中断,可以执行命令screen -R zeruns重新连接测试窗口
    wget --no-check-certificate https://jsdelivr.zeruns.tech/gh/teddysun/across@master/unixbench.sh && chmod +x unixbench.sh && ./unixbench.sh

    备用脚本

    wget --no-check-certificate https://gitee.com/zeruns/Linux-shell/raw/master/unixbench.sh && chmod +x unixbench.sh && ./unixbench.sh
    ```

    ARM版:

    ```shell
    # 下载源码
    git clone https://github.com/kdlucas/byte-unixbench.git

    安装依赖

    sudo apt install -y make gcc

    进入目录

    cd byte-unixbench/UnixBench

    编译

    make

    编译完成后,需要给 执行程序赋予执行权限

    sudo chmod u+x ./Run

    Ps:除了 Run 程序测试多核的时候,需要执行其他脚本

    为了避免报错,最好把 UnixBench 目录下脚本都赋予执行权限

    sudo chmod u+x -R ./*

    开始测试

    sudo ./Run
    ```

    各测试项目详细说明:

    ```shell
    # Dhrystone 2 using register variables
    此项用于测试 string handling,因为没有浮点操作,所以深受软件和硬件设计(hardware and software design)、编译和链接(compiler and linker options)、代码优化(code optimazaton)、对内存的cache(cache memory)、等待状态(wait states)、整数数据类型(integer data types)的影响。

    Double-Precision Whetstone

    这一项测试浮点数操作的速度和效率。这一测试包括几个模块,每个模块都包括一组用于科学计算的操作。覆盖面很广的一系列 c 函数:sin,cos,sqrt,exp,log 被用于整数和浮点数的数学运算、数组访问、条件分支(conditional branch)和程序调用。此测试同时测试了整数和浮点数算术运算。

    Execl Throughput

    此测试考察每秒钟可以执行的 execl 系统调用的次数。 execl 系统调用是 exec 函数族的一员。它和其他一些与之相似的命令一样是 execve() 函数的前端。

    File copy

    测试从一个文件向另外一个文件传输数据的速率。每次测试使用不同大小的缓冲区。这一针对文件 read、write、copy 操作的测试统计规定时间(默认是 10s)内的文件 read、write、copy 操作次数。

    Pipe Throughput

    管道(pipe)是进程间交流的最简单方式,这里的 Pipe throughtput 指的是一秒钟内一个进程可以向一个管道写 512 字节数据然后再读回的次数。需要注意的是,pipe throughtput 在实际编程中没有对应的真实存在。

    Pipe-based Context Switching

    这个测试两个进程(每秒钟)通过一个管道交换一个不断增长的整数的次数。这一点很向现实编程中的一些应用,这个测试程序首先创建一个子进程,再和这个子进程进行双向的管道传输。

    Process Creation

    测试每秒钟一个进程可以创建子进程然后收回子进程的次数(子进程一定立即退出)。process creation 的关注点是新进程进程控制块(process control block)的创建和内存分配,即一针见血地关注内存带宽。一般说来,这个测试被用于对操作系统进程创建这一系统调用的不同实现的比较。

    System Call Overhead

    测试进入和离开操作系统内核的代价,即一次系统调用的代价。它利用一个反复地调用 getpid 函数的小程序达到此目的。

    Shell Scripts

    测试一秒钟内一个进程可以并发地开始一个 shell 脚本的 n 个拷贝的次数,n 一般取值 1,2,4,8。(我在测试时取 1, 8)。这个脚本对一个数据文件进行一系列的变形操作(transformation)。
    ```

    ![](https://tc.zeruns.tech/images/2020/05/19/unixbench.png)

    ## Serverreview

    **Serverreview-benchmark综合评测工具**

    这是一个老外写的VPS主机综合评测工具,主要评测的项目有VPS主机磁盘IO、内存读写、CPU性能以及Benchmark性能,还有美国、欧洲、亚洲等不同节点的下载速度。主页:https://github.com/sayem314/serverreview-benchmark

    **脚本使用使用方法:**

    </s><i> </i>yum install curl -y curl -LsO https://raw.githubusercontent.com/sayem314/serverreview-benchmark/master/bench.sh; chmod +x bench.sh &amp;&amp; ./bench.sh -a share<i> </i><e>

    ![](https://tc.zeruns.tech/images/2020/05/19/Serverreview.png)

    ## mPing

    **一键测试回程Ping值工具:mPing**

    </s><i> </i>wget https://raw.githubusercontent.com/helloxz/mping/master/mping.sh bash mping.sh<i> </i><e>

    参数说明:

    </s><i> </i>x% packet loss: 丢包率 min: 最低延迟 avg: 平均延迟 max: 最高延迟 mdev: 平均偏差<i> </i><e>

    ![](https://tc.zeruns.tech/images/2020/05/19/mPing.png)

    ## phoronix-test-suite

    phoronix-test-suite是目前Linux下比较常用的性能测试软件。

    使用phoronix-test-suite条件前提:需要安装php5,需要PHP都DOM扩展

    bash</s><i> </i>wget http://www.phoronix.net/downloads/phoronix-test-suite/releases/phoronix-test-suite-7.4.0.tar.gz &amp;&amp; tar -xzvf phoronix-test-suite-7.4.0.tar.gz &amp;&amp; cd phoronix-test-suite/ &amp;&amp; ./install-sh yum install php-cli php-xml phoronix-test-suite benchmark smallpt<i> </i><e>

    自己的结果图

    单位:Seconds (数值越小越好)

    ![](https://tc.zeruns.tech/images/2022/06/09/image.png)

    ## 推荐阅读

  • - 搭建内网穿透服务器,带Web面板:https://blog.zeruns.tech/archives/660.html
  • - 使用Cloudreve自建网盘:https://blog.zeruns.tech/archives/515.html
  • - 怎样搭建个人博客:https://blog.zeruns.tech/archives/218.html
  • - 学生优惠权益大全:[https://blog.zeruns.tech/archives/557.html](https://blog.zeruns.tech/archives/557.html)
  • - 使用iperf3测试局域网或wifi实际最大带宽:[https://blog.zeruns.tech/archives/514.html](https://blog.zeruns.tech/archives/514.html)
  • - 我的世界服务器搭建(开服)教程:[https://blog.zeruns.tech/tag/mc/](https://blog.zeruns.tech/tag/mc/)
  • 大佬的帖子质量都很不错,支持一下。博客可以提供到NL的酷站,可以增加曝光率。

    感谢分享, 你博客的主题感觉很多人用,挺好