戴尔R720服务器(4)虚拟机性能测试

  物理机环境

机型 戴尔R720
系统环境 PVE
CPU E5-2660V2 2.2GHz 双路
内存 1333MHz 单通道
内存 1333MHz 双通道
硬盘 用6块转速1万的2.5寸盘组的RAID5,使用了H310mini阵列卡

  ‍

  测试工具:Sysbench。一个跨平台的基准测试工具,用于评估系统性能,包括CPU、内存、文件系统和数据库性能等。apt install sysbench​安装该工具。

  ‍

  虚拟机1配置

image

  ‍

  对照组1

机型 组装 家用机
系统环境 WSL2 ubuntu
CPU AMD 3600 3.33GHz
内存 3200MHz 双通道
硬盘 PCIE3.0 满速固态

CPU

  虚拟机1

soulio@vm-ubt1:~$ sysbench cpu --cpu-max-prime=20000 run
sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time

Prime numbers limit: 20000

Initializing worker threads...

Threads started!

CPU speed:
events per second: 354.62

General statistics:
total time: 10.0004s
total number of events: 3547

Latency (ms):
min: 2.69
avg: 2.82
max: 6.94
95th percentile: 2.81
sum: 9997.72

Threads fairness:
events (avg/stddev): 3547.0000/0.00
execution time (avg/stddev): 9.9977/0.00

  对照组1

是虚拟机1性能的 2x

~ ❯ sysbench cpu --cpu-max-prime=20000 run
sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time

Prime numbers limit: 20000

Initializing worker threads...

Threads started!

CPU speed:
events per second: 772.42

General statistics:
total time: 10.0002s
total number of events: 7725

Latency (ms):
min: 1.26
avg: 1.29
max: 3.90
95th percentile: 1.32
sum: 9996.58

Threads fairness:
events (avg/stddev): 7725.0000/0.00
execution time (avg/stddev): 9.9966/0.00

内存

  虚拟机1

soulio@vm-ubt1:~$ sysbench memory --memory-block-size=1M --memory-total-size=2G --memory-oper=write run
sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time

Running memory speed test with the following options:
block size: 1024KiB
total size: 2048MiB
operation: write
scope: global

Initializing worker threads...

Threads started!

Total operations: 2048 ( 6334.09 per second)

2048.00 MiB transferred (6334.09 MiB/sec)

General statistics:
total time: 0.3185s
total number of events: 2048

Latency (ms):
min: 0.15
avg: 0.15
max: 0.28
95th percentile: 0.17
sum: 315.02

Threads fairness:
events (avg/stddev): 2048.0000/0.00
execution time (avg/stddev): 0.3150/0.00

  对照组1

吞吐性能是虚拟机1的 4.5x
延迟是虚拟机1的 0.35x

~ ❯ sysbench memory --memory-block-size=1M --memory-total-size=2G --memory-oper=write ru
n
sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time

Running memory speed test with the following options:
block size: 1024KiB
total size: 2048MiB
operation: write
scope: global

Initializing worker threads...

Threads started!

Total operations: 2048 (25949.52 per second)

2048.00 MiB transferred (25949.52 MiB/sec)

General statistics:
total time: 0.0782s
total number of events: 2048

Latency (ms):
min: 0.04
avg: 0.04
max: 0.10
95th percentile: 0.04
sum: 77.58

Threads fairness:
events (avg/stddev): 2048.0000/0.00
execution time (avg/stddev): 0.0776/0.00

  ‍

  增加两条内存,组双通道

470f9d3ad43f38a9b07a6dfb470abbc

c74af8b6714b9fa1659aa0b7529e0a2

image

  接下来测试参数修改为2G、4G、8G、16G、32G (提前给虚拟机分配更大的内存容量)

2048.00 MiB transferred (6328.79 MiB/sec)
Latency (ms):
         min:                                    0.15
         avg:                                    0.15
         max:                                    0.31
         95th percentile:                        0.18
         sum:                                  315.19

4096.00 MiB transferred (6416.13 MiB/sec)
Latency (ms):
min: 0.15
avg: 0.15
max: 0.35
95th percentile: 0.17
sum: 628.68

8192.00 MiB transferred (8163.34 MiB/sec)
Latency (ms):
min: 0.06
avg: 0.12
max: 0.33
95th percentile: 0.17
sum: 994.53

16384.00 MiB transferred (10341.60 MiB/sec)
Latency (ms):
min: 0.06
avg: 0.10
max: 0.31
95th percentile: 0.15
sum: 1572.59

32768.00 MiB transferred (12636.04 MiB/sec)
Latency (ms):
min: 0.06
avg: 0.08
max: 0.41
95th percentile: 0.15
sum: 2577.01

  速度介于1~2x通道之间,不完全的双通道?读者,你知道原因吗?

  ‍

磁盘速度

  测试参数4GB

  ‍

  虚拟机1

soulio@vm-ubt1:~$ time dd if=/dev/zero of=/tmp/testw.dbf bs=4k count=1000000
1000000+0 records in
1000000+0 records out
4096000000 bytes (4.1 GB, 3.8 GiB) copied, 10.0372 s, 408 MB/s

  对照组

~ ❯ time dd if=/dev/zero of=/tmp/testw.dbf bs=4k count=1000000                 
记录了1000000+0 的读入
记录了1000000+0 的写出
4096000000字节(4.1 GB,3.8 GiB)已复制,2.92994 s,1.4 GB/s
dd if=/dev/zero of=/tmp/testw.dbf bs=4k count=1000000  0.14s user 2.77s system 99% cpu 2.939 total

  ‍

  虚拟机常用的磁盘格式有3种

image

  比对不同格式对读写速度的影响

# 测试磁盘写能力
time dd if=/dev/zero of=/data/testw.dbf bs=4k count=1000000

测试磁盘读能力

time dd if=/dev/sda of=/dev/null bs=4k

测试同时读写能力

time dd if=/dev/sda of=/tmp/testrw.dbf bs=4k

  测得数据如下(娱乐测试,请勿较真。)

image

image

image

image

  ‍

PVE不要用vmdk格式,太慢了

vmdk格式写入测试时太慢了,仅进行了一轮,所以5轮填的是同一个数据。vmdk格式写入时有几个问题:

  • 测试文件超过100MB就掉速严重,掉到10MB/s以下。

  • 速度不稳定,连续5轮测试

    
    40960000 bytes (41 MB, 39 MiB) copied, 5.07718 s, 8.1 MB/s
    

    40960000 bytes (41 MB, 39 MiB) copied, 0.485024 s, 84.4 MB/s

    40960000 bytes (41 MB, 39 MiB) copied, 5.12293 s, 8.0 MB/s

    40960000 bytes (41 MB, 39 MiB) copied, 4.8992 s, 8.4 MB/s

    40960000 bytes (41 MB, 39 MiB) copied, 0.48415 s, 84.6 MB/s

  • 上限很低,测试文件大小在4MB的时候测得最高分213 MB/s

    4096000 bytes (4.1 MB, 3.9 MiB) copied, 0.0192291 s, 213 MB/s
    

  ‍

  ‍

  ‍

IO基准测试

  虚拟机1

soulio@vm-ubt1:~$ sysbench fileio --file-test-mode=rndrw --file-total-size=2G --max-time=300 --max-requests=0 run
WARNING: --max-time is deprecated, use --time instead
sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time

Extra file open flags: (none)
128 files, 16MiB each
2GiB total file size
Block size 16KiB
Number of IO requests: 0
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random r/w test
Initializing worker threads...

Threads started!

File operations:
reads/s: 1210.70
writes/s: 807.13
fsyncs/s: 2582.91

Throughput:
read, MiB/s: 18.92
written, MiB/s: 12.61

General statistics:
total time: 300.0214s
total number of events: 1380211

Latency (ms):
min: 0.01
avg: 0.22
max: 266.38
95th percentile: 0.30
sum: 297289.13

Threads fairness:
events (avg/stddev): 1380211.0000/0.00
execution time (avg/stddev): 297.2891/0.00

  对照组1


~ ❯ sysbench fileio --file-test-mode=rndrw --file-total-size=2G --max-time=300 --max-requests=0 run
WARNING: --max-time is deprecated, use --time instead
sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time

Extra file open flags: (none)
128 files, 16MiB each
2GiB total file size
Block size 16KiB
Number of IO requests: 0
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random r/w test
Initializing worker threads...

Threads started!

File operations:
reads/s: 668.20
writes/s: 445.46
fsyncs/s: 1425.69

Throughput:
read, MiB/s: 10.44
written, MiB/s: 6.96

General statistics:
total time: 300.0905s
total number of events: 761909

Latency (ms):
min: 0.00
avg: 0.39
max: 179.17
95th percentile: 0.67
sum: 299653.07

Threads fairness:
events (avg/stddev): 761909.0000/0.00
execution time (avg/stddev): 299.6531/0.00

posted @ 2024-06-06 16:57  soulio  阅读(47)  评论(0编辑  收藏  举报