ローカル開発設定のためにVagrantからDockerに切り替えたとき、最初にいくつかの奇妙なパフォーマンス効果が見つかりました。
この新しい環境で私のデータベースが遅くなる理由を調べた後、Dockerは実際には問題ではないと結論付けました。実際に私が使用しているNVME SSD(Samsung 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
この動作の原因および/またはテストできる項目を知っている人はいますか?