Last active
June 16, 2023 16:21
-
-
Save pschichtel/88f965fbad94e8984ea4defbd3055b70 to your computer and use it in GitHub Desktop.
A simple benchmark script using via with a database workload. https://www.dbi-services.com/blog/flexible-io-simulating-database-like-io-activity-without-an-installed-database/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
target_dir="${1?no target dir!}" | |
if [ -e "$target_dir" ] | |
then | |
echo "$target_dir already exists!" >&2 | |
exit 1 | |
fi | |
report_file="${2?no report file!}" | |
if [ -e "$report_file" ] | |
then | |
echo "$report_file already exists!" >&2 | |
exit 1 | |
fi | |
mkdir -p "$target_dir" | |
profile="$(cat <<EOL | |
[seq-read] | |
# Sequential reads | |
rw=read | |
# Size if the the I/O | |
size=8g | |
# Directory where the test file will be created | |
# Diables posix_fadvise - predeclare an access pattern for file data | |
fadvise_hint=0 | |
# Block size | |
blocksize=8k | |
# Use of direct I/O | |
direct=1 | |
# Number of I/O threads : | |
numjobs=1 | |
# Number of files : | |
nrfiles=1 | |
# Duration of the test in seconds | |
runtime=300 | |
# Usage of ASYNC I/O | |
ioengine=libaio | |
# Runtime based, overwrites or overreads several times the specified file | |
time_based | |
# To free pagecache, dentries and inodes (only possible as root, therefore commented out) : | |
# exec_prerun=echo 3 > /proc/sys/vm/drop_caches | |
[seq-write] | |
rw=write | |
size=8g | |
fadvise_hint=0 | |
blocksize=8k | |
direct=1 | |
numjobs=1 | |
nrfiles=1 | |
runtime=300 | |
ioengine=libaio | |
time_based | |
# exec_prerun=echo 3 > /proc/sys/vm/drop_caches | |
[random-read] | |
# Each process allocates one file, therefore to have 8G the size should be set to 1G with 8 processes | |
rw=randread | |
size=1g | |
fadvise_hint=0 | |
blocksize=8k | |
direct=1 | |
numjobs=8 | |
nrfiles=1 | |
runtime=300 | |
ioengine=libaio | |
time_based | |
# exec_prerun=echo 3 > /proc/sys/vm/drop_caches | |
[random-write] | |
# Each process allocates one file, therefore to have 8G the size should be set to 1G with 8 processes | |
rw=randwrite | |
size=1g | |
fadvise_hint=0 | |
blocksize=8k | |
direct=1 | |
numjobs=8 | |
nrfiles=1 | |
runtime=300 | |
ioengine=libaio | |
time_based | |
# exec_prerun=echo 3 > /proc/sys/vm/drop_caches | |
[read-write] | |
# Each process allocates one file, therefore to have 8G the size should be set to 1G with 8 processes | |
rw=rw | |
rwmixread=80 | |
size=1g | |
fadvise_hint=0 | |
blocksize=8k | |
direct=1 | |
numjobs=8 | |
nrfiles=1 | |
runtime=300 | |
ioengine=libaio | |
time_based | |
# exec_prerun=echo 3 > /proc/sys/vm/drop_caches | |
EOL | |
)" | |
profile_file="$(mktemp)" | |
echo "$profile" > "$profile_file" | |
fio --directory="$target_dir" --output="$report_file" --output-format="${FIO_OUTPUT_FORMAT:-"normal"}" "$profile_file" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment