使用 Phoronix Test Suite 测试 Ubuntu 服务器性能

为后续比较不同框架的性能,需要先测试服务器的性能。本文介绍如何使用 Phoronix Test Suite 测试 Ubuntu 服务器性能。

1. 安装 Phoronix Test Suite

https://phoronix-test-suite.com/?k=downloads 获得最新的测试套件下载地址,使用以下命令进行下载:

1
wget https://phoronix-test-suite.com/releases/repo/pts.debian/files/phoronix-test-suite_10.8.4_all.deb

输入以下命令安装 Phoronix Test Suite:

1
sudo dpkg -i phoronix*.deb

安装会因为仍有未满足的依赖而出错。您可以使用单个命令修复该错误并完成安装。

1
sudo apt-get install -f

一旦满足所有依赖关系,安装将完成。您可以使用以下方法验证安装:

1
phoronix-test-suite

2. 安装测试套件

Phoronix Test Suite 提供了很多测试套件,可以使用以下命令查看可用的测试套件:

1
phoronix-test-suite list-available-tests

现在,可以使用以下命令安装测试套件:

1
phoronix-test-suite install pts/processor pts/memory pts/disk pts/network

这将下载和安装四个测试套件:CPU、内存、磁盘和网络。

3. 运行测试

在终端中输入以下命令运行测试:

1
phoronix-test-suite run pts/processor pts/memory pts/disk pts/network

此命令将运行所有四个测试套件。

测试过程中,Phoronix Test Suite 会向您询问是否允许上传测试结果。如果您允许,测试结果将会被 Phoronix Test Suite 上传到公共数据库中,用于供他人参考。如果您不希望上传测试结果,可以选择 No。

测试完成后,您可以在终端中查看测试结果。例如,查看 CPU 测试结果可以输入以下命令:

1
phoronix-test-suite show-result pts/processor

这将列出最近一次 CPU 测试的详细结果,包括测试运行时间、测试得分等信息。

Phoronix Test Suite 还有许多其他功能和测试套件,可以使用以下命令查看:

1
phoronix-test-suite --help

上述是使用 Phoronix Test Suite 测试 Ubuntu 服务器性能的详细步骤。

4. 系统概览

4.1 操作系统

1
2
~$ uname -a
Linux server-04 5.15.0-67-generic #74~20.04.1-Ubuntu SMP Wed Feb 22 14:52:34 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

4.2 CPU

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
~$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 45 bits physical, 48 bits virtual
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 4
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 142
Model name: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Stepping: 10
CPU MHz: 1991.999
BogoMIPS: 3983.99
Hypervisor vendor: VMware
Virtualization type: full
L1d cache: 128 KiB
L1i cache: 128 KiB
L2 cache: 1 MiB
L3 cache: 32 MiB
NUMA node0 CPU(s): 0-3
Vulnerability Itlb multihit: KVM: Mitigation: VMX unsupported
Vulnerability L1tf: Mitigation; PTE Inversion
Vulnerability Mds: Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Mmio stale data: Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
Vulnerability Retbleed: Mitigation; IBRS
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds: Unknown: Dependent on hypervisor status
Vulnerability Tsx async abort: Not affected
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1
gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc cpuid tsc_known_freq pni pclmulqdq sss
e3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm ab
m 3dnowprefetch invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid rdseed adx sm
ap clflushopt xsaveopt xsavec xgetbv1 xsaves arat flush_l1d arch_capabilities

4.3 内存

1
2
3
4
~$ free -m
total used free shared buff/cache available
Mem: 7915 1242 5421 7 1252 6424
Swap: 2047 0 2047

4.4 硬盘

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 4K 1 loop /snap/bare/5
loop1 7:1 0 55.6M 1 loop /snap/core18/2708
loop2 7:2 0 55.6M 1 loop /snap/core18/2714
loop3 7:3 0 63.3M 1 loop /snap/core20/1828
loop4 7:4 0 63.3M 1 loop /snap/core20/1852
loop5 7:5 0 219M 1 loop /snap/gnome-3-34-1804/66
loop6 7:6 0 219M 1 loop /snap/gnome-3-34-1804/77
loop7 7:7 0 346.3M 1 loop /snap/gnome-3-38-2004/119
loop8 7:8 0 64.8M 1 loop /snap/gtk-common-themes/1514
loop9 7:9 0 51M 1 loop /snap/snap-store/518
loop10 7:10 0 49.9M 1 loop /snap/snapd/18357
loop11 7:11 0 49.9M 1 loop /snap/snapd/18596
loop12 7:12 0 46M 1 loop /snap/snap-store/638
loop13 7:13 0 91.7M 1 loop /snap/gtk-common-themes/1535
sda 8:0 0 60G 0 disk
├─sda1 8:1 0 512M 0 part /boot/efi
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 59.5G 0 part /
sr0 11:0 1 1024M 0 rom

4.5 网卡

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
ifconfig -a
br-5f529d0d41b2: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.19.0.1 netmask 255.255.0.0 broadcast 172.19.255.255
ether 02:42:1f:6f:e3:cc txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
inet6 fe80::42:f8ff:fe54:ea0d prefixlen 64 scopeid 0x20<link>
ether 02:42:f8:54:ea:0d txqueuelen 0 (Ethernet)
RX packets 12 bytes 1593 (1.5 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 69 bytes 11349 (11.3 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.214 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::1dae:479:19cc:70ea prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:5b:dd:6e txqueuelen 1000 (Ethernet)
RX packets 3674 bytes 561073 (561.0 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2444 bytes 519957 (519.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 158 bytes 16724 (16.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 158 bytes 16724 (16.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

veth51a998d: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::7400:78ff:fe06:f959 prefixlen 64 scopeid 0x20<link>
ether 76:00:78:06:f9:59 txqueuelen 0 (Ethernet)
RX packets 12 bytes 1761 (1.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 111 bytes 15961 (15.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
~$ sudo ethtool ens33
Settings for ens33:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
MDI-X: off (auto)
Supports Wake-on: d
Wake-on: d
Current message level: 0x00000007 (7)
drv probe link
Link detected: yes

5. 系统性能

5.1 CPU 和内存的结果

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
$ phoronix-test-suite benchmark sysbench
Sysbench 1.0.20:
pts/sysbench-1.1.0 [Test: RAM / Memory]
Test 1 of 2
Estimated Trial Run Count: 3
Estimated Test Run-Time: 1 Minute
Estimated Time To Completion: 2 Minutes [05:58 CDT]
Started Run 1 @ 05:57:50
Started Run 2 @ 05:58:04
Started Run 3 @ 05:58:18

Test: RAM / Memory:
9888.62
10091.24
10124.62

Average: 10034.83 MiB/sec
Deviation: 1.27%

Comparison of 727 OpenBenchmarking.org samples since 13 March 2021; median result: 6516 MiB/sec. Box plot of samples:
......
This Result (69th Percentile): 10035 ^
......

Sysbench 1.0.20:
pts/sysbench-1.1.0 [Test: CPU]
Test 2 of 2
Estimated Trial Run Count: 3
Estimated Time To Completion: 1 Minute [05:59 CDT]
Started Run 1 @ 05:58:39
Started Run 2 @ 06:00:13
Started Run 3 @ 06:01:47
Started Run 4 @ 06:03:21 *
Started Run 5 @ 06:04:55 *
Started Run 6 @ 06:06:29 *
Started Run 7 @ 06:08:03 *
Started Run 8 @ 06:09:37 *
Started Run 9 @ 06:11:11 *
Started Run 10 @ 06:12:45 *

Test: CPU:
4196.65
3900.47
4089.39
4047.88
3886.9
3927.44
4044.44
3966.36
3956.51
3947.3

Average: 3996.33 Events Per Second
Deviation: 2.43%
Samples: 10

Comparison of 3,029 OpenBenchmarking.org samples since 26 February 2011; median result: 16345 Events Per Second. Box plot of samples:
......
This Result (20th Percentile): 3996
......

CPU 平均每秒 3996.33 个事件,一个事件表示一次素数计算。

5.2 网络

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
Sockperf 3.4:
pts/sockperf-1.0.0 [Test: Throughput]
Test 1 of 22
Estimated Trial Run Count: 5
Estimated Test Run-Time: 3 Minutes
Estimated Time To Completion: 1 Hour, 47 Minutes [08:42 CDT]
Started Run 1 @ 06:55:37
Started Run 2 @ 06:55:49
Started Run 3 @ 06:56:02
Started Run 4 @ 06:56:14
Started Run 5 @ 06:56:26
Started Run 6 @ 06:56:38 *
Started Run 7 @ 06:56:51 *
Started Run 8 @ 06:57:03 *
Started Run 9 @ 06:57:15 *
Started Run 10 @ 06:57:27 *
Started Run 11 @ 06:57:40 *
Started Run 12 @ 06:57:52 *
Started Run 13 @ 06:58:04 *
Started Run 14 @ 06:58:16 *
Started Run 15 @ 06:58:28 *
Started Run 16 @ 06:58:41 *
Started Run 17 @ 06:58:53 *
Started Run 18 @ 06:59:05 *
Started Run 19 @ 06:59:17 *
Started Run 20 @ 06:59:30 *
Started Run 21 @ 06:59:42 *
Started Run 22 @ 06:59:54 *
Started Run 23 @ 07:00:06 *
Started Run 24 @ 07:00:18 *
Started Run 25 @ 07:00:31 *

Test: Throughput:
227944
225671
232951
230071
199100
229712
230344
226415
233096
227568
213177
231401
227420
234678
230548
228402
224917
227756
224804
222024
232606
231657
232363
226476
228106

Average: 227168 Messages Per Second
Deviation: 3.22%
Samples: 25

Comparison of 1,431 OpenBenchmarking.org samples since 28 May 2018 to 7 February; median result: 456890 Messages Per Second. Box plot of samples:
...
This Result (13th Percentile): 227168
...

Sockperf 3.4:
pts/sockperf-1.0.0 [Test: Latency Ping Pong]
Test 2 of 22
Estimated Trial Run Count: 5
Estimated Test Run-Time: 1 Minute
Estimated Time To Completion: 1 Hour, 42 Minutes [08:42 CDT]
Started Run 1 @ 07:00:50
Started Run 2 @ 07:01:03
Started Run 3 @ 07:01:15
Started Run 4 @ 07:01:27
Started Run 5 @ 07:01:39

Test: Latency Ping Pong:
62.401
61.115
60.166
60.756
61.167

Average: 61.121 usec
Deviation: 1.34%

Sockperf 3.4:
pts/sockperf-1.0.0 [Test: Latency Under Load]
Test 3 of 22
Estimated Trial Run Count: 5
Estimated Test Run-Time: 1 Minute
Estimated Time To Completion: 1 Hour, 41 Minutes [08:42 CDT]
Started Run 1 @ 07:01:59
Started Run 2 @ 07:02:11
Started Run 3 @ 07:02:24
Started Run 4 @ 07:02:36
Started Run 5 @ 07:02:48
Started Run 6 @ 07:03:00 *
Started Run 7 @ 07:03:13 *
Started Run 8 @ 07:03:25 *
Started Run 9 @ 07:03:37 *
Started Run 10 @ 07:03:49 *
Started Run 11 @ 07:04:01 *
Started Run 12 @ 07:04:14 *
Started Run 13 @ 07:04:26 *
Started Run 14 @ 07:04:38 *
Started Run 15 @ 07:04:50 *
Started Run 16 @ 07:05:03 *
Started Run 17 @ 07:05:15 *
Started Run 18 @ 07:05:27 *
Started Run 19 @ 07:05:39 *
Started Run 20 @ 07:05:51 *
Started Run 21 @ 07:06:04 *
Started Run 22 @ 07:06:16 *
Started Run 23 @ 07:06:28 *
Started Run 24 @ 07:06:40 *
Started Run 25 @ 07:06:53 *

Test: Latency Under Load:
94.746
88.905
76.142
37.347
93.27
85.226
92.988
76.168
84.966
88.915
72.696
78.155
80.286
97.476
97.139
95.452
94.246
92.828
75.874
77.592
76.948
166.122
37.302
36.762
75.223

Average: 82.911 usec
Deviation: 29.99%
Samples: 25

Comparison of 755 OpenBenchmarking.org samples since 28 May 2018 to 7 February; median result: 21.23 usec. Box plot of samples:
...
This Result (5th Percentile): 82.911 ^
...

参考