-
Notifications
You must be signed in to change notification settings - Fork 0
/
HOWTO
2362 lines (1889 loc) · 98.2 KB
/
HOWTO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Table of contents
-----------------
1. Overview
2. How fio works
3. Running fio
4. Job file format
5. Detailed list of parameters
6. Normal output
7. Terse output
8. Trace file format
9. CPU idleness profiling
10. Verification and triggers
11. Log File Formats
1.0 Overview and history
------------------------
fio was originally written to save me the hassle of writing special test
case programs when I wanted to test a specific workload, either for
performance reasons or to find/reproduce a bug. The process of writing
such a test app can be tiresome, especially if you have to do it often.
Hence I needed a tool that would be able to simulate a given io workload
without resorting to writing a tailored test case again and again.
A test work load is difficult to define, though. There can be any number
of processes or threads involved, and they can each be using their own
way of generating io. You could have someone dirtying large amounts of
memory in an memory mapped file, or maybe several threads issuing
reads using asynchronous io. fio needed to be flexible enough to
simulate both of these cases, and many more.
2.0 How fio works
-----------------
The first step in getting fio to simulate a desired io workload, is
writing a job file describing that specific setup. A job file may contain
any number of threads and/or files - the typical contents of the job file
is a global section defining shared parameters, and one or more job
sections describing the jobs involved. When run, fio parses this file
and sets everything up as described. If we break down a job from top to
bottom, it contains the following basic parameters:
IO type Defines the io pattern issued to the file(s).
We may only be reading sequentially from this
file(s), or we may be writing randomly. Or even
mixing reads and writes, sequentially or randomly.
Block size In how large chunks are we issuing io? This may be
a single value, or it may describe a range of
block sizes.
IO size How much data are we going to be reading/writing.
IO engine How do we issue io? We could be memory mapping the
file, we could be using regular read/write, we
could be using splice, async io, or even SG
(SCSI generic sg).
IO depth If the io engine is async, how large a queuing
depth do we want to maintain?
IO type Should we be doing buffered io, or direct/raw io?
Num files How many files are we spreading the workload over.
Num threads How many threads or processes should we spread
this workload over.
The above are the basic parameters defined for a workload, in addition
there's a multitude of parameters that modify other aspects of how this
job behaves.
3.0 Running fio
---------------
See the README file for command line parameters, there are only a few
of them.
Running fio is normally the easiest part - you just give it the job file
(or job files) as parameters:
$ fio job_file
and it will start doing what the job_file tells it to do. You can give
more than one job file on the command line, fio will serialize the running
of those files. Internally that is the same as using the 'stonewall'
parameter described in the parameter section.
If the job file contains only one job, you may as well just give the
parameters on the command line. The command line parameters are identical
to the job parameters, with a few extra that control global parameters
(see README). For example, for the job file parameter iodepth=2, the
mirror command line option would be --iodepth 2 or --iodepth=2. You can
also use the command line for giving more than one job entry. For each
--name option that fio sees, it will start a new job with that name.
Command line entries following a --name entry will apply to that job,
until there are no more entries or a new --name entry is seen. This is
similar to the job file options, where each option applies to the current
job until a new [] job entry is seen.
fio does not need to run as root, except if the files or devices specified
in the job section requires that. Some other options may also be restricted,
such as memory locking, io scheduler switching, and decreasing the nice value.
4.0 Job file format
-------------------
As previously described, fio accepts one or more job files describing
what it is supposed to do. The job file format is the classic ini file,
where the names enclosed in [] brackets define the job name. You are free
to use any ascii name you want, except 'global' which has special meaning.
A global section sets defaults for the jobs described in that file. A job
may override a global section parameter, and a job file may even have
several global sections if so desired. A job is only affected by a global
section residing above it. If the first character in a line is a ';' or a
'#', the entire line is discarded as a comment.
So let's look at a really simple job file that defines two processes, each
randomly reading from a 128MB file.
; -- start job file --
[global]
rw=randread
size=128m
[job1]
[job2]
; -- end job file --
As you can see, the job file sections themselves are empty as all the
described parameters are shared. As no filename= option is given, fio
makes up a filename for each of the jobs as it sees fit. On the command
line, this job would look as follows:
$ fio --name=global --rw=randread --size=128m --name=job1 --name=job2
Let's look at an example that has a number of processes writing randomly
to files.
; -- start job file --
[random-writers]
ioengine=libaio
iodepth=4
rw=randwrite
bs=32k
direct=0
size=64m
numjobs=4
; -- end job file --
Here we have no global section, as we only have one job defined anyway.
We want to use async io here, with a depth of 4 for each file. We also
increased the buffer size used to 32KB and define numjobs to 4 to
fork 4 identical jobs. The result is 4 processes each randomly writing
to their own 64MB file. Instead of using the above job file, you could
have given the parameters on the command line. For this case, you would
specify:
$ fio --name=random-writers --ioengine=libaio --iodepth=4 --rw=randwrite --bs=32k --direct=0 --size=64m --numjobs=4
When fio is utilized as a basis of any reasonably large test suite, it might be
desirable to share a set of standardized settings across multiple job files.
Instead of copy/pasting such settings, any section may pull in an external
.fio file with 'include filename' directive, as in the following example:
; -- start job file including.fio --
[global]
filename=/tmp/test
filesize=1m
include glob-include.fio
[test]
rw=randread
bs=4k
time_based=1
runtime=10
include test-include.fio
; -- end job file including.fio --
; -- start job file glob-include.fio --
thread=1
group_reporting=1
; -- end job file glob-include.fio --
; -- start job file test-include.fio --
ioengine=libaio
iodepth=4
; -- end job file test-include.fio --
Settings pulled into a section apply to that section only (except global
section). Include directives may be nested in that any included file may
contain further include directive(s). Include files may not contain []
sections.
4.1 Environment variables
-------------------------
fio also supports environment variable expansion in job files. Any
sub-string of the form "${VARNAME}" as part of an option value (in other
words, on the right of the `='), will be expanded to the value of the
environment variable called VARNAME. If no such environment variable
is defined, or VARNAME is the empty string, the empty string will be
substituted.
As an example, let's look at a sample fio invocation and job file:
$ SIZE=64m NUMJOBS=4 fio jobfile.fio
; -- start job file --
[random-writers]
rw=randwrite
size=${SIZE}
numjobs=${NUMJOBS}
; -- end job file --
This will expand to the following equivalent job file at runtime:
; -- start job file --
[random-writers]
rw=randwrite
size=64m
numjobs=4
; -- end job file --
fio ships with a few example job files, you can also look there for
inspiration.
4.2 Reserved keywords
---------------------
Additionally, fio has a set of reserved keywords that will be replaced
internally with the appropriate value. Those keywords are:
$pagesize The architecture page size of the running system
$mb_memory Megabytes of total memory in the system
$ncpus Number of online available CPUs
These can be used on the command line or in the job file, and will be
automatically substituted with the current system values when the job
is run. Simple math is also supported on these keywords, so you can
perform actions like:
size=8*$mb_memory
and get that properly expanded to 8 times the size of memory in the
machine.
5.0 Detailed list of parameters
-------------------------------
This section describes in details each parameter associated with a job.
Some parameters take an option of a given type, such as an integer or
a string. Anywhere a numeric value is required, an arithmetic expression
may be used, provided it is surrounded by parentheses. Supported operators
are:
addition (+)
subtraction (-)
multiplication (*)
division (/)
modulus (%)
exponentiation (^)
For time values in expressions, units are microseconds by default. This is
different than for time values not in expressions (not enclosed in
parentheses). The following types are used:
str String. This is a sequence of alpha characters.
time Integer with possible time suffix. In seconds unless otherwise
specified, use eg 10m for 10 minutes. Accepts s/m/h for seconds,
minutes, and hours, and accepts 'ms' (or 'msec') for milliseconds,
and 'us' (or 'usec') for microseconds.
int SI integer. A whole number value, which may contain a suffix
describing the base of the number. Accepted suffixes are k/m/g/t/p,
meaning kilo, mega, giga, tera, and peta. The suffix is not case
sensitive, and you may also include trailing 'b' (eg 'kb' is the same
as 'k'). So if you want to specify 4096, you could either write
out '4096' or just give 4k. The suffixes signify base 2 values, so
1024 is 1k and 1024k is 1m and so on, unless the suffix is explicitly
set to a base 10 value using 'kib', 'mib', 'gib', etc. If that is the
case, then 1000 is used as the multiplier. This can be handy for
disks, since manufacturers generally use base 10 values when listing
the capacity of a drive. If the option accepts an upper and lower
range, use a colon ':' or minus '-' to separate such values. May also
include a prefix to indicate numbers base. If 0x is used, the number
is assumed to be hexadecimal. See irange.
bool Boolean. Usually parsed as an integer, however only defined for
true and false (1 and 0).
irange Integer range with suffix. Allows value range to be given, such
as 1024-4096. A colon may also be used as the separator, eg
1k:4k. If the option allows two sets of ranges, they can be
specified with a ',' or '/' delimiter: 1k-4k/8k-32k. Also see
int.
float_list A list of floating numbers, separated by a ':' character.
With the above in mind, here follows the complete list of fio job
parameters.
name=str ASCII name of the job. This may be used to override the
name printed by fio for this job. Otherwise the job
name is used. On the command line this parameter has the
special purpose of also signaling the start of a new
job.
wait_for=str Specifies the name of the already defined job to wait
for. Single waitee name only may be specified. If set, the job
won't be started until all workers of the waitee job are done.
Wait_for operates on the job name basis, so there are a few
limitations. First, the waitee must be defined prior to the
waiter job (meaning no forward references). Second, if a job
is being referenced as a waitee, it must have a unique name
(no duplicate waitees).
description=str Text description of the job. Doesn't do anything except
dump this text description when this job is run. It's
not parsed.
directory=str Prefix filenames with this directory. Used to place files
in a different location than "./". See the 'filename' option
for escaping certain characters.
filename=str Fio normally makes up a filename based on the job name,
thread number, and file number. If you want to share
files between threads in a job or several jobs, specify
a filename for each of them to override the default.
If the ioengine is file based, you can specify a number of
files by separating the names with a ':' colon. So if you
wanted a job to open /dev/sda and /dev/sdb as the two working
files, you would use filename=/dev/sda:/dev/sdb. On Windows,
disk devices are accessed as \\.\PhysicalDrive0 for the first
device, \\.\PhysicalDrive1 for the second etc. Note: Windows
and FreeBSD prevent write access to areas of the disk
containing in-use data (e.g. filesystems).
If the wanted filename does need to include a colon, then
escape that with a '\' character. For instance, if the filename
is "/dev/dsk/foo@3,0:c", then you would use
filename="/dev/dsk/foo@3,0\:c". '-' is a reserved name, meaning
stdin or stdout. Which of the two depends on the read/write
direction set.
filename_format=str
If sharing multiple files between jobs, it is usually necessary
to have fio generate the exact names that you want. By default,
fio will name a file based on the default file format
specification of jobname.jobnumber.filenumber. With this
option, that can be customized. Fio will recognize and replace
the following keywords in this string:
$jobname
The name of the worker thread or process.
$jobnum
The incremental number of the worker thread or
process.
$filenum
The incremental number of the file for that worker
thread or process.
To have dependent jobs share a set of files, this option can
be set to have fio generate filenames that are shared between
the two. For instance, if testfiles.$filenum is specified,
file number 4 for any job will be named testfiles.4. The
default of $jobname.$jobnum.$filenum will be used if
no other format specifier is given.
unique_filename=bool To avoid collisions between networked clients, fio
defaults to prefixing any generated filenames (with a directory
specified) with the source of the client connecting. To disable
this behavior, set this option to 0.
opendir=str Tell fio to recursively add any file it can find in this
directory and down the file system tree.
lockfile=str Fio defaults to not locking any files before it does
IO to them. If a file or file descriptor is shared, fio
can serialize IO to that file to make the end result
consistent. This is usual for emulating real workloads that
share files. The lock modes are:
none No locking. The default.
exclusive Only one thread/process may do IO,
excluding all others.
readwrite Read-write locking on the file. Many
readers may access the file at the
same time, but writes get exclusive
access.
readwrite=str
rw=str Type of io pattern. Accepted values are:
read Sequential reads
write Sequential writes
randwrite Random writes
randread Random reads
rw,readwrite Sequential mixed reads and writes
randrw Random mixed reads and writes
trimwrite Mixed trims and writes. Blocks will be
trimmed first, then written to.
Fio defaults to read if the option is not specified.
For the mixed io types, the default is to split them 50/50.
For certain types of io the result may still be skewed a bit,
since the speed may be different. It is possible to specify
a number of IO's to do before getting a new offset, this is
done by appending a ':<nr>' to the end of the string given.
For a random read, it would look like 'rw=randread:8' for
passing in an offset modifier with a value of 8. If the
suffix is used with a sequential IO pattern, then the value
specified will be added to the generated offset for each IO.
For instance, using rw=write:4k will skip 4k for every
write. It turns sequential IO into sequential IO with holes.
See the 'rw_sequencer' option.
rw_sequencer=str If an offset modifier is given by appending a number to
the rw=<str> line, then this option controls how that
number modifies the IO offset being generated. Accepted
values are:
sequential Generate sequential offset
identical Generate the same offset
'sequential' is only useful for random IO, where fio would
normally generate a new random offset for every IO. If you
append eg 8 to randread, you would get a new random offset for
every 8 IO's. The result would be a seek for only every 8
IO's, instead of for every IO. Use rw=randread:8 to specify
that. As sequential IO is already sequential, setting
'sequential' for that would not result in any differences.
'identical' behaves in a similar fashion, except it sends
the same offset 8 number of times before generating a new
offset.
kb_base=int The base unit for a kilobyte. The defacto base is 2^10, 1024.
Storage manufacturers like to use 10^3 or 1000 as a base
ten unit instead, for obvious reasons. Allow values are
1024 or 1000, with 1024 being the default.
unified_rw_reporting=bool Fio normally reports statistics on a per
data direction basis, meaning that read, write, and trim are
accounted and reported separately. If this option is set,
the fio will sum the results and report them as "mixed"
instead.
randrepeat=bool For random IO workloads, seed the generator in a predictable
way so that results are repeatable across repetitions.
Defaults to true.
randseed=int Seed the random number generators based on this seed value, to
be able to control what sequence of output is being generated.
If not set, the random sequence depends on the randrepeat
setting.
fallocate=str Whether pre-allocation is performed when laying down files.
Accepted values are:
none Do not pre-allocate space
posix Pre-allocate via posix_fallocate()
keep Pre-allocate via fallocate() with
FALLOC_FL_KEEP_SIZE set
0 Backward-compatible alias for 'none'
1 Backward-compatible alias for 'posix'
May not be available on all supported platforms. 'keep' is only
available on Linux.If using ZFS on Solaris this must be set to
'none' because ZFS doesn't support it. Default: 'posix'.
fadvise_hint=bool By default, fio will use fadvise() to advise the kernel
on what IO patterns it is likely to issue. Sometimes you
want to test specific IO patterns without telling the
kernel about it, in which case you can disable this option.
If set, fio will use POSIX_FADV_SEQUENTIAL for sequential
IO and POSIX_FADV_RANDOM for random IO.
fadvise_stream=int Notify the kernel what write stream ID to place these
writes under. Only supported on Linux. Note, this option
may change going forward.
size=int The total size of file io for this job. Fio will run until
this many bytes has been transferred, unless runtime is
limited by other options (such as 'runtime', for instance,
or increased/decreased by 'io_size'). Unless specific nrfiles
and filesize options are given, fio will divide this size
between the available files specified by the job. If not set,
fio will use the full size of the given files or devices.
If the files do not exist, size must be given. It is also
possible to give size as a percentage between 1 and 100. If
size=20% is given, fio will use 20% of the full size of the
given files or devices.
io_size=int
io_limit=int Normally fio operates within the region set by 'size', which
means that the 'size' option sets both the region and size of
IO to be performed. Sometimes that is not what you want. With
this option, it is possible to define just the amount of IO
that fio should do. For instance, if 'size' is set to 20G and
'io_size' is set to 5G, fio will perform IO within the first
20G but exit when 5G have been done. The opposite is also
possible - if 'size' is set to 20G, and 'io_size' is set to
40G, then fio will do 40G of IO within the 0..20G region.
filesize=int Individual file sizes. May be a range, in which case fio
will select sizes for files at random within the given range
and limited to 'size' in total (if that is given). If not
given, each created file is the same size.
file_append=bool Perform IO after the end of the file. Normally fio will
operate within the size of a file. If this option is set, then
fio will append to the file instead. This has identical
behavior to setting offset to the size of a file. This option
is ignored on non-regular files.
fill_device=bool
fill_fs=bool Sets size to something really large and waits for ENOSPC (no
space left on device) as the terminating condition. Only makes
sense with sequential write. For a read workload, the mount
point will be filled first then IO started on the result. This
option doesn't make sense if operating on a raw device node,
since the size of that is already known by the file system.
Additionally, writing beyond end-of-device will not return
ENOSPC there.
blocksize=int
bs=int The block size used for the io units. Defaults to 4k. Values
can be given for both read and writes. If a single int is
given, it will apply to both. If a second int is specified
after a comma, it will apply to writes only. In other words,
the format is either bs=read_and_write or bs=read,write,trim.
bs=4k,8k will thus use 4k blocks for reads, 8k blocks for
writes, and 8k for trims. You can terminate the list with
a trailing comma. bs=4k,8k, would use the default value for
trims.. If you only wish to set the write size, you
can do so by passing an empty read size - bs=,8k will set
8k for writes and leave the read default value.
blockalign=int
ba=int At what boundary to align random IO offsets. Defaults to
the same as 'blocksize' the minimum blocksize given.
Minimum alignment is typically 512b for using direct IO,
though it usually depends on the hardware block size. This
option is mutually exclusive with using a random map for
files, so it will turn off that option.
blocksize_range=irange
bsrange=irange Instead of giving a single block size, specify a range
and fio will mix the issued io block sizes. The issued
io unit will always be a multiple of the minimum value
given (also see bs_unaligned). Applies to both reads and
writes, however a second range can be given after a comma.
See bs=.
bssplit=str Sometimes you want even finer grained control of the
block sizes issued, not just an even split between them.
This option allows you to weight various block sizes,
so that you are able to define a specific amount of
block sizes issued. The format for this option is:
bssplit=blocksize/percentage:blocksize/percentage
for as many block sizes as needed. So if you want to define
a workload that has 50% 64k blocks, 10% 4k blocks, and
40% 32k blocks, you would write:
bssplit=4k/10:64k/50:32k/40
Ordering does not matter. If the percentage is left blank,
fio will fill in the remaining values evenly. So a bssplit
option like this one:
bssplit=4k/50:1k/:32k/
would have 50% 4k ios, and 25% 1k and 32k ios. The percentages
always add up to 100, if bssplit is given a range that adds
up to more, it will error out.
bssplit also supports giving separate splits to reads and
writes. The format is identical to what bs= accepts. You
have to separate the read and write parts with a comma. So
if you want a workload that has 50% 2k reads and 50% 4k reads,
while having 90% 4k writes and 10% 8k writes, you would
specify:
bssplit=2k/50:4k/50,4k/90:8k/10
blocksize_unaligned
bs_unaligned If this option is given, any byte size value within bsrange
may be used as a block range. This typically wont work with
direct IO, as that normally requires sector alignment.
bs_is_seq_rand If this option is set, fio will use the normal read,write
blocksize settings as sequential,random instead. Any random
read or write will use the WRITE blocksize settings, and any
sequential read or write will use the READ blocksize setting.
zero_buffers If this option is given, fio will init the IO buffers to
all zeroes. The default is to fill them with random data.
refill_buffers If this option is given, fio will refill the IO buffers
on every submit. The default is to only fill it at init
time and reuse that data. Only makes sense if zero_buffers
isn't specified, naturally. If data verification is enabled,
refill_buffers is also automatically enabled.
scramble_buffers=bool If refill_buffers is too costly and the target is
using data deduplication, then setting this option will
slightly modify the IO buffer contents to defeat normal
de-dupe attempts. This is not enough to defeat more clever
block compression attempts, but it will stop naive dedupe of
blocks. Default: true.
buffer_compress_percentage=int If this is set, then fio will attempt to
provide IO buffer content (on WRITEs) that compress to
the specified level. Fio does this by providing a mix of
random data and a fixed pattern. The fixed pattern is either
zeroes, or the pattern specified by buffer_pattern. If the
pattern option is used, it might skew the compression ratio
slightly. Note that this is per block size unit, for file/disk
wide compression level that matches this setting, you'll also
want to set refill_buffers.
buffer_compress_chunk=int See buffer_compress_percentage. This
setting allows fio to manage how big the ranges of random
data and zeroed data is. Without this set, fio will
provide buffer_compress_percentage of blocksize random
data, followed by the remaining zeroed. With this set
to some chunk size smaller than the block size, fio can
alternate random and zeroed data throughout the IO
buffer.
buffer_pattern=str If set, fio will fill the io buffers with this
pattern. If not set, the contents of io buffers is defined by
the other options related to buffer contents. The setting can
be any pattern of bytes, and can be prefixed with 0x for hex
values. It may also be a string, where the string must then
be wrapped with "", e.g.:
buffer_pattern="abcd"
or
buffer_pattern=-12
or
buffer_pattern=0xdeadface
Also you can combine everything together in any order:
buffer_pattern=0xdeadface"abcd"-12
dedupe_percentage=int If set, fio will generate this percentage of
identical buffers when writing. These buffers will be
naturally dedupable. The contents of the buffers depend on
what other buffer compression settings have been set. It's
possible to have the individual buffers either fully
compressible, or not at all. This option only controls the
distribution of unique buffers.
nrfiles=int Number of files to use for this job. Defaults to 1.
openfiles=int Number of files to keep open at the same time. Defaults to
the same as nrfiles, can be set smaller to limit the number
simultaneous opens.
file_service_type=str Defines how fio decides which file from a job to
service next. The following types are defined:
random Just choose a file at random.
roundrobin Round robin over open files. This
is the default.
sequential Finish one file before moving on to
the next. Multiple files can still be
open depending on 'openfiles'.
zipf Use a zipfian distribution to decide what file
to access.
pareto Use a pareto distribution to decide what file
to access.
gauss Use a gaussian (normal) distribution to decide
what file to access.
For random, roundrobin, and sequential, a postfix can be
appended to tell fio how many I/Os to issue before switching
to a new file. For example, specifying
'file_service_type=random:8' would cause fio to issue 8 I/Os
before selecting a new file at random. For the non-uniform
distributions, a floating point postfix can be given to
influence how the distribution is skewed. See
'random_distribution' for a description of how that would work.
ioengine=str Defines how the job issues io to the file. The following
types are defined:
sync Basic read(2) or write(2) io. lseek(2) is
used to position the io location.
psync Basic pread(2) or pwrite(2) io. Default on all
supported operating systems except for Windows.
vsync Basic readv(2) or writev(2) IO.
pvsync Basic preadv(2) or pwritev(2) IO.
pvsync2 Basic preadv2(2) or pwritev2(2) IO.
libaio Linux native asynchronous io. Note that Linux
may only support queued behaviour with
non-buffered IO (set direct=1 or buffered=0).
This engine defines engine specific options.
posixaio glibc posix asynchronous io.
solarisaio Solaris native asynchronous io.
windowsaio Windows native asynchronous io.
Default on Windows.
mmap File is memory mapped and data copied
to/from using memcpy(3).
splice splice(2) is used to transfer the data and
vmsplice(2) to transfer data from user
space to the kernel.
sg SCSI generic sg v3 io. May either be
synchronous using the SG_IO ioctl, or if
the target is an sg character device
we use read(2) and write(2) for asynchronous
io.
null Doesn't transfer any data, just pretends
to. This is mainly used to exercise fio
itself and for debugging/testing purposes.
net Transfer over the network to given host:port.
Depending on the protocol used, the hostname,
port, listen and filename options are used to
specify what sort of connection to make, while
the protocol option determines which protocol
will be used.
This engine defines engine specific options.
netsplice Like net, but uses splice/vmsplice to
map data and send/receive.
This engine defines engine specific options.
cpuio Doesn't transfer any data, but burns CPU
cycles according to the cpuload= and
cpuchunks= options. Setting cpuload=85
will cause that job to do nothing but burn
85% of the CPU. In case of SMP machines,
use numjobs=<no_of_cpu> to get desired CPU
usage, as the cpuload only loads a single
CPU at the desired rate. A job never finishes
unless there is at least one non-cpuio job.
guasi The GUASI IO engine is the Generic Userspace
Asyncronous Syscall Interface approach
to async IO. See
https://www.xmailserver.org/guasi-lib.html
for more info on GUASI.
rdma The RDMA I/O engine supports both RDMA
memory semantics (RDMA_WRITE/RDMA_READ) and
channel semantics (Send/Recv) for the
InfiniBand, RoCE and iWARP protocols.
falloc IO engine that does regular fallocate to
simulate data transfer as fio ioengine.
DDIR_READ does fallocate(,mode = keep_size,)
DDIR_WRITE does fallocate(,mode = 0)
DDIR_TRIM does fallocate(,mode = punch_hole)
e4defrag IO engine that does regular EXT4_IOC_MOVE_EXT
ioctls to simulate defragment activity in
request to DDIR_WRITE event
rbd IO engine supporting direct access to Ceph
Rados Block Devices (RBD) via librbd without
the need to use the kernel rbd driver. This
ioengine defines engine specific options.
gfapi Using Glusterfs libgfapi sync interface to
direct access to Glusterfs volumes without
options.
gfapi_async Using Glusterfs libgfapi async interface
to direct access to Glusterfs volumes without
having to go through FUSE. This ioengine
defines engine specific options.
libhdfs Read and write through Hadoop (HDFS).
This engine interprets offsets a little
differently. In HDFS, files once created
cannot be modified. So random writes are not
possible. To imitate this, libhdfs engine
creates bunch of small files, and engine will
pick a file out of those files based on the
offset enerated by fio backend. Each jobs uses
it's own connection to HDFS.
mtd Read, write and erase an MTD character device
(e.g., /dev/mtd0). Discards are treated as
erases. Depending on the underlying device
type, the I/O may have to go in a certain
pattern, e.g., on NAND, writing sequentially
to erase blocks and discarding before
overwriting. The writetrim mode works well
for this constraint.
pmemblk Read and write through the NVML libpmemblk
interface.
external Prefix to specify loading an external
IO engine object file. Append the engine
filename, eg ioengine=external:/tmp/foo.o
to load ioengine foo.o in /tmp.
iodepth=int This defines how many io units to keep in flight against
the file. The default is 1 for each file defined in this
job, can be overridden with a larger value for higher
concurrency. Note that increasing iodepth beyond 1 will not
affect synchronous ioengines (except for small degress when
verify_async is in use). Even async engines may impose OS
restrictions causing the desired depth not to be achieved.
This may happen on Linux when using libaio and not setting
direct=1, since buffered IO is not async on that OS. Keep an
eye on the IO depth distribution in the fio output to verify
that the achieved depth is as expected. Default: 1.
iodepth_batch_submit=int
iodepth_batch=int This defines how many pieces of IO to submit at once.
It defaults to 1 which means that we submit each IO
as soon as it is available, but can be raised to submit
bigger batches of IO at the time. If it is set to 0 the iodepth
value will be used.
iodepth_batch_complete_min=int
iodepth_batch_complete=int This defines how many pieces of IO to retrieve
at once. It defaults to 1 which means that we'll ask
for a minimum of 1 IO in the retrieval process from
the kernel. The IO retrieval will go on until we
hit the limit set by iodepth_low. If this variable is
set to 0, then fio will always check for completed
events before queuing more IO. This helps reduce
IO latency, at the cost of more retrieval system calls.
iodepth_batch_complete_max=int This defines maximum pieces of IO to
retrieve at once. This variable should be used along with
iodepth_batch_complete_min=int variable, specifying the range
of min and max amount of IO which should be retrieved. By default
it is equal to iodepth_batch_complete_min value.
Example #1:
iodepth_batch_complete_min=1
iodepth_batch_complete_max=<iodepth>
which means that we will retrieve at leat 1 IO and up to the
whole submitted queue depth. If none of IO has been completed
yet, we will wait.
Example #2:
iodepth_batch_complete_min=0
iodepth_batch_complete_max=<iodepth>
which means that we can retrieve up to the whole submitted
queue depth, but if none of IO has been completed yet, we will
NOT wait and immediately exit the system call. In this example
we simply do polling.
iodepth_low=int The low water mark indicating when to start filling
the queue again. Defaults to the same as iodepth, meaning
that fio will attempt to keep the queue full at all times.
If iodepth is set to eg 16 and iodepth_low is set to 4, then
after fio has filled the queue of 16 requests, it will let
the depth drain down to 4 before starting to fill it again.
io_submit_mode=str This option controls how fio submits the IO to
the IO engine. The default is 'inline', which means that the
fio job threads submit and reap IO directly. If set to
'offload', the job threads will offload IO submission to a
dedicated pool of IO threads. This requires some coordination
and thus has a bit of extra overhead, especially for lower
queue depth IO where it can increase latencies. The benefit
is that fio can manage submission rates independently of
the device completion rates. This avoids skewed latency
reporting if IO gets back up on the device side (the
coordinated omission problem).
direct=bool If value is true, use non-buffered io. This is usually
O_DIRECT. Note that ZFS on Solaris doesn't support direct io.
On Windows the synchronous ioengines don't support direct io.
atomic=bool If value is true, attempt to use atomic direct IO. Atomic
writes are guaranteed to be stable once acknowledged by
the operating system. Only Linux supports O_ATOMIC right
now.
buffered=bool If value is true, use buffered io. This is the opposite
of the 'direct' option. Defaults to true.
offset=int Start io at the given offset in the file. The data before
the given offset will not be touched. This effectively
caps the file size at real_size - offset.
offset_increment=int If this is provided, then the real offset becomes
offset + offset_increment * thread_number, where the thread
number is a counter that starts at 0 and is incremented for
each sub-job (i.e. when numjobs option is specified). This
option is useful if there are several jobs which are intended
to operate on a file in parallel disjoint segments, with
even spacing between the starting points.
number_ios=int Fio will normally perform IOs until it has exhausted the size
of the region set by size=, or if it exhaust the allocated
time (or hits an error condition). With this setting, the
range/size can be set independently of the number of IOs to
perform. When fio reaches this number, it will exit normally
and report status. Note that this does not extend the amount
of IO that will be done, it will only stop fio if this
condition is met before other end-of-job criteria.
fsync=int If writing to a file, issue a sync of the dirty data
for every number of blocks given. For example, if you give
32 as a parameter, fio will sync the file for every 32
writes issued. If fio is using non-buffered io, we may
not sync the file. The exception is the sg io engine, which
synchronizes the disk cache anyway.
fdatasync=int Like fsync= but uses fdatasync() to only sync data and not
metadata blocks.
In FreeBSD and Windows there is no fdatasync(), this falls back
to using fsync()
sync_file_range=str:val Use sync_file_range() for every 'val' number of
write operations. Fio will track range of writes that
have happened since the last sync_file_range() call. 'str'
can currently be one or more of:
wait_before SYNC_FILE_RANGE_WAIT_BEFORE
write SYNC_FILE_RANGE_WRITE
wait_after SYNC_FILE_RANGE_WAIT_AFTER
So if you do sync_file_range=wait_before,write:8, fio would
use SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE for
every 8 writes. Also see the sync_file_range(2) man page.
This option is Linux specific.
overwrite=bool If true, writes to a file will always overwrite existing
data. If the file doesn't already exist, it will be
created before the write phase begins. If the file exists
and is large enough for the specified write phase, nothing
will be done.
end_fsync=bool If true, fsync file contents when a write stage has completed.
fsync_on_close=bool If true, fio will fsync() a dirty file on close.
This differs from end_fsync in that it will happen on every
file close, not just at the end of the job.
rwmixread=int How large a percentage of the mix should be reads.
rwmixwrite=int How large a percentage of the mix should be writes. If both
rwmixread and rwmixwrite is given and the values do not add
up to 100%, the latter of the two will be used to override
the first. This may interfere with a given rate setting,
if fio is asked to limit reads or writes to a certain rate.
If that is the case, then the distribution may be skewed.
random_distribution=str:float By default, fio will use a completely uniform
random distribution when asked to perform random IO. Sometimes
it is useful to skew the distribution in specific ways,
ensuring that some parts of the data is more hot than others.
fio includes the following distribution models:
random Uniform random distribution
zipf Zipf distribution
pareto Pareto distribution
gauss Normal (guassian) distribution
zoned Zoned random distribution
When using a zipf or pareto distribution, an input value
is also needed to define the access pattern. For zipf, this
is the zipf theta. For pareto, it's the pareto power. Fio
includes a test program, genzipf, that can be used visualize
what the given input values will yield in terms of hit rates.
If you wanted to use zipf with a theta of 1.2, you would use
random_distribution=zipf:1.2 as the option. If a non-uniform
model is used, fio will disable use of the random map. For
the gauss distribution, a normal deviation is supplied as