[PATCH] Documentation updates
[fio.git] / README
... / ...
CommitLineData
1fio
2---
3
4fio 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.
10
11
12Source
13------
14
15fio resides in a git repo, the canonical place is:
16
17git://brick.kernel.dk/data/git/fio.git
18
19Snapshots are frequently generated and they include the git meta data as
20well. You can download them here:
21
22http://brick.kernel.dk/snaps/
23
24Pascal 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
29
30Building
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
38Likewise with OpenSolaris, use the Makefile.solaris to compile there.
39This might change in the future if I opt for an autoconf type setup.
40
41
42Options
43-------
44
45$ fio
46 -s IO is sequential
47 -b block size in KiB for each io
48 -t <sec> Runtime in seconds
49 -r For random io, sequence must be repeatable
50 -R <on> If one thread fails to meet rate, quit all
51 -o <on> Use direct IO is 1, buffered if 0
52 -l Generate per-job latency logs
53 -w Generate per-job bandwidth logs
54 -f <file> Read <file> for job descriptions
55 -O <file> Log output to file
56 -h Print help info
57 -v Print version information and exit
58
59
60Job file
61--------
62
63Only a few options can be controlled with command line parameters,
64generally it's a lot easier to just write a simple job file to describe
65the workload. The job file format is in the ini style format, as it's
66easy to read and write for the user.
67
68The job file parameters are:
69
70 name=x Use 'x' as the identifier for this job.
71 directory=x Use 'x' as the top level directory for storing files
72 rw=x 'x' may be: read, randread, write, randwrite,
73 rw (read-write mix), randrw (read-write random mix)
74 rwmixcycle=x Base cycle for switching between read and write
75 in msecs.
76 rwmixread=x 'x' percentage of rw mix ios will be reads. If
77 rwmixwrite is also given, the last of the two will
78 be used if they don't add up to 100%.
79 rwmixwrite=x 'x' percentage of rw mix ios will be writes. See
80 rwmixread.
81 size=x Set file size to x bytes (x string can include k/m/g)
82 ioengine=x 'x' may be: aio/libaio/linuxaio for Linux aio,
83 posixaio for POSIX aio, sync for regular read/write io,
84 mmap for mmap'ed io, splice for using splice/vmsplice,
85 or sgio for direct SG_IO io. The latter only works on
86 Linux on SCSI (or SCSI-like devices, such as
87 usb-storage or sata/libata driven) devices.
88 iodepth=x For async io, allow 'x' ios in flight
89 overwrite=x If 'x', layout a write file first.
90 prio=x Run io at prio X, 0-7 is the kernel allowed range
91 prioclass=x Run io at prio class X
92 bs=x Use 'x' for thread blocksize. May include k/m postfix.
93 bsrange=x-y Mix thread block sizes randomly between x and y. May
94 also include k/m postfix.
95 direct=x 1 for direct IO, 0 for buffered IO
96 thinktime=x "Think" x usec after each io
97 rate=x Throttle rate to x KiB/sec
98 ratemin=x Quit if rate of x KiB/sec can't be met
99 ratecycle=x ratemin averaged over x msecs
100 cpumask=x Only allow job to run on CPUs defined by mask.
101 fsync=x If writing, fsync after every x blocks have been written
102 startdelay=x Start this thread x seconds after startup
103 timeout=x Terminate x seconds after startup
104 offset=x Start io at offset x (x string can include k/m/g)
105 invalidate=x Invalidate page cache for file prior to doing io
106 sync=x Use sync writes if x and writing
107 mem=x If x == malloc, use malloc for buffers. If x == shm,
108 use shm for buffers. If x == mmap, use anon mmap.
109 exitall When one thread quits, terminate the others
110 bwavgtime=x Average bandwidth stats over an x msec window.
111 create_serialize=x If 'x', serialize file creation.
112 create_fsync=x If 'x', run fsync() after file creation.
113 end_fsync=x If 'x', run fsync() after end-of-job.
114 loops=x Run the job 'x' number of times.
115 verify=x If 'x' == md5, use md5 for verifies. If 'x' == crc32,
116 use crc32 for verifies. md5 is 'safer', but crc32 is
117 a lot faster. Only makes sense for writing to a file.
118 stonewall Wait for preceeding jobs to end before running.
119 numjobs=x Create 'x' similar entries for this job
120 thread Use pthreads instead of forked jobs
121 zonesize=x
122 zoneskip=y Zone options must be paired. If given, the job
123 will skip y bytes for every x read/written. This
124 can be used to gauge hard drive speed over the entire
125 platter, without reading everything. Both x/y can
126 include k/m/g suffix.
127 iolog=x Open and read io pattern from file 'x'. The file must
128 contain one io action per line in the following format:
129 rw, offset, length
130 where with rw=0/1 for read/write, and the offset
131 and length entries being in bytes.
132 write_iolog=x Write an iolog to file 'x' in the same format as iolog.
133 The iolog options are exclusive, if both given the
134 read iolog will be performed.
135 lockmem=x Lock down x amount of memory on the machine, to
136 simulate a machine with less memory available. x can
137 include k/m/g suffix.
138 nice=x Run job at given nice value.
139 exec_prerun=x Run 'x' before job io is begun.
140 exec_postrun=x Run 'x' after job io has finished.
141 ioscheduler=x Use ioscheduler 'x' for this job.
142
143
144Examples using a job file
145-------------------------
146
147Example 1) Two random readers
148
149Lets say we want to simulate two threads reading randomly from a file
150each. They will be doing IO in 4KiB chunks, using raw (O_DIRECT) IO.
151Since they share most parameters, we'll put those in the [global]
152section. Job 1 will use a 128MiB file, job 2 will use a 256MiB file.
153
154; ---snip---
155
156[global]
157ioengine=sync ; regular read/write(2), the default
158rw=randread
159bs=4k
160direct=1
161
162[file1]
163size=128m
164
165[file2]
166size=256m
167
168; ---snip---
169
170Generally the [] bracketed name specifies a file name, but the "global"
171keyword is reserved for setting options that are inherited by each
172subsequent job description. It's possible to have several [global]
173sections in the job file, each one adds options that are inherited by
174jobs defined below it. The name can also point to a block device, such
175as /dev/sda. To run the above job file, simply do:
176
177$ fio jobfile
178
179Example 2) Many random writers
180
181Say we want to exercise the IO subsystem some more. We'll define 64
182threads doing random buffered writes. We'll let each thread use async io
183with a depth of 4 ios in flight. A job file would then look like this:
184
185; ---snip---
186
187[global]
188ioengine=libaio
189iodepth=4
190rw=randwrite
191bs=32k
192direct=0
193size=64m
194
195[files]
196numjobs=64
197
198; ---snip---
199
200This will create files.[0-63] and perform the random writes to them.
201
202There are endless ways to define jobs, the examples/ directory contains
203a few more examples.
204
205
206Interpreting the output
207-----------------------
208
209fio spits out a lot of output. While running, fio will display the
210status of the jobs created. An example of that would be:
211
212Threads now running: 2 : [ww] [5.73% done]
213
214The characters inside the square brackets denote the current status of
215each thread. The possible values (in typical life cycle order) are:
216
217Idle Run
218---- ---
219P Thread setup, but not started.
220C Thread created.
221I Thread initialized, waiting.
222 R Running, doing sequential reads.
223 r Running, doing random reads.
224 W Running, doing sequential writes.
225 w Running, doing random writes.
226 M Running, doing mixed sequential reads/writes.
227 m Running, doing mixed random reads/writes.
228 F Running, currently waiting for fsync()
229V Running, doing verification of written data.
230E Thread exited, not reaped by main thread yet.
231_ Thread reaped.
232
233The other values are fairly self explanatory - number of threads
234currently running and doing io, and the estimated completion percentage
235and time.
236
237When fio is done (or interrupted by ctrl-c), it will show the data for
238each thread, group of threads, and disks in that order. For each data
239direction, the output looks like:
240
241Client1 (g=0): err= 0:
242 write: io= 32MiB, bw= 666KiB/s, runt= 50320msec
243 slat (msec): min= 0, max= 136, avg= 0.03, dev= 1.92
244 clat (msec): min= 0, max= 631, avg=48.50, dev=86.82
245 bw (KiB/s) : min= 0, max= 1196, per=51.00%, avg=664.02, dev=681.68
246 cpu : usr=1.49%, sys=0.25%, ctx=7969
247
248The client number is printed, along with the group id and error of that
249thread. Below is the io statistics, here for writes. In the order listed,
250they denote:
251
252io= Number of megabytes io performed
253bw= Average bandwidth rate
254runt= The runtime of that thread
255 slat= Submission latency (avg being the average, dev being the
256 standard deviation). This is the time it took to submit
257 the io. For sync io, the slat is really the completion
258 latency, since queue/complete is one operation there.
259 clat= Completion latency. Same names as slat, this denotes the
260 time from submission to completion of the io pieces. For
261 sync io, clat will usually be equal (or very close) to 0,
262 as the time from submit to complete is basically just
263 CPU time (io has already been done, see slat explanation).
264 bw= Bandwidth. Same names as the xlat stats, but also includes
265 an approximate percentage of total aggregate bandwidth
266 this thread received in this group. This last value is
267 only really useful if the threads in this group are on the
268 same disk, since they are then competing for disk access.
269cpu= CPU usage. User and system time, along with the number
270 of context switches this thread went through.
271
272After each client has been listed, the group statistics are printed. They
273will look like this:
274
275Run status group 0 (all jobs):
276 READ: io=64MiB, aggrb=22178, minb=11355, maxb=11814, mint=2840msec, maxt=2955msec
277 WRITE: io=64MiB, aggrb=1302, minb=666, maxb=669, mint=50093msec, maxt=50320msec
278
279For each data direction, it prints:
280
281io= Number of megabytes io performed.
282aggrb= Aggregate bandwidth of threads in this group.
283minb= The minimum average bandwidth a thread saw.
284maxb= The maximum average bandwidth a thread saw.
285mint= The smallest runtime of the threads in that group.
286maxt= The longest runtime of the threads in that group.
287
288And finally, the disk statistics are printed. They will look like this:
289
290Disk stats (read/write):
291 sda: ios=16398/16511, merge=30/162, ticks=6853/819634, in_queue=826487, util=100.00%
292
293Each value is printed for both reads and writes, with reads first. The
294numbers denote:
295
296ios= Number of ios performed by all groups.
297merge= Number of merges io the io scheduler.
298ticks= Number of ticks we kept the disk busy.
299io_queue= Total time spent in the disk queue.
300util= The disk utilization. A value of 100% means we kept the disk
301 busy constantly, 50% would be a disk idling half of the time.
302
303
304Author
305------
306
307Fio was written by Jens Axboe <axboe@suse.de> to enable flexible testing
308of the Linux IO subsystem and schedulers. He got tired of writing
309specific test applications to simulate a given workload, and found that
310the existing io benchmark/test tools out there weren't flexible enough
311to do what he wanted.
312
313Jens Axboe <axboe@suse.de> 20060609
314