Fio: Difference between revisions

From Leo's Notes
This page was last edited on 2 August 2022, at 18:32.
Created page with "The flexible IO (fio) utility can be used to quickly benchmark the filesystem IO performance. == Quick start == Select one of the following commands to run. {| class="wikitable" !Description !Command |- |Sequential read test, 1MB block size, 1 thread, 1 queue |{{Highlight | code = # fio \ --ioengine=libaio \ --direct=1 \ --randrepeat=0 \ --refill_buffers \ --end_fsync=1 \ --filename=/home/lleung/.kdiskmark.tmp \ --name=sequential-read-8-queues-1-thread \..."
 
No edit summary
Line 1: Line 1:
The flexible IO (fio) utility can be used to quickly benchmark the filesystem IO performance.
The flexible IO (fio) utility can be used to quickly benchmark the filesystem IO performance. A related project that uses fio is fio_plot which runs multiple benchmarks with various options and generates graphs.
 
* fio project website: https://github.com/axboe/fio
* fio man page: https://linux.die.net/man/1/fio
* fio_plot project website: https://github.com/louwrentius/fio-plot


== Quick start ==
== Quick start ==
Select one of the following commands to run.
To simply test the filesystem performance with fio (direct IO, no buffers), run:{{Highlight
{| class="wikitable"
!Description
!Command
|-
|Sequential read test, 1MB block size, 1 thread, 1 queue
|{{Highlight
| code = # fio \
| code = # fio \
   --ioengine=libaio \
   --ioengine=libaio \
Line 15: Line 13:
   --refill_buffers \
   --refill_buffers \
   --end_fsync=1 \
   --end_fsync=1 \
   --filename=/home/lleung/.kdiskmark.tmp \
   --filename=$HOME/.fiotest \
   --name=sequential-read-8-queues-1-thread \
   --name=fio-read-test \
   --rw=read \
   --rw=read \
   --size=1073741824 \
   --size=1GB \
   --bs=1024k \
   --bs=1M \
  --iodepth=1 \
   --numjobs=1 \
   --numjobs=1 \
   --iodepth=8 \
   --iodepth=8 \
   --runtime=5
   --runtime=60
| lang = terminal
| lang = terminal
}}
}}More information on each of the options are listed below.
{| class="wikitable"
!Option
!Description
|-
| --rw=read
|Do a sequential read test. Alternatively, change this to one of the following other options:
 
* read (sequential)
* write (sequential)
* randread
* randwrite
* readwrite (sequential)
* randrw
|-
| --size=1GB
|Use a 1GB test file size. Must be a multiple of 1MB
|-
| --bs=1M
|Use a 1MB block size. Defaults to 4k
|-
| --iodepth=1
|For asynchronous read/writes, the OS will immediately return and fio does not need to wait for the IO operation to complete. This option will set how many IO operations are 'in flight', or running in the background by the OS.
This setting requires direct=1 and the use of a asynchronous IO engine such as libaio.
|-
|<nowiki>--numjobs=1</nowiki>
|Number of parallel jobs that fio will spawn for the test.
|-
|  --randrepeat=0 \
 
  --refill_buffers \
 
  --end_fsync=1 \
|randrepeat reseeds the random generator differently for each run
refill buffers ensures that buffers are rewritten and not cached
 
end fsync ensures the file contents are synced before the job exits
|-
| --direct=1
|use non-buffered I/O (usually O_DIRECT).
|}
|}



Revision as of 18:32, 2 August 2022

The flexible IO (fio) utility can be used to quickly benchmark the filesystem IO performance. A related project that uses fio is fio_plot which runs multiple benchmarks with various options and generates graphs.

Quick start

To simply test the filesystem performance with fio (direct IO, no buffers), run:

# fio \
  --ioengine=libaio \
  --direct=1 \
  --randrepeat=0 \
  --refill_buffers \
  --end_fsync=1 \
  --filename=$HOME/.fiotest \
  --name=fio-read-test \
  --rw=read \
  --size=1GB \
  --bs=1M \
  --numjobs=1 \
  --iodepth=8 \
  --runtime=60

More information on each of the options are listed below.

Option Description
--rw=read Do a sequential read test. Alternatively, change this to one of the following other options:
  • read (sequential)
  • write (sequential)
  • randread
  • randwrite
  • readwrite (sequential)
  • randrw
--size=1GB Use a 1GB test file size. Must be a multiple of 1MB
--bs=1M Use a 1MB block size. Defaults to 4k
--iodepth=1 For asynchronous read/writes, the OS will immediately return and fio does not need to wait for the IO operation to complete. This option will set how many IO operations are 'in flight', or running in the background by the OS.

This setting requires direct=1 and the use of a asynchronous IO engine such as libaio.

--numjobs=1 Number of parallel jobs that fio will spawn for the test.
  --randrepeat=0 \

  --refill_buffers \

  --end_fsync=1 \

randrepeat reseeds the random generator differently for each run

refill buffers ensures that buffers are rewritten and not cached

end fsync ensures the file contents are synced before the job exits

--direct=1 use non-buffered I/O (usually O_DIRECT).

Understanding the results

Results you get after running fio looks like something below:

Starting 1 process
sequential-read-8-queues-1-thread: Laying out IO file (1 file / 1024MiB)
Jobs: 1 (f=1): [R(1)][100.0%][r=241MiB/s][r=241 IOPS][eta 00m:00s]
sequential-read-8-queues-1-thread: (groupid=0, jobs=1): err= 0: pid=137965: Thu Jul 28 15:41:32 2022
  read: IOPS=190, BW=191MiB/s (200MB/s)(957MiB/5014msec)
    slat (usec): min=105, max=881, avg=222.28, stdev=54.72
    clat (msec): min=3, max=426, avg=41.63, stdev=63.38
     lat (msec): min=3, max=427, avg=41.86, stdev=63.38
    clat percentiles (msec):
  • slat - submission latency. This is the time it took to submit the I/O. This could be useful if you need to determine if you need to tune the IO scheduler (eg. from spinning disk to SSD) or if there's a network issue for network based filesystems.
  • clat - completion latency. This is the time between submission and completion.

Other notes

Drop caches

You might want to drop caches before doing a test to avoid skewed results by running: echo 1 > /proc/sys/vm/drop_caches

Change the output format

Use the --output-format=json option to change the output format to json.