Fio Fork n jobs
- Create a new file and add following lines to the file. Let's name the file as "fio_script"
[jobname]
rw=randread
size=14000
bs=4090
ioengine=sync
numjobs=2
- We run fio script by using fio command:
Syntax $fio <scriptname>
Eg: $fio fio_script
-
Let's understand what "numjobs=n" line means:
- Note: We haven't specified in instructions how jobs should be created. Whether we want fio to create 'n' threads or 'n' processes to complete the jobs. By default, fio creates 'n' processes to complete the job.
- numjobs option specifies how many jobs should be created in parallel. For example, in above fio script, we are telling fio to fork 2 jobs such that each job performs random read of size 14000 bytes in total and each read request should be of size 4090 bytes.
- Homework 1: Repeat following experiment
- Using strace let's verify that our understanding of what numjobs=n means is correct or not.
$ strace -f fio fioScript 2> strace_out
- Above command traces the sytem calls made by fio process that performed above fio task and outputs the tracing result into file named 'strace_out'
- Search for '4090' in the strace_out file. You will probably see something similar to following:
[pid 22924] <... read resumed> "xq\235\2178\267i\217/\2567Y\30\357\230\22\305u\0174G\361O\16\270n\237+!dI\24"..., 4090) = 4090
[pid 22923] <... read resumed> "5\340(\3148\240\231\26\6\234j\251\362\315\351\n\200S*\7\t\345\r\25pJ%\367\v9\235\30"..., 4090) = 4090
[pid 22924] read(3,
[pid 22923] lseek(3, 8180, SEEK_SET) = 8180
[pid 22923] read(3,
[pid 22924] <... read resumed> "\214\357\262\20\207$\0\361]Pj7\225\7\276\213Q\276^\362-\fw1\353\21#_\10\3"..., 4090) = 4090
[pid 22924] read(3, "d\2072\352\235$\260+\354P\224yz\17\343\35\35\212\274%%s\7C\21\311_F\321\346\21"..., 4090) = 4090
[pid 22924] close(3
We can see in above trace file that 2 separate processes (pid=22923, 22924) are performing read() operation.
Homework 2: Observe the output of fio. For 'n' jobs, fio generates 'n' reports.
Note: We have not specified the file on which read should happen. In this case, fio automatically first creates 'n' files (Eg: jobname.0.0, jobname.1.0 etc.) and then performs read operation on these files.