FIO Perf Tool Nutshell

root's picture

FIO is an I/O tool meant to be used both for benchmark and stress/hardware verification. It has support for 13 different types of I/O engines (sync, mmap, libaio, posixaio, SG v3, splice, null, network, syslet, guasi, solarisaio, and more), I/O priorities (for newer Linux kernels), rate I/O, forked or threaded jobs, and much more. It can work on block devices as well as files. fio accepts job descriptions in a simple-to-understand text format. Several example job files are included. fio displays all sorts of I/O performance information. Fio is in wide use in many places, for both benchmarking, QA, and verification purposes. It supports Linux, FreeBSD, NetBSD, OS X, OpenSolaris, AIX, HP-UX, and Windows.
FIO headquarters and link for source download is located here:

You may find also precompiled versions for some platforms:

Sample command runs (syntax is exactly the same on all platforms):
1. Write out a 20GB file called fio.write.out in 64k chunks, 1 thread:
# fio --size=20g --bs=64k --rw=write --ioengine=sync --name=fio.write.out
2. Read 20GB from file fio.write.out in 64k chunks, 1 thread:
# fio --size=20g --bs=64k --rw=read --ioengine=sync --name=fio.write.out
3. Write out 4 x 10GB files in 64k chunks, 4 threads:
# fio --size=10g --bs=64k --rw=write --ioengine=sync --name=fio.write.out --numjobs=4
4. Read 10GB from files fio.write.out.* in 64k chunks, 4 threads:
# fio --size=10g --bs=64k --rw=read --ioengine=sync --name=fio.write.out --numjobs=4

NOTE: It is recommended to run the write tests first. The read tests will use the files created by the write tests. If you run the read tests first, you will have to wait for fio to create the file it needs first.

Please find below a short howto of how to compile it from source and use it (for the installation of compiled version, please check the manual for your platform). The tests were done on a Debian Lenny machine:


core:~# cd /usr/src
core:src# wget
--2012-04-18 13:24:03--
Connecting to||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 272301 (266K) [application/x-gzip]
Saving to: `fio-2.0.7.tar.gz'

100%[===================================================>] 272,301     1.17M/s   in 0.2s    

2012-04-18 13:24:03 (1.17 MB/s) - `fio-2.0.7.tar.gz' saved [272301/272301]

Uncompress and compile:

core:src# tar xf fio-2.0.7.tar.gz
core:src# cd fio-2.0.7
core:fio-2.0.7# make
    CC gettime.o
    CC fio.o
    CC ioengines.o
    CC init.o
    CC stat.o
    CC log.o
    CC time.o
    CC filesetup.o
    CC eta.o
    CC verify.o
    CC memory.o
    CC io_u.o
    CC parse.o
    CC mutex.o
    CC options.o
    CC rbtree.o
    CC smalloc.o
    CC filehash.o
    CC profile.o
    CC debug.o
    CC lib/rand.o
    CC lib/num2str.o
    CC lib/ieee754.o
    CC crc/crc16.o
    CC crc/crc32.o
    CC crc/crc32c.o
    CC crc/crc32c-intel.o
    CC crc/crc64.o
    CC crc/crc7.o
    CC crc/md5.o
    CC crc/sha1.o
    CC crc/sha256.o
    CC crc/sha512.o
    CC engines/cpu.o
    CC engines/mmap.o
    CC engines/sync.o
    CC engines/null.o
    CC engines/net.o
    CC memalign.o
    CC server.o
    CC client.o
    CC iolog.o
    CC backend.o
    CC libfio.o
    CC flow.o
    CC diskutil.o
    CC fifo.o
    CC blktrace.o
    CC helpers.o
    CC cgroup.o
    CC trim.o
    CC engines/libaio.o
    CC engines/posixaio.o
    CC engines/sg.o
    CC engines/splice.o
    CC engines/syslet-rw.o
    CC engines/guasi.o
    CC engines/binject.o
    CC engines/rdma.o
    CC profiles/tiobench.o
    CC fio

In my situation, I had to install two debian packages, libaio1 and libaio-dev, but maybe for you is not the case:

core:fio-2.0.7# make
    CC gettime.o
In file included from fio.h:24,
                 from gettime.c:10:
os/os.h:45:20: [color=red]error: libaio.h: No such file or directory[/color]
In file included from fio.h:30,
                 from gettime.c:10:
ioengine.h:23: error: field ‘iocb’ has incomplete type
make: *** [gettime.o] Error 1

If everything runs well, you will have now your fio in the same directory:

core:fio-2.0.7# ls -la fio
-rwxr-xr-x 1 root root 2025139 2012-04-18 14:08 fio

And finally, one example of write test:

core:fio-2.0.7# ./fio --size=1g --bs=10m --rw=write --ioengine=sync --name=/tmp/fio.write.out
/tmp/fio.write.out: (g=0): rw=write, bs=10M-10M/10M-10M, ioengine=sync, iodepth=1
fio 2.0.7
Starting 1 process
/tmp/fio.write.out: Laying out IO file(s) (1 file(s) / 1024MB)
Jobs: 1 (f=1): [W] [93.3% done] [0K/72601K /s] [0 /6  iops] [eta 00m:01s]
/tmp/fio.write.out: (groupid=0, jobs=1): err= 0: pid=7329
  write: io=1020.0MB, bw=76340KB/s, iops=7 , runt= 13682msec
    clat (msec): min=6 , max=244 , avg=133.09, stdev=40.49
     lat (msec): min=6 , max=245 , avg=133.98, stdev=40.49
    clat percentiles (msec):
     |  1.00th=[    7],  5.00th=[   94], 10.00th=[  101], 20.00th=[  114],
     | 30.00th=[  117], 40.00th=[  124], 50.00th=[  133], 60.00th=[  137],
     | 70.00th=[  143], 80.00th=[  155], 90.00th=[  180], 95.00th=[  215],
     | 99.00th=[  231], 99.50th=[  245], 99.90th=[  245], 99.95th=[  245],
     | 99.99th=[  245]
    bw (KB/s)  : min=59190, max=146024, per=100.00%, avg=76679.38, stdev=16414.53
    lat (msec) : 10=2.94%, 50=0.98%, 100=5.88%, 250=90.20%
  cpu          : usr=0.12%, sys=8.25%, ctx=2064, majf=0, minf=29
  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    : total=r=0/w=102/d=0, short=r=0/w=0/d=0

Run status group 0 (all jobs):
  WRITE: io=1020.0MB, [color=blue]aggrb=76339KB/s[/color], minb=76339KB/s, maxb=76339KB/s, mint=13682msec, maxt=13682msec

Disk stats (read/write):
    dm-2: ios=0/231936, merge=0/0, ticks=0/828024584, in_queue=763954112, util=100.00%, aggrios=146/233487, aggrmerge=0/0, aggrticks=0/0, aggrin_queue=0, aggrutil=0.00%
    md1: ios=146/233487, merge=0/0, ticks=0/0, in_queue=0, util=0.00%, aggrios=138/2352, aggrmerge=1/253904, aggrticks=16746/1041224, aggrin_queue=1095744, aggrutil=100.00%
  sdb: ios=149/2530, merge=2/253718, ticks=13288/165452, in_queue=180028, util=75.24%
  sda: ios=127/2174, merge=1/254091, ticks=20204/1916996, in_queue=2011460, util=100.00%

The primary output parameter you'll want to focus on is "aggrb". The run above produced a rate of 76 MBytes/second.

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.