louwrentius / fio-plot

Create charts from FIO storage benchmark tool output
BSD 3-Clause "New" or "Revised" License
370 stars 87 forks source link

/dev/disk/by-id/ symlink doesn't work with bench-fio #136

Closed nobuto-m closed 9 months ago

nobuto-m commented 9 months ago

The experience of using this tool is amazing so far to me. And I have a nit-picking feedback as follows.

When running fio against a block device I personally prefer /dev/disk/by-id symbolic links over the default sda type of names.

e.g. /dev/disk/by-id/usb-JetFlash_Transcend_32GB_AAOJK4FQJKH0JUP9-0:0 to make sure I'm running a destructive benchmark against a USB drive instead of an internal SSD.

However, it fails with bench-fio with the following error.

bench-fio \
    --type device \
    --target /dev/disk/by-id/usb-JetFlash_Transcend_32GB_AAOJK4FQJKH0JUP9-0\:0 \
    --entire-device \
    --iodepth 1 --numjobs 1 \
    --mode write -b 4M \
    --output output/usb-JetFlash_Transcend_32GB_AAOJK4FQJKH0JUP9-0\:0 \
    --destructive

                                              Bench-fio                                              
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Setting                        ┃ value                                                            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ Estimated Duration             │                                                                  │
│ Number of benchmarks           │ 1                                                                │
│ Test target(s)                 │ /dev/disk/by-id/usb-JetFlash_Transcend_32GB_AAOJK4FQJKH0JUP9-0:0 │
│ Target type                    │ device                                                           │
│ I/O Engine                     │ libaio                                                           │
│ Test mode (read/write)         │ write                                                            │
│ Specified test data size       │ 100%                                                             │
│ Block size                     │ 4M                                                               │
│ IOdepth to be tested           │ 1                                                                │
│ NumJobs to be tested           │ 1                                                                │
│ Benchmark loops                │ 1                                                                │
│ Direct I/O                     │ 1                                                                │
│ Output folder                  │ output/usb-JetFlash_Transcend_32GB_AAOJK4FQJKH0JUP9-0:0          │
│ Benchmark entire device        │ True                                                             │
│ Log interval of perf data (ms) │ 1000                                                             │
│ Invalidate buffer cache        │ 1                                                                │
│ Allow destructive writes       │ True                                                             │
│ Check remote timeout (s)       │ 2                                                                │
└────────────────────────────────┴──────────────────────────────────────────────────────────────────┘

An error occurred: stderr: FIOJOB: you need to specify size=
fio: pid=0, err=22/file:filesetup.c:1144, func=total_file_size, error=Invalid argument - stdout:  - returncode: 1 

FIOJOB: you need to specify size=
fio: pid=0, err=22/file:filesetup.c:1144, func=total_file_size, error=Invalid argument
{
  "fio version" : "fio-3.36",
  "timestamp" : 1706974044,
  "timestamp_ms" : 1706974044724,
  "time" : "Sun Feb  4 00:27:24 2024",
  "jobs" : [
    {
      "jobname" : "FIOJOB",
      "groupid" : 0,
      "job_start" : 0,
      "error" : 22,
      "eta" : 2147483647,
      "elapsed" : 0,
      "job options" : {
        "ioengine" : "libaio",
        "rw" : "write",
        "size" : "100%%",
        "bs" : "4M",
        "iodepth" : "1",
        "numjobs" : "1",
        "loops" : "1",
        "direct" : "1",
        "log_avg_msec" : "1000",
        "invalidate" : "1",
        "write_bw_log" : "output/usb-JetFlash_Transcend_32GB_AAOJK4FQJKH0JUP9-0:0/usb-JetFlash_Transcend_32GB_AAOJK4FQJKH0JUP9-0:0/4M/write-iodepth-1-numjobs-1",
        "write_lat_log" : "output/usb-JetFlash_Transcend_32GB_AAOJK4FQJKH0JUP9-0:0/usb-JetFlash_Transcend_32GB_AAOJK4FQJKH0JUP9-0:0/4M/write-iodepth-1-numjobs-1",
        "write_iops_log" : "output/usb-JetFlash_Transcend_32GB_AAOJK4FQJKH0JUP9-0:0/usb-JetFlash_Transcend_32GB_AAOJK4FQJKH0JUP9-0:0/4M/write-iodepth-1-numjobs-1",
        "filename" : "/dev/disk/by-id/usb-JetFlash_Transcend_32GB_AAOJK4FQJKH0JUP9-0:0"
      },

...

Fwiw, when writing a fio config by hand, if the colon in the symlinkn path is escaped, it works.

$ cat /tmp/symlink-tmpjobfile.fio
[FIOJOB]
filename=/dev/disk/by-id/usb-JetFlash_Transcend_32GB_AAOJK4FQJKH0JUP9-0\:0
ioengine=libaio
rw=write
size=100%%
bs=4M
iodepth=1
numjobs=1
loops=1
direct=1
log_avg_msec=1000
invalidate=1

$ sudo timeout 5 fio /tmp/symlink-tmpjobfile.fio
FIOJOB: (g=0): rw=write, bs=(R) 4096KiB-4096KiB, (W) 4096KiB-4096KiB, (T) 4096KiB-4096KiB, ioengine=libaio, iodepth=1
fio-3.36
Starting 1 process
Jobs: 1 (f=1): [W(1)][0.5%][w=24.0MiB/s][w=6 IOPS][eta 14m:08s] 
fio: terminating on signal 15
Jobs: 1 (f=1): [W(1)][0.5%][eta 21m:13s]                       
FIOJOB: (groupid=0, jobs=1): err= 0: pid=426960: Sun Feb  4 00:31:57 2024
  write: IOPS=5, BW=22.7MiB/s (23.8MB/s)(144MiB/6339msec); 0 zone resets
    slat (msec): min=45, max=2887, avg=127.91, stdev=473.13
    clat (usec): min=45057, max=52334, avg=48138.07, stdev=2263.36
     lat (msec): min=91, max=2936, avg=176.05, stdev=473.22
    clat percentiles (usec):
     |  1.00th=[44827],  5.00th=[45351], 10.00th=[45351], 20.00th=[46400],
     | 30.00th=[46400], 40.00th=[46924], 50.00th=[47449], 60.00th=[48497],
     | 70.00th=[49546], 80.00th=[50070], 90.00th=[51119], 95.00th=[52167],
     | 99.00th=[52167], 99.50th=[52167], 99.90th=[52167], 99.95th=[52167],
     | 99.99th=[52167]
   bw (  KiB/s): min=40878, max=40960, per=100.00%, avg=40936.57, stdev=40.01, samples=7
   iops        : min=    9, max=   10, avg= 9.71, stdev= 0.49, samples=7
  lat (msec)   : 50=72.22%, 100=27.78%
  cpu          : usr=0.09%, sys=0.30%, ctx=111, majf=0, 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,36,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=22.7MiB/s (23.8MB/s), 22.7MiB/s-22.7MiB/s (23.8MB/s-23.8MB/s), io=144MiB (151MB), run=6339-6339msec
louwrentius commented 9 months ago

Thanks for your feedback and solution! I'll incorporate it in a new release

TjerkNan commented 9 months ago

Thanks for the pr! I have to find some time to test it myself.