adding 5/95 r/w variant
This commit is contained in:
parent
586cd1b395
commit
86ffd0cdee
1 changed files with 156 additions and 0 deletions
156
fiotest_4x0595.sh
Executable file
156
fiotest_4x0595.sh
Executable file
|
|
@ -0,0 +1,156 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Test filesystem path with fio database simulation
|
||||
# - 4k blocks, 5% read, 95% write
|
||||
# - threaded mode, 128 request queue depth
|
||||
# - fewer large files, random I/O
|
||||
#
|
||||
# Required:
|
||||
# - FS mounted at /fiotest (or use -d / -x)
|
||||
# - 5G space free in filesystem path
|
||||
# - 'fio' installed (yum/dnf/apt)
|
||||
#
|
||||
# Will create:
|
||||
# - /fiotest/fio/4x0595.fio (config)
|
||||
# - /fiotest/fio/4x0595_$(uname -r).txt (results)
|
||||
# - /fiotest/fio/cache (cache)
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
_VERSION="0.0.1"
|
||||
_NAME=$(basename "${0}")
|
||||
|
||||
# usage
|
||||
function usage() {
|
||||
echo "${_NAME} version ${_VERSION}"
|
||||
echo
|
||||
echo "Usage: ${_NAME} [OPTIONS...]"
|
||||
echo
|
||||
echo " Options:"
|
||||
echo " -d <dir> Directory to use (default: /fiotest)"
|
||||
echo " -o Overwrite existing fio config"
|
||||
echo " -x Do not test if dir is a mount point"
|
||||
echo " -V Version of program"
|
||||
echo " -h This help text"
|
||||
echo
|
||||
}
|
||||
|
||||
# defaults
|
||||
declare FMOUNT="/fiotest"
|
||||
declare _OCFG=0
|
||||
declare _XMNT=1
|
||||
|
||||
# user input
|
||||
while getopts "d:oxVh" opt; do
|
||||
case "$opt" in
|
||||
d)
|
||||
FMOUNT="${OPTARG}" ;;
|
||||
o)
|
||||
_OCFG=1 ;;
|
||||
x)
|
||||
_XMNT=0 ;;
|
||||
V)
|
||||
echo "${_NAME} version ${_VERSION}"
|
||||
exit 0 ;;
|
||||
h)
|
||||
usage
|
||||
exit 0 ;;
|
||||
*)
|
||||
echo "Unrecognized option: $OPTARG (Run '$_NAME -h' for help)"
|
||||
exit 1 ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
# strip trailing slash if present
|
||||
FMOUNT=${FMOUNT%/}
|
||||
|
||||
# runtime vars
|
||||
FDIR="${FMOUNT}/fio"
|
||||
FCONF="${FDIR}/4x0595.fio"
|
||||
FLOG="${FDIR}/4x0595_$(uname -r).txt"
|
||||
FCACHE="${FDIR}/cache"
|
||||
|
||||
# ensure we can run fio properly
|
||||
function preflight() {
|
||||
# fio test
|
||||
if [[ -z "$(command -v fio 2>/dev/null)" ]]; then
|
||||
echo "Install 'fio' with yum/dnf/apt first. Exiting."
|
||||
exit 99
|
||||
fi
|
||||
# mount/dir test
|
||||
if [[ $_XMNT -eq 1 ]]; then
|
||||
if ! mountpoint -q "${FMOUNT}"; then
|
||||
echo "${FMOUNT} is not a mount point, use -x to override. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# -x was used
|
||||
if [[ ! -d "${FMOUNT}" ]]; then
|
||||
echo "${FMOUNT} is not a directory. Exiting."
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
# mkdirs
|
||||
mkdir -p "${FCACHE}"
|
||||
if [[ ! -d "${FCACHE}" ]]; then
|
||||
echo "Cannot create ${FCACHE}. Exiting."
|
||||
exit 3
|
||||
fi
|
||||
}
|
||||
|
||||
# ensure we have a fio config
|
||||
function writeconf() {
|
||||
# -o was used, or does not exist
|
||||
if [[ $_OCFG -eq 1 ]] || [[ ! -f "${FCONF}" ]]; then
|
||||
cat << EOF > "${FCONF}"
|
||||
;; Generic database simulation
|
||||
;; - 4k blocks, 5% read, 95% write
|
||||
;; - threaded mode, 128 request queue depth
|
||||
;; - fewer large files, random I/O
|
||||
|
||||
[4x0595]
|
||||
; this directory will need numjobs*size free!
|
||||
directory=${FCACHE}
|
||||
numjobs=4
|
||||
size=1G
|
||||
; run this many loops
|
||||
loops=10
|
||||
; instead of loops, run 10 mins
|
||||
;time_based
|
||||
;runtime=600
|
||||
; params for 5/95 read/write randomly
|
||||
thread
|
||||
ioengine=libaio
|
||||
iodepth=128
|
||||
rw=randrw
|
||||
rwmixread=5
|
||||
rwmixwrite=95
|
||||
randrepeat=0
|
||||
bs=4k
|
||||
file_service_type=random
|
||||
overwrite=1
|
||||
direct=1
|
||||
softrandommap=1
|
||||
random_generator=lfsr
|
||||
invalidate=1
|
||||
unlink=0
|
||||
refill_buffers
|
||||
group_reporting
|
||||
EOF
|
||||
fi
|
||||
if [[ ! -f "${FCONF}" ]]; then
|
||||
echo "Cannot create or find ${FCONF}"
|
||||
exit 2
|
||||
fi
|
||||
}
|
||||
|
||||
# these could fail and exit
|
||||
preflight
|
||||
writeconf
|
||||
|
||||
# do the needful
|
||||
echo "Running: fio --output=${FLOG} ${FCONF}"
|
||||
echo
|
||||
fio --output="${FLOG}" "${FCONF}"
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue