fio 및 mmap을 ioengine으로 사용하여 NVME 스퀀스 쓰기를 측정할 때 디스크 통계에 많은 읽기 작업이 표시되는 이유는 무엇입니까?

fio 및 mmap을 ioengine으로 사용하여 NVME 스퀀스 쓰기를 측정할 때 디스크 통계에 많은 읽기 작업이 표시되는 이유는 무엇입니까?

내 FIO 구성 및 보고서는 다음과 같습니다.

# cat fio-write.fio 
[global]
name=fio-seq-writes
filename=test
rw=write
bs=1M
direct=0
numjobs=1
[file1]
size=1G
ioengine=mmap
iodepth=1

# fio --version
fio-3.30
# fio fio-write.fio 
file1: (g=0): rw=write, bs=(R) 1024KiB-1024KiB, (W) 1024KiB-1024KiB, (T) 1024KiB-1024KiB, ioengine=mmap, iodepth=1
fio-3.30
Starting 1 process
Jobs: 1 (f=1): [W(1)][-.-%][w=373MiB/s][w=373 IOPS][eta 00m:00s]
file1: (groupid=0, jobs=1): err= 0: pid=421: Sun Nov 14 21:12:09 2021
  write: IOPS=330, BW=330MiB/s (346MB/s)(1024MiB/3102msec); 0 zone resets
    clat (usec): min=2118, max=11668, avg=2598.40, stdev=1333.02
     lat (usec): min=2171, max=11754, avg=2673.15, stdev=1339.15
    clat percentiles (usec):
     |  1.00th=[ 2114],  5.00th=[ 2147], 10.00th=[ 2147], 20.00th=[ 2147],
     | 30.00th=[ 2147], 40.00th=[ 2180], 50.00th=[ 2212], 60.00th=[ 2343],
     | 70.00th=[ 2409], 80.00th=[ 2474], 90.00th=[ 2606], 95.00th=[ 4621],
     | 99.00th=[ 9241], 99.50th=[10945], 99.90th=[11600], 99.95th=[11731],
     | 99.99th=[11731]
   bw (  KiB/s): min=122880, max=385024, per=99.76%, avg=337237.33, stdev=105105.84, samples=6
   iops        : min=  120, max=  376, avg=329.33, stdev=102.64, samples=6
  lat (msec)   : 4=94.14%, 10=4.98%, 20=0.88%
  cpu          : usr=28.25%, sys=61.08%, ctx=253, majf=262144, minf=11
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued rwts: total=0,1024,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
  WRITE: bw=330MiB/s (346MB/s), 330MiB/s-330MiB/s (346MB/s-346MB/s), io=1024MiB (1074MB), run=3102-3102msec

Disk stats (read/write):
  nvme0n1: ios=1908/757, merge=0/0, ticks=1255/3876, in_queue=5130, util=84.41%

보시다시피, 디스크 통계에 따르면 읽기 1908회와 쓰기 757회가 있었습니다(ios는모든 그룹에서 수행된 I/O 수), 이 테스트 케이스는시퀀스 쓰기 전용(구성을 통해rw=쓰기), 내 NVME 문제 1908 판독값이 표시되는 이유는 무엇입니까?

나도 시도했다

  • 순차적 읽기(읽기 전용)
Disk stats (read/write):
  nvme0n1: ios=2026/0, merge=0/0, ticks=630/0, in_queue=631, util=69.47%
  • 무작위 읽기(255234개 읽기, 991개 쓰기)
Disk stats (read/write):
  nvme0n1: ios=255234/991, merge=0/6, ticks=3936/1739, in_queue=5674, util=95.55%
  • 무작위 읽기(259349개 읽기, 2개 쓰기)
Disk stats (read/write):
  nvme0n1: ios=259349/2, merge=0/0, ticks=3453/0, in_queue=3454, util=93.49%

나는 또한 libaio, io_uring 및 psync(fio의 기본 ioengine)와 같은 다른 ioengine을 시도했는데 seq|non-seq 읽기는 읽기 작업만 내보내고 seq|non-seq 쓰기만 쓰기 작업만 내보냅니다. 이는 예상한 대로 mmap만 작동합니다. 이상하게도.

답변1

매뉴얼 에 따르면 mmapmmap이 반환한 메모리 블록은 대상 파일/디스크의 내용으로 초기화됩니다. 따라서 fio-mmap 엔진은 먼저 읽기 요청이 발생한 파일/디스크에서 데이터를 읽습니다.

https://man7.org/linux/man-pages/man2/mmap.2.html

파일 맵의 내용(익명 맵과 반대, 아래 MAP_ANONYMOUS 참조)은 파일 설명자 fd가 참조하는 파일(또는 다른 객체)의 오프셋 offset에서 시작하는 길이 바이트로 초기화됩니다.

관련 정보