站长视角
用户至上

UnixBench:Linux VPS 服务器性能测试跑分脚本

前些天给 Vultr 独立服务器测评的时候,跑了个分。本文记录一下 Linux VPS/服务器上面使用 UnixBench 脚本进行跑分的方法。UnixBench 是一个类 Unix 系统(Unix,BSD,Linux)下的开源性能测试工具,被广泛用与测试 Linux 系统主机的性能。Unixbench 的主要测试项目有:系统调用、读写、进程、图形化测试、2D、3D、管道、运算、C 库等系统基准性能提供测试数据。

一、UnixBench 测试方法

下面是 UnixBench 测试方法。

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

登录 VPS 之后,输入上面的脚本回车即可开始测试。

二、UnixBench 测试项目

UnixBench 主要测试以下几个方面内容:

  • 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)。

三、UnixBench 测试结果

下面是测试结果,测试所需时间根据 VPS 或者服务器的性能来定,一般都需要几十分钟甚至几小时。


测试结果

------------------------------------------------------------------------
Benchmark Run: Fri Aug 27 2021 17:01:23 - 17:31:30
12 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables       59512547.5 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     3576.0 MWIPS (22.8 s, 7 samples)
Execl Throughput                               7231.9 lps   (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        954325.4 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          245327.4 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       3000341.8 KBps  (30.0 s, 2 samples)
Pipe Throughput                             1213213.9 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 240467.1 lps   (10.0 s, 7 samples)
Process Creation                               4562.0 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   5309.2 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   6129.9 lpm   (60.0 s, 2 samples)
System Call Overhead                         704252.9 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   59512547.5   5099.6
Double-Precision Whetstone                       55.0       3576.0    650.2
Execl Throughput                                 43.0       7231.9   1681.8
File Copy 1024 bufsize 2000 maxblocks          3960.0     954325.4   2409.9
File Copy 256 bufsize 500 maxblocks            1655.0     245327.4   1482.3
File Copy 4096 bufsize 8000 maxblocks          5800.0    3000341.8   5173.0
Pipe Throughput                               12440.0    1213213.9    975.3
Pipe-based Context Switching                   4000.0     240467.1    601.2
Process Creation                                126.0       4562.0    362.1
Shell Scripts (1 concurrent)                     42.4       5309.2   1252.2
Shell Scripts (8 concurrent)                      6.0       6129.9  10216.5
System Call Overhead                          15000.0     704252.9    469.5
                                                                   ========
System Benchmarks Index Score                                        1501.6

------------------------------------------------------------------------
Benchmark Run: Fri Aug 27 2021 17:31:30 - 18:02:41
12 CPUs in system; running 12 parallel copies of tests

Dhrystone 2 using register variables      470686849.9 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                    27849.1 MWIPS (28.9 s, 7 samples)
Execl Throughput                              45443.6 lps   (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks       1588980.8 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          407350.8 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       5108651.3 KBps  (30.0 s, 2 samples)
Pipe Throughput                             8837617.4 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                2219301.3 lps   (10.0 s, 7 samples)
Process Creation                             105829.4 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                  83352.6 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                  11942.7 lpm   (60.0 s, 2 samples)
System Call Overhead                        4846808.4 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0  470686849.9  40333.1
Double-Precision Whetstone                       55.0      27849.1   5063.5
Execl Throughput                                 43.0      45443.6  10568.3
File Copy 1024 bufsize 2000 maxblocks          3960.0    1588980.8   4012.6
File Copy 256 bufsize 500 maxblocks            1655.0     407350.8   2461.3
File Copy 4096 bufsize 8000 maxblocks          5800.0    5108651.3   8808.0
Pipe Throughput                               12440.0    8837617.4   7104.2
Pipe-based Context Switching                   4000.0    2219301.3   5548.3
Process Creation                                126.0     105829.4   8399.2
Shell Scripts (1 concurrent)                     42.4      83352.6  19658.6
Shell Scripts (8 concurrent)                      6.0      11942.7  19904.5
System Call Overhead                          15000.0    4846808.4   3231.2
                                                                   ========
System Benchmarks Index Score                                        8090.0

======= Script description and score comparison completed! =======
赞(0)
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权, 转载请注明出处。
文章名称:《UnixBench:Linux VPS 服务器性能测试跑分脚本》
文章链接:https://www.veidc.com/19308.html
【声明】:国外主机测评仅分享信息,不参与任何交易,也非中介,所有内容仅代表个人观点,均不作直接、间接、法定、约定的保证,读者购买风险自担。一旦您访问国外主机测评,即表示您已经知晓并接受了此声明通告。
【关于安全】:任何 IDC商家都有倒闭和跑路的可能,备份永远是最佳选择,服务器也是机器,不勤备份是对自己极不负责的表现,请保持良好的备份习惯。