###
### Measure latency of reads in presence of heavy sync writes
###
### Run 4 writer threads doing 1m of random writes & fsync
### Run 1 reader thread doing random 4k reads from 20 different files
###
### This fio workload simulates application startup by reading randomly 4k
### chunks from 20 different files. We also run 4 writer threads doing random
### 4k writes and calling fdatasync() once in a while. This is to see how
### much reads are starved by a presence of heavy independent synchronous
### writes.
###

# MM Test Parameters
export MMTESTS="fio"

# Test disk to setup (optional)
#export TESTDISK_RAID_DEVICES=
#export TESTDISK_RAID_MD_DEVICE=/dev/md0
#export TESTDISK_RAID_OFFSET=63
#export TESTDISK_RAID_SIZE=250019532
#export TESTDISK_RAID_TYPE=raid0
#export TESTDISK_PARTITION=/dev/sda6
#export TESTDISK_FILESYSTEM=xfs
#export TESTDISK_MKFS_PARAM="-f -d agcount=8"
#export TESTDISK_MOUNT_ARGS=inode64,delaylog,logbsize=262144,nobarrier

# List of monitors
export RUN_MONITOR=yes
export MONITORS_ALWAYS=
export MONITORS_PLAIN=
export MONITORS_GZIP="proc-vmstat top"
export MONITORS_WITH_LATENCY="vmstat iostat"
export MONITOR_UPDATE_FREQUENCY=10

# fio
JOBFILE="/tmp/fio-jobfile-$$"
export FIO_CMD_OPTIONS="$JOBFILE"

cat >$JOBFILE <<END
[global]
direct=0
ioengine=sync
runtime=300
time_based
invalidate=1
blocksize=4096
size=10g	# Just random value, we are running time based workload
log_avg_msec=10
group_reporting=1

[writer]
nrfiles=1
filesize=1g
fdatasync=256
readwrite=randwrite
numjobs=4

[reader]
# Simulate random reading from different files, switching to different file
# after 16 ios. This somewhat simulates application startup.
new_group
filesize=100m
nrfiles=20
file_service_type=random:16
readwrite=randread
END
