blob: f64b028ffb9222b2091e314d094eaf36280830ec [file] [log] [blame]
Jens Axboeebac4652005-12-08 15:25:21 +01001fio
2---
3
Jens Axboe79809112006-06-09 10:14:54 +02004fio is a tool that will spawn a number of threads or processes doing a
5particular type of io action as specified by the user. fio takes a
6number of global parameters, each inherited by the thread unless
7otherwise parameters given to them overriding that setting is given.
8The typical use of fio is to write a job file matching the io load
9one wants to simulate.
Jens Axboeebac4652005-12-08 15:25:21 +010010
Jens Axboe2b02b542005-12-08 15:29:14 +010011
12Source
13------
14
15fio resides in a git repo, the canonical place is:
16
17git://brick.kernel.dk/data/git/fio.git
18
Jens Axboe79809112006-06-09 10:14:54 +020019Snapshots are frequently generated and they include the git meta data as
20well. You can download them here:
Jens Axboe2b02b542005-12-08 15:29:14 +010021
22http://brick.kernel.dk/snaps/
23
Jens Axboe1053a102006-06-06 09:23:13 +020024Pascal Bleser <guru@unixtech.be> has fio RPMs in his repository, you
25can find them here:
26
27http://linux01.gwdg.de/~pbleser/rpm-navigation.php?cat=System/fio
28
Jens Axboe2b02b542005-12-08 15:29:14 +010029
Jens Axboebbfd6b02006-06-07 19:42:54 +020030Building
31--------
32
33Just type 'make' and 'make install'. If on FreeBSD, for now you have to
34specify the FreeBSD Makefile with -f, eg:
35
36$ make -f Makefile.Freebsd && make -f Makefile.FreeBSD install
37
Jens Axboeedffcb92006-06-08 13:40:18 +020038Likewise with OpenSolaris, use the Makefile.solaris to compile there.
Jens Axboebbfd6b02006-06-07 19:42:54 +020039This might change in the future if I opt for an autoconf type setup.
40
41
Jens Axboe972cfd22006-06-09 11:08:56 +020042Command line
43------------
Jens Axboeebac4652005-12-08 15:25:21 +010044
45$ fio
Jens Axboeebac4652005-12-08 15:25:21 +010046 -t <sec> Runtime in seconds
Jens Axboeebac4652005-12-08 15:25:21 +010047 -l Generate per-job latency logs
48 -w Generate per-job bandwidth logs
Jens Axboe9ebc27e2006-06-12 10:21:50 +020049 -o <file> Log output to file
Jens Axboec6ae0a52006-06-12 11:04:44 +020050 -m Minimal (terse) output
Jens Axboe4785f992006-05-26 03:59:10 +020051 -h Print help info
Jens Axboeebac4652005-12-08 15:25:21 +010052 -v Print version information and exit
53
Jens Axboe972cfd22006-06-09 11:08:56 +020054Any parameters following the options will be assumed to be job files.
55You can add as many as you want, each job file will be regarded as a
56separate group and fio will stonewall it's execution.
57
Jens Axboe79809112006-06-09 10:14:54 +020058
59Job file
60--------
61
62Only a few options can be controlled with command line parameters,
63generally it's a lot easier to just write a simple job file to describe
64the workload. The job file format is in the ini style format, as it's
65easy to read and write for the user.
66
67The job file parameters are:
Jens Axboeebac4652005-12-08 15:25:21 +010068
Jens Axboe01452052006-06-07 10:29:47 +020069 name=x Use 'x' as the identifier for this job.
Jens Axboeebac4652005-12-08 15:25:21 +010070 directory=x Use 'x' as the top level directory for storing files
Jens Axboeb50b8752006-10-24 19:05:53 +020071 filename=x Force the use of 'x' as the filename for all files
72 in this thread. If not given, fio will make up
73 a suitable filename based on the thread and file
74 number.
Jens Axboe3d60d1e2006-05-25 06:31:06 +020075 rw=x 'x' may be: read, randread, write, randwrite,
76 rw (read-write mix), randrw (read-write random mix)
Jens Axboea6ccc7b2006-06-02 10:14:15 +020077 rwmixcycle=x Base cycle for switching between read and write
78 in msecs.
79 rwmixread=x 'x' percentage of rw mix ios will be reads. If
80 rwmixwrite is also given, the last of the two will
81 be used if they don't add up to 100%.
82 rwmixwrite=x 'x' percentage of rw mix ios will be writes. See
83 rwmixread.
Jens Axboe9ebc27e2006-06-12 10:21:50 +020084 rand_repeatable=x The sequence of random io blocks can be repeatable
85 across runs, if 'x' is 1.
Jens Axboeebac4652005-12-08 15:25:21 +010086 size=x Set file size to x bytes (x string can include k/m/g)
87 ioengine=x 'x' may be: aio/libaio/linuxaio for Linux aio,
88 posixaio for POSIX aio, sync for regular read/write io,
Jens Axboe8756e4d2006-05-27 20:24:53 +020089 mmap for mmap'ed io, splice for using splice/vmsplice,
90 or sgio for direct SG_IO io. The latter only works on
91 Linux on SCSI (or SCSI-like devices, such as
92 usb-storage or sata/libata driven) devices.
Jens Axboeebac4652005-12-08 15:25:21 +010093 iodepth=x For async io, allow 'x' ios in flight
94 overwrite=x If 'x', layout a write file first.
Jens Axboe53cdc682006-10-18 11:50:58 +020095 nrfiles=x Spread io load over 'x' number of files per job,
96 if possible.
Jens Axboeebac4652005-12-08 15:25:21 +010097 prio=x Run io at prio X, 0-7 is the kernel allowed range
98 prioclass=x Run io at prio class X
99 bs=x Use 'x' for thread blocksize. May include k/m postfix.
100 bsrange=x-y Mix thread block sizes randomly between x and y. May
101 also include k/m postfix.
102 direct=x 1 for direct IO, 0 for buffered IO
103 thinktime=x "Think" x usec after each io
104 rate=x Throttle rate to x KiB/sec
105 ratemin=x Quit if rate of x KiB/sec can't be met
106 ratecycle=x ratemin averaged over x msecs
107 cpumask=x Only allow job to run on CPUs defined by mask.
Jens Axboe795407c2006-10-24 19:42:44 +0200108 fsync=x If writing with buffered IO, fsync after every
109 'x' blocks have been written.
110 end_fsync=x If 'x', run fsync() after end-of-job.
Jens Axboeebac4652005-12-08 15:25:21 +0100111 startdelay=x Start this thread x seconds after startup
Jens Axboe906c8d72006-06-13 09:37:56 +0200112 timeout=x Terminate x seconds after startup. Can include a
113 normal time suffix if not given in seconds, such as
114 'm' for minutes, 'h' for hours, and 'd' for days.
Jens Axboeebac4652005-12-08 15:25:21 +0100115 offset=x Start io at offset x (x string can include k/m/g)
116 invalidate=x Invalidate page cache for file prior to doing io
Jens Axboe795407c2006-10-24 19:42:44 +0200117 sync=x Use sync writes if x and writing buffered IO.
Jens Axboeebac4652005-12-08 15:25:21 +0100118 mem=x If x == malloc, use malloc for buffers. If x == shm,
Jens Axboe795407c2006-10-24 19:42:44 +0200119 use shared memory for buffers. If x == mmap, use
120 anonymous mmap.
Jens Axboeebac4652005-12-08 15:25:21 +0100121 exitall When one thread quits, terminate the others
122 bwavgtime=x Average bandwidth stats over an x msec window.
123 create_serialize=x If 'x', serialize file creation.
124 create_fsync=x If 'x', run fsync() after file creation.
Jens Axboef6cbb262006-10-18 14:16:42 +0200125 unlink If set, unlink files when done.
Jens Axboeebac4652005-12-08 15:25:21 +0100126 loops=x Run the job 'x' number of times.
127 verify=x If 'x' == md5, use md5 for verifies. If 'x' == crc32,
128 use crc32 for verifies. md5 is 'safer', but crc32 is
129 a lot faster. Only makes sense for writing to a file.
130 stonewall Wait for preceeding jobs to end before running.
131 numjobs=x Create 'x' similar entries for this job
132 thread Use pthreads instead of forked jobs
Jens Axboe20dc95c2005-12-09 10:29:35 +0100133 zonesize=x
134 zoneskip=y Zone options must be paired. If given, the job
135 will skip y bytes for every x read/written. This
136 can be used to gauge hard drive speed over the entire
137 platter, without reading everything. Both x/y can
138 include k/m/g suffix.
Jens Axboeaea47d42006-05-26 19:27:29 +0200139 iolog=x Open and read io pattern from file 'x'. The file must
140 contain one io action per line in the following format:
141 rw, offset, length
142 where with rw=0/1 for read/write, and the offset
143 and length entries being in bytes.
Jens Axboe843a7412006-06-01 21:14:21 -0700144 write_iolog=x Write an iolog to file 'x' in the same format as iolog.
145 The iolog options are exclusive, if both given the
146 read iolog will be performed.
Jens Axboeec94ec52006-10-20 10:59:19 +0200147 write_bw_log Write a bandwidth log.
148 write_lat_log Write a latency log.
Jens Axboec04f7ec2006-05-31 10:13:16 +0200149 lockmem=x Lock down x amount of memory on the machine, to
150 simulate a machine with less memory available. x can
151 include k/m/g suffix.
Jens Axboeb6f4d882006-06-02 10:32:51 +0200152 nice=x Run job at given nice value.
Jens Axboe4e0ba8a2006-06-06 09:36:28 +0200153 exec_prerun=x Run 'x' before job io is begun.
154 exec_postrun=x Run 'x' after job io has finished.
Jens Axboeda867742006-06-06 10:39:10 -0700155 ioscheduler=x Use ioscheduler 'x' for this job.
Jens Axboeb990b5c2006-09-14 09:48:22 +0200156 cpuload=x For a CPU io thread, percentage of CPU time to attempt
157 to burn.
158 cpuchunks=x Split burn cycles into pieces of x.
Jens Axboeebac4652005-12-08 15:25:21 +0100159
Jens Axboe79809112006-06-09 10:14:54 +0200160
Jens Axboeebac4652005-12-08 15:25:21 +0100161Examples using a job file
162-------------------------
163
Jens Axboe79809112006-06-09 10:14:54 +0200164Example 1) Two random readers
Jens Axboeebac4652005-12-08 15:25:21 +0100165
Jens Axboe79809112006-06-09 10:14:54 +0200166Lets say we want to simulate two threads reading randomly from a file
167each. They will be doing IO in 4KiB chunks, using raw (O_DIRECT) IO.
168Since they share most parameters, we'll put those in the [global]
169section. Job 1 will use a 128MiB file, job 2 will use a 256MiB file.
Jens Axboeebac4652005-12-08 15:25:21 +0100170
Jens Axboe79809112006-06-09 10:14:54 +0200171; ---snip---
Jens Axboeebac4652005-12-08 15:25:21 +0100172
Jens Axboe79809112006-06-09 10:14:54 +0200173[global]
174ioengine=sync ; regular read/write(2), the default
175rw=randread
176bs=4k
Jens Axboeebac4652005-12-08 15:25:21 +0100177direct=1
178
Jens Axboe79809112006-06-09 10:14:54 +0200179[file1]
180size=128m
Jens Axboeebac4652005-12-08 15:25:21 +0100181
Jens Axboe79809112006-06-09 10:14:54 +0200182[file2]
183size=256m
Jens Axboeebac4652005-12-08 15:25:21 +0100184
Jens Axboe79809112006-06-09 10:14:54 +0200185; ---snip---
Jens Axboeebac4652005-12-08 15:25:21 +0100186
Jens Axboe79809112006-06-09 10:14:54 +0200187Generally the [] bracketed name specifies a file name, but the "global"
188keyword is reserved for setting options that are inherited by each
189subsequent job description. It's possible to have several [global]
190sections in the job file, each one adds options that are inherited by
191jobs defined below it. The name can also point to a block device, such
192as /dev/sda. To run the above job file, simply do:
193
194$ fio jobfile
195
196Example 2) Many random writers
197
198Say we want to exercise the IO subsystem some more. We'll define 64
199threads doing random buffered writes. We'll let each thread use async io
200with a depth of 4 ios in flight. A job file would then look like this:
201
202; ---snip---
203
204[global]
205ioengine=libaio
206iodepth=4
207rw=randwrite
208bs=32k
209direct=0
210size=64m
211
212[files]
213numjobs=64
214
215; ---snip---
216
217This will create files.[0-63] and perform the random writes to them.
218
219There are endless ways to define jobs, the examples/ directory contains
220a few more examples.
Jens Axboeebac4652005-12-08 15:25:21 +0100221
222
223Interpreting the output
224-----------------------
225
226fio spits out a lot of output. While running, fio will display the
227status of the jobs created. An example of that would be:
228
Jens Axboe972cfd22006-06-09 11:08:56 +0200229Threads running: 1: [_r] [24.79% done] [eta 00h:01m:31s]
Jens Axboeebac4652005-12-08 15:25:21 +0100230
231The characters inside the square brackets denote the current status of
232each thread. The possible values (in typical life cycle order) are:
233
234Idle Run
235---- ---
236P Thread setup, but not started.
Jens Axboe79809112006-06-09 10:14:54 +0200237C Thread created.
238I Thread initialized, waiting.
Jens Axboeebac4652005-12-08 15:25:21 +0100239 R Running, doing sequential reads.
240 r Running, doing random reads.
241 W Running, doing sequential writes.
242 w Running, doing random writes.
Jens Axboe79809112006-06-09 10:14:54 +0200243 M Running, doing mixed sequential reads/writes.
244 m Running, doing mixed random reads/writes.
245 F Running, currently waiting for fsync()
Jens Axboeebac4652005-12-08 15:25:21 +0100246V Running, doing verification of written data.
247E Thread exited, not reaped by main thread yet.
248_ Thread reaped.
249
Jens Axboe79809112006-06-09 10:14:54 +0200250The other values are fairly self explanatory - number of threads
251currently running and doing io, and the estimated completion percentage
Jens Axboe972cfd22006-06-09 11:08:56 +0200252and time for the running group. It's impossible to estimate runtime
253of the following groups (if any).
Jens Axboeebac4652005-12-08 15:25:21 +0100254
255When fio is done (or interrupted by ctrl-c), it will show the data for
256each thread, group of threads, and disks in that order. For each data
257direction, the output looks like:
258
259Client1 (g=0): err= 0:
260 write: io= 32MiB, bw= 666KiB/s, runt= 50320msec
261 slat (msec): min= 0, max= 136, avg= 0.03, dev= 1.92
262 clat (msec): min= 0, max= 631, avg=48.50, dev=86.82
263 bw (KiB/s) : min= 0, max= 1196, per=51.00%, avg=664.02, dev=681.68
264 cpu : usr=1.49%, sys=0.25%, ctx=7969
265
266The client number is printed, along with the group id and error of that
267thread. Below is the io statistics, here for writes. In the order listed,
268they denote:
269
270io= Number of megabytes io performed
271bw= Average bandwidth rate
272runt= The runtime of that thread
273 slat= Submission latency (avg being the average, dev being the
274 standard deviation). This is the time it took to submit
275 the io. For sync io, the slat is really the completion
276 latency, since queue/complete is one operation there.
277 clat= Completion latency. Same names as slat, this denotes the
278 time from submission to completion of the io pieces. For
279 sync io, clat will usually be equal (or very close) to 0,
280 as the time from submit to complete is basically just
281 CPU time (io has already been done, see slat explanation).
282 bw= Bandwidth. Same names as the xlat stats, but also includes
283 an approximate percentage of total aggregate bandwidth
284 this thread received in this group. This last value is
285 only really useful if the threads in this group are on the
286 same disk, since they are then competing for disk access.
287cpu= CPU usage. User and system time, along with the number
288 of context switches this thread went through.
289
290After each client has been listed, the group statistics are printed. They
291will look like this:
292
293Run status group 0 (all jobs):
294 READ: io=64MiB, aggrb=22178, minb=11355, maxb=11814, mint=2840msec, maxt=2955msec
295 WRITE: io=64MiB, aggrb=1302, minb=666, maxb=669, mint=50093msec, maxt=50320msec
296
297For each data direction, it prints:
298
299io= Number of megabytes io performed.
300aggrb= Aggregate bandwidth of threads in this group.
301minb= The minimum average bandwidth a thread saw.
302maxb= The maximum average bandwidth a thread saw.
Jens Axboe79809112006-06-09 10:14:54 +0200303mint= The smallest runtime of the threads in that group.
304maxt= The longest runtime of the threads in that group.
Jens Axboeebac4652005-12-08 15:25:21 +0100305
306And finally, the disk statistics are printed. They will look like this:
307
308Disk stats (read/write):
309 sda: ios=16398/16511, merge=30/162, ticks=6853/819634, in_queue=826487, util=100.00%
310
311Each value is printed for both reads and writes, with reads first. The
312numbers denote:
313
314ios= Number of ios performed by all groups.
315merge= Number of merges io the io scheduler.
316ticks= Number of ticks we kept the disk busy.
317io_queue= Total time spent in the disk queue.
318util= The disk utilization. A value of 100% means we kept the disk
319 busy constantly, 50% would be a disk idling half of the time.
Jens Axboe79809112006-06-09 10:14:54 +0200320
321
Jens Axboec6ae0a52006-06-12 11:04:44 +0200322Terse output
323------------
324
325For scripted usage where you typically want to generate tables or graphs
326of the results, fio can output the results in a comma seperated format.
327The format is one long line of values, such as:
328
329client1,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
330
331Split up, the format is as follows:
332
333 jobname, groupid, error
334 READ status:
335 KiB IO, bandwidth (KiB/sec), runtime (msec)
336 Submission latency: min, max, mean, deviation
337 Completion latency: min, max, mean, deviation
338 Bw: min, max, aggreate percentage of total, mean, deviation
339 WRITE status:
340 KiB IO, bandwidth (KiB/sec), runtime (msec)
341 Submission latency: min, max, mean, deviation
342 Completion latency: min, max, mean, deviation
343 Bw: min, max, aggreate percentage of total, mean, deviation
344 CPU usage: user, system, context switches
345
346
Jens Axboe79809112006-06-09 10:14:54 +0200347Author
348------
349
Jens Axboeaae22ca2006-09-05 10:46:22 +0200350Fio was written by Jens Axboe <axboe@kernel.dk> to enable flexible testing
Jens Axboe79809112006-06-09 10:14:54 +0200351of the Linux IO subsystem and schedulers. He got tired of writing
352specific test applications to simulate a given workload, and found that
353the existing io benchmark/test tools out there weren't flexible enough
354to do what he wanted.
355
Jens Axboeaae22ca2006-09-05 10:46:22 +0200356Jens Axboe <axboe@kernel.dk> 20060905
Jens Axboe79809112006-06-09 10:14:54 +0200357