4 fio is a tool that will spawn a number of threads or processes doing a
5 particular type of io action as specified by the user. fio takes a
6 number of global parameters, each inherited by the thread unless
7 otherwise parameters given to them overriding that setting is given.
8 The typical use of fio is to write a job file matching the io load
15 fio resides in a git repo, the canonical place is:
17 git://brick.kernel.dk/data/git/fio.git
19 Snapshots are frequently generated and they include the git meta data as
20 well. You can download them here:
22 http://brick.kernel.dk/snaps/
24 Pascal Bleser <guru@unixtech.be> has fio RPMs in his repository, you
27 http://linux01.gwdg.de/~pbleser/rpm-navigation.php?cat=System/fio
33 Just type 'make' and 'make install'. If on FreeBSD, for now you have to
34 specify the FreeBSD Makefile with -f, eg:
36 $ make -f Makefile.Freebsd && make -f Makefile.FreeBSD install
38 Likewise with OpenSolaris, use the Makefile.solaris to compile there.
39 This might change in the future if I opt for an autoconf type setup.
46 -t <sec> Runtime in seconds
47 -l Generate per-job latency logs
48 -w Generate per-job bandwidth logs
49 -o <file> Log output to file
50 -m Minimal (terse) output
52 -v Print version information and exit
54 Any parameters following the options will be assumed to be job files.
55 You can add as many as you want, each job file will be regarded as a
56 separate group and fio will stonewall it's execution.
62 Only a few options can be controlled with command line parameters,
63 generally it's a lot easier to just write a simple job file to describe
64 the workload. The job file format is in the ini style format, as it's
65 easy to read and write for the user.
67 The job file parameters are:
69 name=x Use 'x' as the identifier for this job.
70 directory=x Use 'x' as the top level directory for storing files
71 rw=x 'x' may be: read, randread, write, randwrite,
72 rw (read-write mix), randrw (read-write random mix)
73 rwmixcycle=x Base cycle for switching between read and write
75 rwmixread=x 'x' percentage of rw mix ios will be reads. If
76 rwmixwrite is also given, the last of the two will
77 be used if they don't add up to 100%.
78 rwmixwrite=x 'x' percentage of rw mix ios will be writes. See
80 rand_repeatable=x The sequence of random io blocks can be repeatable
81 across runs, if 'x' is 1.
82 size=x Set file size to x bytes (x string can include k/m/g)
83 ioengine=x 'x' may be: aio/libaio/linuxaio for Linux aio,
84 posixaio for POSIX aio, sync for regular read/write io,
85 mmap for mmap'ed io, splice for using splice/vmsplice,
86 or sgio for direct SG_IO io. The latter only works on
87 Linux on SCSI (or SCSI-like devices, such as
88 usb-storage or sata/libata driven) devices.
89 iodepth=x For async io, allow 'x' ios in flight
90 overwrite=x If 'x', layout a write file first.
91 nrfiles=x Spread io load over 'x' number of files per job,
93 prio=x Run io at prio X, 0-7 is the kernel allowed range
94 prioclass=x Run io at prio class X
95 bs=x Use 'x' for thread blocksize. May include k/m postfix.
96 bsrange=x-y Mix thread block sizes randomly between x and y. May
97 also include k/m postfix.
98 direct=x 1 for direct IO, 0 for buffered IO
99 thinktime=x "Think" x usec after each io
100 rate=x Throttle rate to x KiB/sec
101 ratemin=x Quit if rate of x KiB/sec can't be met
102 ratecycle=x ratemin averaged over x msecs
103 cpumask=x Only allow job to run on CPUs defined by mask.
104 fsync=x If writing, fsync after every x blocks have been written
105 startdelay=x Start this thread x seconds after startup
106 timeout=x Terminate x seconds after startup. Can include a
107 normal time suffix if not given in seconds, such as
108 'm' for minutes, 'h' for hours, and 'd' for days.
109 offset=x Start io at offset x (x string can include k/m/g)
110 invalidate=x Invalidate page cache for file prior to doing io
111 sync=x Use sync writes if x and writing
112 mem=x If x == malloc, use malloc for buffers. If x == shm,
113 use shm for buffers. If x == mmap, use anon mmap.
114 exitall When one thread quits, terminate the others
115 bwavgtime=x Average bandwidth stats over an x msec window.
116 create_serialize=x If 'x', serialize file creation.
117 create_fsync=x If 'x', run fsync() after file creation.
118 unlink If set, unlink files when done.
119 end_fsync=x If 'x', run fsync() after end-of-job.
120 loops=x Run the job 'x' number of times.
121 verify=x If 'x' == md5, use md5 for verifies. If 'x' == crc32,
122 use crc32 for verifies. md5 is 'safer', but crc32 is
123 a lot faster. Only makes sense for writing to a file.
124 stonewall Wait for preceeding jobs to end before running.
125 numjobs=x Create 'x' similar entries for this job
126 thread Use pthreads instead of forked jobs
128 zoneskip=y Zone options must be paired. If given, the job
129 will skip y bytes for every x read/written. This
130 can be used to gauge hard drive speed over the entire
131 platter, without reading everything. Both x/y can
132 include k/m/g suffix.
133 iolog=x Open and read io pattern from file 'x'. The file must
134 contain one io action per line in the following format:
136 where with rw=0/1 for read/write, and the offset
137 and length entries being in bytes.
138 write_iolog=x Write an iolog to file 'x' in the same format as iolog.
139 The iolog options are exclusive, if both given the
140 read iolog will be performed.
141 lockmem=x Lock down x amount of memory on the machine, to
142 simulate a machine with less memory available. x can
143 include k/m/g suffix.
144 nice=x Run job at given nice value.
145 exec_prerun=x Run 'x' before job io is begun.
146 exec_postrun=x Run 'x' after job io has finished.
147 ioscheduler=x Use ioscheduler 'x' for this job.
148 cpuload=x For a CPU io thread, percentage of CPU time to attempt
150 cpuchunks=x Split burn cycles into pieces of x.
153 Examples using a job file
154 -------------------------
156 Example 1) Two random readers
158 Lets say we want to simulate two threads reading randomly from a file
159 each. They will be doing IO in 4KiB chunks, using raw (O_DIRECT) IO.
160 Since they share most parameters, we'll put those in the [global]
161 section. Job 1 will use a 128MiB file, job 2 will use a 256MiB file.
166 ioengine=sync ; regular read/write(2), the default
179 Generally the [] bracketed name specifies a file name, but the "global"
180 keyword is reserved for setting options that are inherited by each
181 subsequent job description. It's possible to have several [global]
182 sections in the job file, each one adds options that are inherited by
183 jobs defined below it. The name can also point to a block device, such
184 as /dev/sda. To run the above job file, simply do:
188 Example 2) Many random writers
190 Say we want to exercise the IO subsystem some more. We'll define 64
191 threads doing random buffered writes. We'll let each thread use async io
192 with a depth of 4 ios in flight. A job file would then look like this:
209 This will create files.[0-63] and perform the random writes to them.
211 There are endless ways to define jobs, the examples/ directory contains
215 Interpreting the output
216 -----------------------
218 fio spits out a lot of output. While running, fio will display the
219 status of the jobs created. An example of that would be:
221 Threads running: 1: [_r] [24.79% done] [eta 00h:01m:31s]
223 The characters inside the square brackets denote the current status of
224 each thread. The possible values (in typical life cycle order) are:
228 P Thread setup, but not started.
230 I Thread initialized, waiting.
231 R Running, doing sequential reads.
232 r Running, doing random reads.
233 W Running, doing sequential writes.
234 w Running, doing random writes.
235 M Running, doing mixed sequential reads/writes.
236 m Running, doing mixed random reads/writes.
237 F Running, currently waiting for fsync()
238 V Running, doing verification of written data.
239 E Thread exited, not reaped by main thread yet.
242 The other values are fairly self explanatory - number of threads
243 currently running and doing io, and the estimated completion percentage
244 and time for the running group. It's impossible to estimate runtime
245 of the following groups (if any).
247 When fio is done (or interrupted by ctrl-c), it will show the data for
248 each thread, group of threads, and disks in that order. For each data
249 direction, the output looks like:
251 Client1 (g=0): err= 0:
252 write: io= 32MiB, bw= 666KiB/s, runt= 50320msec
253 slat (msec): min= 0, max= 136, avg= 0.03, dev= 1.92
254 clat (msec): min= 0, max= 631, avg=48.50, dev=86.82
255 bw (KiB/s) : min= 0, max= 1196, per=51.00%, avg=664.02, dev=681.68
256 cpu : usr=1.49%, sys=0.25%, ctx=7969
258 The client number is printed, along with the group id and error of that
259 thread. Below is the io statistics, here for writes. In the order listed,
262 io= Number of megabytes io performed
263 bw= Average bandwidth rate
264 runt= The runtime of that thread
265 slat= Submission latency (avg being the average, dev being the
266 standard deviation). This is the time it took to submit
267 the io. For sync io, the slat is really the completion
268 latency, since queue/complete is one operation there.
269 clat= Completion latency. Same names as slat, this denotes the
270 time from submission to completion of the io pieces. For
271 sync io, clat will usually be equal (or very close) to 0,
272 as the time from submit to complete is basically just
273 CPU time (io has already been done, see slat explanation).
274 bw= Bandwidth. Same names as the xlat stats, but also includes
275 an approximate percentage of total aggregate bandwidth
276 this thread received in this group. This last value is
277 only really useful if the threads in this group are on the
278 same disk, since they are then competing for disk access.
279 cpu= CPU usage. User and system time, along with the number
280 of context switches this thread went through.
282 After each client has been listed, the group statistics are printed. They
285 Run status group 0 (all jobs):
286 READ: io=64MiB, aggrb=22178, minb=11355, maxb=11814, mint=2840msec, maxt=2955msec
287 WRITE: io=64MiB, aggrb=1302, minb=666, maxb=669, mint=50093msec, maxt=50320msec
289 For each data direction, it prints:
291 io= Number of megabytes io performed.
292 aggrb= Aggregate bandwidth of threads in this group.
293 minb= The minimum average bandwidth a thread saw.
294 maxb= The maximum average bandwidth a thread saw.
295 mint= The smallest runtime of the threads in that group.
296 maxt= The longest runtime of the threads in that group.
298 And finally, the disk statistics are printed. They will look like this:
300 Disk stats (read/write):
301 sda: ios=16398/16511, merge=30/162, ticks=6853/819634, in_queue=826487, util=100.00%
303 Each value is printed for both reads and writes, with reads first. The
306 ios= Number of ios performed by all groups.
307 merge= Number of merges io the io scheduler.
308 ticks= Number of ticks we kept the disk busy.
309 io_queue= Total time spent in the disk queue.
310 util= The disk utilization. A value of 100% means we kept the disk
311 busy constantly, 50% would be a disk idling half of the time.
317 For scripted usage where you typically want to generate tables or graphs
318 of the results, fio can output the results in a comma seperated format.
319 The format is one long line of values, such as:
321 client1,0,0,936,331,2894,0,0,0.000000,0.000000,1,170,22.115385,34.290410,16,714,84.252874%,366.500000,566.417819,3496,1237,2894,0,0,0.000000,0.000000,0,246,6.671625,21.436952,0,2534,55.465300%,1406.600000,2008.044216,0.000000%,0.431928%,1109
323 Split up, the format is as follows:
325 jobname, groupid, error
327 KiB IO, bandwidth (KiB/sec), runtime (msec)
328 Submission latency: min, max, mean, deviation
329 Completion latency: min, max, mean, deviation
330 Bw: min, max, aggreate percentage of total, mean, deviation
332 KiB IO, bandwidth (KiB/sec), runtime (msec)
333 Submission latency: min, max, mean, deviation
334 Completion latency: min, max, mean, deviation
335 Bw: min, max, aggreate percentage of total, mean, deviation
336 CPU usage: user, system, context switches
342 Fio was written by Jens Axboe <axboe@kernel.dk> to enable flexible testing
343 of the Linux IO subsystem and schedulers. He got tired of writing
344 specific test applications to simulate a given workload, and found that
345 the existing io benchmark/test tools out there weren't flexible enough
346 to do what he wanted.
348 Jens Axboe <axboe@kernel.dk> 20060905