hdparm --directでキャッシュ読み取りがディスク読み取りより遅いのはなぜですか?

hdparm --directでキャッシュ読み取りがディスク読み取りより遅いのはなぜですか?

hdparmの結果を解釈しようとしています。

janus@behemoth ~ $ sudo hdparm  -Tt --direct /dev/nvme0n1

/dev/nvme0n1:
 Timing O_DIRECT cached reads:   2548 MB in  2.00 seconds = 1273.69 MB/sec
 Timing O_DIRECT disk reads: 4188 MB in  3.00 seconds = 1395.36 MB/sec

キャッシュされた読み取りが直接ディスクの読み取りよりもどのように遅くなるかはわかりません。 --direct を削除すると、期待した結果が表示されます。つまり、ディスクの読み取りがキャッシュされた読み取りよりも遅くなります。

janus@behemoth ~ $ sudo hdparm  -Tt /dev/nvme0n1

/dev/nvme0n1:
 Timing cached reads:   22064 MB in  2.00 seconds = 11042.86 MB/sec
 Timing buffered disk reads: 2330 MB in  3.00 seconds = 776.06 MB/sec

(これは「バッファ付きディスクの読み取り」と表示されますが)。

誰かが私に何が起こっているのかを説明できますか?

ベストアンサー1

マニュアルhdparmページベース:

--direct

Use the kernel´s "O_DIRECT" flag when  performing  a  -t  timing
test.   This  bypasses  the  page cache, causing the reads to go
directly from the drive into hdparm's buffers,  using  so-called
"raw"  I/O.  In many cases, this can produce results that appear
much faster than the usual page cache method,  giving  a  better
indication of raw device and driver performance.

hdparm -t --directこれはなぜ。hdparm -t--direct-t-T

-T 

Perform timings of cache reads for benchmark and comparison pur‐
poses.   For  meaningful  results,  this  operation  should   be  
repeated  2-3  times  on  an otherwise inactive system (no other
active processes) with at least a couple of  megabytes  of  free
memory.   This  displays  the speed of reading directly from the 
Linux buffer cache without disk  access.   This  measurement  is  
essentially  an  indication  of the throughput of the processor,
cache, and memory of the system under test.

-Tディスクの同じキャッシュ部分を読み取って作業したいです。ところで--directそれを止めました。したがって、論理的-t --directに同じ結果を得る必要があります-T --direct

おすすめ記事