axboe / fio

Flexible I/O Tester

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ioengine=filestat is not behaving correctly

raj-prince opened this issue · comments

Please acknowledge the following before creating a ticket

Description of the bug:
ioengine=filestat starts reading the file, but my assumption there shouldn't be any read io during the workload.

Environment:
Ubuntu 20

fio version: latest built from the source code

Reproduction steps
Fio Run book:

; -- use nrfiles and rw to CLI args to control readtype and number of files --
[global]
ioengine=filestat
fadvise_hint=0
invalidate=1
nrfiles=4
thread=1
group_reporting=1
create_serialize=0
allrandrepeat=1
numjobs=4
filename_format=$jobname.$jobnum/$filenum

[Workload]
directory=/home/princer_google_com/working_dir/gcs/meta_test/
filesize=4K

Output:

Workload: (g=0): rw=read, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=filestat, iodepth=1
...
fio-3.36-dirty
Starting 4 threads

Workload: (groupid=0, jobs=4): err= 0: pid=1426049: Fri Jan 12 06:15:49 2024
  read: IOPS=8000, BW=31.2MiB/s (32.8MB/s)(64.0KiB/2msec)
    clat (usec): min=158, max=333, avg=235.82, stdev=45.26
    clat percentiles (usec):
     |  1.00th=[  159],  5.00th=[  159], 10.00th=[  186], 20.00th=[  198],
     | 30.00th=[  204], 40.00th=[  225], 50.00th=[  233], 60.00th=[  245],
     | 70.00th=[  260], 80.00th=[  277], 90.00th=[  289], 95.00th=[  334],
     | 99.00th=[  334], 99.50th=[  334], 99.90th=[  334], 99.95th=[  334],
     | 99.99th=[  334]
  cpu          : usr=0.00%, sys=0.00%, ctx=48, majf=0, minf=0
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued rwts: total=16,0,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
   READ: bw=31.2MiB/s (32.8MB/s), 31.2MiB/s-31.2MiB/s (32.8MB/s-32.8MB/s), io=64.0KiB (65.5kB), run=2-2msec

As we can see, io = 64.0 KiB and number of read is 16.
And the filesize=4K

IO = 16 * 4K = 64 K
Ideally, we shouldn't get read io.

The file{create,stat,delete} ioengines are not well documented.

The queue hook in the ioengine actually does nothing:

static enum fio_q_status queue_io(struct thread_data *td, struct io_u *io_u)
{
	return FIO_Q_COMPLETED;
}

So the bandwidth and IOPS values should be ignored. What is important for these ioengines is the latency values which are recorded each time a file is opened.

For this ioengine all the work actually happens when fio opens the file:

static struct ioengine_ops ioengine_filestat = {
	.name		= "filestat",
...
	.open_file	= stat_file,
...
};

The stat_file() function makes the selected stat() call and then records a latency value for this operation. So the values to pay attention to are the completion latency values. Try running with --debug=file to see some details.

Thanks @vincentkfu for the clarification!