NVME 在主机上比在虚拟机上慢

NVME 在主机上比在虚拟机上慢

当我从 Vagrant 切换到 Docker 进行本地开发设置时,我第一次注意到一些奇怪的性能影响。

在调查了为什么我的数据库在这个新环境中变慢之后,我得出的结论是 Docker 并不是真正的问题。事实上,我的 NVME SSD(三星 970 EVO Plus)在 Vagrant VM 中似乎比在主机上更快……我不知道为什么。

我在虚拟机和主机上运行了相同的 sysbench fileio 测试。

主持人:

sysbench fileio --file-total-size=40G prepare
42949672960 bytes written in 42.35 seconds (967.12 MiB/sec).

虚拟机:

sysbench fileio --file-total-size=40G prepare
42949672960 bytes written in 26.71 seconds (1533.36 MiB/sec).

然后:

主持人:

sysbench fileio --file-total-size=40G --file-test-mode=rndrw --max-time=20 --max-requests=0 run

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


Extra file open flags: (none)
128 files, 320MiB each
40GiB 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:                      943.15
    writes/s:                     628.73
    fsyncs/s:                     2012.27

Throughput:
    read, MiB/s:                  14.74
    written, MiB/s:               9.82

General statistics:
    total time:                          20.0357s
    total number of events:              71688

Latency (ms):
         min:                                    0.00
         avg:                                    0.28
         max:                                   17.35
         95th percentile:                        1.03
         sum:                                19934.06

Threads fairness:
    events (avg/stddev):           71688.0000/0.00
    execution time (avg/stddev):   19.9341/0.00

虚拟机:

sysbench fileio --file-total-size=40G --file-test-mode=rndrw --max-time=20 --max-requests=0 run

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


Extra file open flags: (none)
128 files, 320MiB each
40GiB 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:                      2173.40
    writes/s:                     1448.94
    fsyncs/s:                     4637.65

Throughput:
    read, MiB/s:                  33.96
    written, MiB/s:               22.64

General statistics:
    total time:                          20.0136s
    total number of events:              165193

Latency (ms):
         min:                                    0.00
         avg:                                    0.12
         max:                                   11.10
         95th percentile:                        0.45
         sum:                                19902.66

Threads fairness:
    events (avg/stddev):           165193.0000/0.00
    execution time (avg/stddev):   19.9027/0.00

有谁知道什么会导致这种行为和/或可以测试什么?

相关内容