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