| 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://git.kernel.dk/fio.git |
| 18 | |
| 19 | If you are inside a corporate firewall, git:// may not always work for |
| 20 | you. In that case you can use the http protocol, path is the same: |
| 21 | |
| 22 | http://git.kernel.dk/fio.git |
| 23 | |
| 24 | Snapshots are frequently generated and they include the git meta data as |
| 25 | well. You can download them here: |
| 26 | |
| 27 | http://brick.kernel.dk/snaps/ |
| 28 | |
| 29 | |
| 30 | Binary packages |
| 31 | --------------- |
| 32 | |
| 33 | Debian: |
| 34 | Starting with Debian "Squeeze", fio packages are part of the official |
| 35 | Debian repository. http://packages.debian.org/search?keywords=fio |
| 36 | |
| 37 | Ubuntu: |
| 38 | Starting with Ubuntu 10.04 LTS (aka "Lucid Lynx"), fio packages are part |
| 39 | of the Ubuntu "universe" repository. |
| 40 | http://packages.ubuntu.com/search?keywords=fio |
| 41 | |
| 42 | SUSE: |
| 43 | Pascal Bleser <guru@unixtech.be> has fio RPMs in his repository for SUSE |
| 44 | variants, you can find them here: |
| 45 | http://linux01.gwdg.de/~pbleser/rpm-navigation.php?cat=System/fio |
| 46 | |
| 47 | Red Hat, CentOS & Co: |
| 48 | Dag Wieƫrs has RPMs for Red Hat related distros, find them here: |
| 49 | http://dag.wieers.com/rpm/packages/fio/ |
| 50 | |
| 51 | Mandriva: |
| 52 | Mandriva has integrated fio into their package repository, so installing |
| 53 | on that distro should be as easy as typing 'urpmi fio'. |
| 54 | |
| 55 | Solaris: |
| 56 | Packages for Solaris are available from OpenCSW. Install their pkgutil |
| 57 | tool (http://www.opencsw.org/get-it/pkgutil/) and then install fio via |
| 58 | 'pkgutil -i fio'. |
| 59 | |
| 60 | Windows: |
| 61 | Bruce Cran <bruce@cran.org.uk> has fio packages for Windows at |
| 62 | http://www.bluestop.org/fio . |
| 63 | |
| 64 | |
| 65 | Mailing list |
| 66 | ------------ |
| 67 | |
| 68 | There's a mailing list associated with fio. It's meant for general |
| 69 | discussion, bug reporting, questions, and development - basically anything |
| 70 | that has to do with fio. An automated mail detailing recent commits is |
| 71 | automatically sent to the list at most daily. The list address is |
| 72 | fio@vger.kernel.org, subscribe by sending an email to |
| 73 | majordomo@vger.kernel.org with |
| 74 | |
| 75 | subscribe fio |
| 76 | |
| 77 | in the body of the email. Archives can be found here: |
| 78 | |
| 79 | http://www.spinics.net/lists/fio/ |
| 80 | |
| 81 | and archives for the old list can be found here: |
| 82 | |
| 83 | http://maillist.kernel.dk/fio-devel/ |
| 84 | |
| 85 | |
| 86 | Building |
| 87 | -------- |
| 88 | |
| 89 | Just type 'make' and 'make install'. |
| 90 | |
| 91 | Note that GNU make is required. On BSD it's available from devel/gmake; |
| 92 | on Solaris it's in the SUNWgmake package. On platforms where GNU make |
| 93 | isn't the default, type 'gmake' instead of 'make'. |
| 94 | |
| 95 | If your compile fails with an error like this: |
| 96 | |
| 97 | CC gettime.o |
| 98 | In file included from fio.h:23, |
| 99 | from gettime.c:8: |
| 100 | os/os.h:15:20: error: libaio.h: No such file or directory |
| 101 | In file included from gettime.c:8: |
| 102 | fio.h:119: error: field 'iocb' has incomplete type |
| 103 | make: *** [gettime.o] Error 1 |
| 104 | |
| 105 | Check that you have the libaio development package installed. On RPM |
| 106 | based distros, it's typically called libaio-devel. |
| 107 | |
| 108 | |
| 109 | Windows |
| 110 | ------- |
| 111 | |
| 112 | On Windows MinGW (http://www.mingw.org/) is required in order to |
| 113 | build fio. To create an MSI installer package install WiX 3.6 from |
| 114 | http://wix.sourceforge.net/releases/ and run dobuild.cmd from the |
| 115 | os/windows directory. |
| 116 | |
| 117 | |
| 118 | Command line |
| 119 | ------------ |
| 120 | |
| 121 | $ fio |
| 122 | --debug Enable some debugging options (see below) |
| 123 | --output Write output to file |
| 124 | --runtime Runtime in seconds |
| 125 | --latency-log Generate per-job latency logs |
| 126 | --bandwidth-log Generate per-job bandwidth logs |
| 127 | --minimal Minimal (terse) output |
| 128 | --output-format=type Output format (terse,json,normal) |
| 129 | --terse-version=type Terse version output format (default 3, or 2 or 4). |
| 130 | --version Print version info and exit |
| 131 | --help Print this page |
| 132 | --cpuclock-test Perform test/validation of CPU clock |
| 133 | --cmdhelp=cmd Print command help, "all" for all of them |
| 134 | --enghelp=engine Print ioengine help, or list available ioengines |
| 135 | --enghelp=engine,cmd Print help for an ioengine cmd |
| 136 | --showcmd Turn a job file into command line options |
| 137 | --readonly Turn on safety read-only checks, preventing |
| 138 | writes |
| 139 | --eta=when When ETA estimate should be printed |
| 140 | May be "always", "never" or "auto" |
| 141 | --section=name Only run specified section in job file. |
| 142 | Multiple sections can be specified. |
| 143 | --alloc-size=kb Set smalloc pool to this size in kb (def 1024) |
| 144 | --warnings-fatal Fio parser warnings are fatal |
| 145 | --max-jobs Maximum number of threads/processes to support |
| 146 | --server=args Start backend server. See Client/Server section. |
| 147 | --client=host Connect to specified backend. |
| 148 | --idle-prof=option Report cpu idleness on a system or percpu basis |
| 149 | (option=system,percpu) or run unit work |
| 150 | calibration only (option=calibrate). |
| 151 | |
| 152 | |
| 153 | Any parameters following the options will be assumed to be job files, |
| 154 | unless they match a job file parameter. You can add as many as you want, |
| 155 | each job file will be regarded as a separate group and fio will stonewall |
| 156 | its execution. |
| 157 | |
| 158 | The --readonly switch is an extra safety guard to prevent accidentally |
| 159 | turning on a write setting when that is not desired. Fio will only write |
| 160 | if rw=write/randwrite/rw/randrw is given, but this extra safety net can |
| 161 | be used as an extra precaution. It will also enable a write check in the |
| 162 | io engine core to prevent an accidental write due to a fio bug. |
| 163 | |
| 164 | The debug switch allows adding options that trigger certain logging |
| 165 | options in fio. Currently the options are: |
| 166 | |
| 167 | process Dump info related to processes |
| 168 | file Dump info related to file actions |
| 169 | io Dump info related to IO queuing |
| 170 | mem Dump info related to memory allocations |
| 171 | blktrace Dump info related to blktrace setup |
| 172 | verify Dump info related to IO verification |
| 173 | all Enable all debug options |
| 174 | random Dump info related to random offset generation |
| 175 | parse Dump info related to option matching and parsing |
| 176 | diskutil Dump info related to disk utilization updates |
| 177 | job:x Dump info only related to job number x |
| 178 | mutex Dump info only related to mutex up/down ops |
| 179 | profile Dump info related to profile extensions |
| 180 | time Dump info related to internal time keeping |
| 181 | ? or help Show available debug options. |
| 182 | |
| 183 | You can specify as many as you want, eg --debug=file,mem will enable |
| 184 | file and memory debugging. |
| 185 | |
| 186 | The section switch is meant to make it easier to ship a bigger job file |
| 187 | instead of several smaller ones. Say you define a job file with light, |
| 188 | moderate, and heavy parts. Then you can ask fio to run the given part |
| 189 | only by giving it a --section=heavy command line option. The section |
| 190 | option only applies to job sections, the reserved 'global' section is |
| 191 | always parsed and taken into account. |
| 192 | |
| 193 | Fio has an internal allocator for shared memory called smalloc. It |
| 194 | allocates shared structures from this pool. The pool defaults to 1024k |
| 195 | in size, and can grow to 128 pools. If running large jobs with randommap |
| 196 | enabled it can run out of memory, in which case the --alloc-size switch |
| 197 | is handy for starting with a larger pool size. The backing store is |
| 198 | files in /tmp. Fio cleans up after itself, while it is running you |
| 199 | may see .fio_smalloc.* files in /tmp. |
| 200 | |
| 201 | |
| 202 | Job file |
| 203 | -------- |
| 204 | |
| 205 | See the HOWTO file for a more detailed description of parameters and what |
| 206 | they mean. This file contains the terse version. You can describe big and |
| 207 | complex setups with the command line, but generally it's a lot easier to |
| 208 | just write a simple job file to describe the workload. The job file format |
| 209 | is in the ini style format, as that is easy to read and write for the user. |
| 210 | |
| 211 | The job file parameters are: |
| 212 | |
| 213 | name=x Use 'x' as the identifier for this job. |
| 214 | description=x 'x' is a text description of the job. |
| 215 | directory=x Use 'x' as the top level directory for storing files |
| 216 | filename=x Force the use of 'x' as the filename for all files |
| 217 | in this thread. If not given, fio will make up |
| 218 | a suitable filename based on the thread and file |
| 219 | number. |
| 220 | rw=x 'x' may be: read, randread, write, randwrite, |
| 221 | rw (read-write mix), randrw (read-write random mix) |
| 222 | rwmixcycle=x Base cycle for switching between read and write |
| 223 | in msecs. |
| 224 | rwmixread=x 'x' percentage of rw mix ios will be reads. If |
| 225 | rwmixwrite is also given, the last of the two will |
| 226 | be used if they don't add up to 100%. |
| 227 | rwmixwrite=x 'x' percentage of rw mix ios will be writes. See |
| 228 | rwmixread. |
| 229 | rand_repeatable=x The sequence of random io blocks can be repeatable |
| 230 | across runs, if 'x' is 1. |
| 231 | size=x Set file size to x bytes (x string can include k/m/g) |
| 232 | ioengine=x 'x' may be: aio/libaio/linuxaio for Linux aio, |
| 233 | posixaio for POSIX aio, solarisaio for Solaris |
| 234 | native async IO, windowsaio for Windows native async IO, |
| 235 | sync for regular read/write io, |
| 236 | psync for regular pread/pwrite io, vsync for regular |
| 237 | readv/writev (with queuing emulation) mmap for mmap'ed |
| 238 | io, syslet-rw for syslet driven read/write, splice for |
| 239 | using splice/vmsplice, sg for direct SG_IO io, net |
| 240 | for network io, rdma for RDMA io, or cpuio for a |
| 241 | cycler burner load. sg only works on Linux on |
| 242 | SCSI (or SCSI-like devices, such as usb-storage or |
| 243 | sata/libata driven) devices. Fio also has a null |
| 244 | io engine, which is mainly used for testing |
| 245 | fio itself. |
| 246 | |
| 247 | iodepth=x For async io, allow 'x' ios in flight |
| 248 | overwrite=x If 'x', layout a write file first. |
| 249 | nrfiles=x Spread io load over 'x' number of files per job, |
| 250 | if possible. |
| 251 | prio=x Run io at prio X, 0-7 is the kernel allowed range |
| 252 | prioclass=x Run io at prio class X |
| 253 | bs=x Use 'x' for thread blocksize. May include k/m postfix. |
| 254 | bsrange=x-y Mix thread block sizes randomly between x and y. May |
| 255 | also include k/m postfix. |
| 256 | direct=x 1 for direct IO, 0 for buffered IO |
| 257 | thinktime=x "Think" x usec after each io |
| 258 | rate=x Throttle rate to x KB/sec |
| 259 | ratemin=x Quit if rate of x KB/sec can't be met |
| 260 | ratecycle=x ratemin averaged over x msecs |
| 261 | cpumask=x Only allow job to run on CPUs defined by mask. |
| 262 | cpus_allowed=x Like 'cpumask', but allow text setting of CPU affinity. |
| 263 | numa_cpu_nodes=x,y-z Allow job to run on specified NUMA nodes' CPU. |
| 264 | numa_mem_policy=m:x,y-z Setup numa memory allocation policy. |
| 265 | 'm' stands for policy, such as local, interleave, |
| 266 | bind, prefer, local. 'x, y-z' are numa node(s) for |
| 267 | memory allocation according to policy. |
| 268 | fsync=x If writing with buffered IO, fsync after every |
| 269 | 'x' blocks have been written. |
| 270 | end_fsync=x If 'x', run fsync() after end-of-job. |
| 271 | startdelay=x Start this thread x seconds after startup |
| 272 | runtime=x Terminate x seconds after startup. Can include a |
| 273 | normal time suffix if not given in seconds, such as |
| 274 | 'm' for minutes, 'h' for hours, and 'd' for days. |
| 275 | offset=x Start io at offset x (x string can include k/m/g) |
| 276 | invalidate=x Invalidate page cache for file prior to doing io |
| 277 | sync=x Use sync writes if x and writing buffered IO. |
| 278 | mem=x If x == malloc, use malloc for buffers. If x == shm, |
| 279 | use shared memory for buffers. If x == mmap, use |
| 280 | anonymous mmap. |
| 281 | exitall When one thread quits, terminate the others |
| 282 | bwavgtime=x Average bandwidth stats over an x msec window. |
| 283 | create_serialize=x If 'x', serialize file creation. |
| 284 | create_fsync=x If 'x', run fsync() after file creation. |
| 285 | unlink If set, unlink files when done. |
| 286 | loops=x Run the job 'x' number of times. |
| 287 | verify=x If 'x' == md5, use md5 for verifies. If 'x' == crc32, |
| 288 | use crc32 for verifies. md5 is 'safer', but crc32 is |
| 289 | a lot faster. Only makes sense for writing to a file. |
| 290 | For other types of checksumming, see HOWTO. |
| 291 | stonewall Wait for preceeding jobs to end before running. |
| 292 | numjobs=x Create 'x' similar entries for this job |
| 293 | thread Use pthreads instead of forked jobs |
| 294 | zonesize=x |
| 295 | zoneskip=y Zone options must be paired. If given, the job |
| 296 | will skip y bytes for every x read/written. This |
| 297 | can be used to gauge hard drive speed over the entire |
| 298 | platter, without reading everything. Both x/y can |
| 299 | include k/m/g suffix. |
| 300 | read_iolog=x Open and read io pattern from file 'x'. The file format |
| 301 | is described in the HOWTO. |
| 302 | write_iolog=x Write an iolog to file 'x' in the same format as iolog. |
| 303 | The iolog options are exclusive, if both given the |
| 304 | read iolog will be performed. Specify a separate file |
| 305 | for each job, otherwise the iologs will be interspersed |
| 306 | and the file may be corrupt. |
| 307 | write_bw_log Write a bandwidth log. |
| 308 | write_lat_log Write a latency log. |
| 309 | lockmem=x Lock down x amount of memory on the machine, to |
| 310 | simulate a machine with less memory available. x can |
| 311 | include k/m/g suffix. |
| 312 | nice=x Run job at given nice value. |
| 313 | exec_prerun=x Run 'x' before job io is begun. |
| 314 | exec_postrun=x Run 'x' after job io has finished. |
| 315 | ioscheduler=x Use ioscheduler 'x' for this job. |
| 316 | cpuload=x For a CPU io thread, percentage of CPU time to attempt |
| 317 | to burn. |
| 318 | cpuchunks=x Split burn cycles into pieces of x usecs. |
| 319 | |
| 320 | |
| 321 | |
| 322 | Client/server |
| 323 | ------------ |
| 324 | |
| 325 | Normally you would run fio as a stand-alone application on the machine |
| 326 | where the IO workload should be generated. However, it is also possible to |
| 327 | run the frontend and backend of fio separately. This makes it possible to |
| 328 | have a fio server running on the machine(s) where the IO workload should |
| 329 | be running, while controlling it from another machine. |
| 330 | |
| 331 | To start the server, you would do: |
| 332 | |
| 333 | fio --server=args |
| 334 | |
| 335 | on that machine, where args defines what fio listens to. The arguments |
| 336 | are of the form 'type,hostname or IP,port'. 'type' is either 'ip' (or ip4) |
| 337 | for TCP/IP v4, 'ip6' for TCP/IP v6, or 'sock' for a local unix domain socket. |
| 338 | 'hostname' is either a hostname or IP address, and 'port' is the port to |
| 339 | listen to (only valid for TCP/IP, not a local socket). Some examples: |
| 340 | |
| 341 | 1) fio --server |
| 342 | |
| 343 | Start a fio server, listening on all interfaces on the default port (8765). |
| 344 | |
| 345 | 2) fio --server=ip:hostname,4444 |
| 346 | |
| 347 | Start a fio server, listening on IP belonging to hostname and on port 4444. |
| 348 | |
| 349 | 3) fio --server=ip6:::1,4444 |
| 350 | |
| 351 | Start a fio server, listening on IPv6 localhost ::1 and on port 4444. |
| 352 | |
| 353 | 4) fio --server=,4444 |
| 354 | |
| 355 | Start a fio server, listening on all interfaces on port 4444. |
| 356 | |
| 357 | 5) fio --server=1.2.3.4 |
| 358 | |
| 359 | Start a fio server, listening on IP 1.2.3.4 on the default port. |
| 360 | |
| 361 | 6) fio --server=sock:/tmp/fio.sock |
| 362 | |
| 363 | Start a fio server, listening on the local socket /tmp/fio.sock. |
| 364 | |
| 365 | When a server is running, you can connect to it from a client. The client |
| 366 | is run with: |
| 367 | |
| 368 | fio --local-args --client=server --remote-args <job file(s)> |
| 369 | |
| 370 | where --local-args are arguments that are local to the client where it is |
| 371 | running, 'server' is the connect string, and --remote-args and <job file(s)> |
| 372 | are sent to the server. The 'server' string follows the same format as it |
| 373 | does on the server side, to allow IP/hostname/socket and port strings. |
| 374 | You can connect to multiple clients as well, to do that you could run: |
| 375 | |
| 376 | fio --client=server2 <job file(s)> --client=server2 <job file(s)> |
| 377 | |
| 378 | |
| 379 | Platforms |
| 380 | --------- |
| 381 | |
| 382 | Fio works on (at least) Linux, Solaris, AIX, HP-UX, OSX, NetBSD, Windows |
| 383 | and FreeBSD. Some features and/or options may only be available on some of |
| 384 | the platforms, typically because those features only apply to that platform |
| 385 | (like the solarisaio engine, or the splice engine on Linux). |
| 386 | |
| 387 | Some features are not available on FreeBSD/Solaris even if they could be |
| 388 | implemented, I'd be happy to take patches for that. An example of that is |
| 389 | disk utility statistics and (I think) huge page support, support for that |
| 390 | does exist in FreeBSD/Solaris. |
| 391 | |
| 392 | Fio uses pthread mutexes for signalling and locking and FreeBSD does not |
| 393 | support process shared pthread mutexes. As a result, only threads are |
| 394 | supported on FreeBSD. This could be fixed with sysv ipc locking or |
| 395 | other locking alternatives. |
| 396 | |
| 397 | Other *BSD platforms are untested, but fio should work there almost out |
| 398 | of the box. Since I don't do test runs or even compiles on those platforms, |
| 399 | your mileage may vary. Sending me patches for other platforms is greatly |
| 400 | appreciated. There's a lot of value in having the same test/benchmark tool |
| 401 | available on all platforms. |
| 402 | |
| 403 | Note that POSIX aio is not enabled by default on AIX. If you get messages like: |
| 404 | |
| 405 | Symbol resolution failed for /usr/lib/libc.a(posix_aio.o) because: |
| 406 | Symbol _posix_kaio_rdwr (number 2) is not exported from dependent module /unix. |
| 407 | |
| 408 | you need to enable POSIX aio. Run the following commands as root: |
| 409 | |
| 410 | # lsdev -C -l posix_aio0 |
| 411 | posix_aio0 Defined Posix Asynchronous I/O |
| 412 | # cfgmgr -l posix_aio0 |
| 413 | # lsdev -C -l posix_aio0 |
| 414 | posix_aio0 Available Posix Asynchronous I/O |
| 415 | |
| 416 | POSIX aio should work now. To make the change permanent: |
| 417 | |
| 418 | # chdev -l posix_aio0 -P -a autoconfig='available' |
| 419 | posix_aio0 changed |
| 420 | |
| 421 | |
| 422 | Author |
| 423 | ------ |
| 424 | |
| 425 | Fio was written by Jens Axboe <axboe@kernel.dk> to enable flexible testing |
| 426 | of the Linux IO subsystem and schedulers. He got tired of writing |
| 427 | specific test applications to simulate a given workload, and found that |
| 428 | the existing io benchmark/test tools out there weren't flexible enough |
| 429 | to do what he wanted. |
| 430 | |
| 431 | Jens Axboe <axboe@kernel.dk> 20060905 |
| 432 | |