-
-
Save rcaldas-com/b94810f0564d690bf03fe4e076bb6ab5 to your computer and use it in GitHub Desktop.
Test disk with fio and parse results
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
#!/bin/sh | |
run(){ | |
name="$1" | |
shift | |
( | |
set -x | |
# defailt parameters | |
fio -name="$name" -filename=$disk -output-format=json -ioengine=libaio -direct=1 -randrepeat=0 "$@" > results/$disk_dashed-$name.json | |
) | |
} | |
if [ ! -b "$1" ]; then | |
echo "$1 is not a device!" >&2 | |
exit 1 | |
fi | |
command -V fio >&2 || exit $? | |
command -V jq >&2 || exit $? | |
disk=$1 | |
disk_dashed=$(echo "$disk" | tr / - | sed 's/^-//') | |
mkdir -p results | |
rm -f results/$dashed_disk-* | |
# name should be 'randread_*', 'read_*', 'randwrite_*' or 'write_*' | |
run randwrite_fsync -rw=randwrite -runtime=60 -bs=4k -numjobs=1 -iodepth=1 -fsync=1 | |
run randwrite_jobs4 -rw=randwrite -runtime=60 -bs=4k -numjobs=4 -iodepth=128 -group_reporting | |
run randwrite -rw=randwrite -runtime=60 -bs=4k -numjobs=1 -iodepth=128 | |
run write -rw=write -runtime=60 -bs=4M -numjobs=1 -iodepth=16 | |
run randread_fsync -rw=randread -runtime=60 -bs=4k -numjobs=1 -iodepth=1 -fsync=1 | |
run randread_jobs4 -rw=randread -runtime=60 -bs=4k -numjobs=4 -iodepth=128 -group_reporting | |
run randread -rw=randread -runtime=60 -bs=4k -numjobs=1 -iodepth=128 | |
run read -rw=read -runtime=60 -bs=4M -numjobs=1 -iodepth=16 | |
data="$(cat results/$disk_dashed-* | jq -sc . | gzip -9 | base64 -w0)" | |
{ | |
for i in $(find results -name "$disk_dashed-write*" -o -name "$disk_dashed-randwrite*" | sort -V); do | |
cat $i | jq -rc '.jobs[0] | {"name": ."job options".name, "iodepth": ."job options".iodepth, bs: ."job options".bs, jobs: ."job options".numjobs, "clat_ms": (.write.lat_ns.mean/1000)|floor, "bw_mbs": (.write.bw_mean/1024)|floor, iops: .write.iops_mean|floor}' | |
done | |
for i in $(find results -name "$disk_dashed-read*" -o -name "$disk_dashed-randread*" | sort -V); do | |
cat $i | jq -rc '.jobs[0] | {"name": ."job options".name, "iodepth": ."job options".iodepth, bs: ."job options".bs, jobs: ."job options".numjobs, "clat_ms": (.read.lat_ns.mean/1000)|floor, "bw_mbs": (.read.bw_mean/1024)|floor, iops: .read.iops_mean|floor}' | |
done | |
} | jq -s "{\"$disk\": {results: ., data: \"$data\" }}" | |
rm -f results/$disk_dashed-* |
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
#!/bin/sh | |
run(){ | |
name="$1" | |
shift | |
( | |
set -x | |
# defailt parameters | |
fio -name="$name" -filename=$disk -output-format=json -ioengine=libaio -direct=1 "$@" > results/$disk_dashed-$name.json | |
) | |
} | |
if [ ! -b "$1" ]; then | |
echo "$1 is not a device!" >&2 | |
exit 1 | |
fi | |
command -V fio >&2 || exit $? | |
command -V jq >&2 || exit $? | |
disk=$1 | |
disk_dashed=$(echo "$disk" | tr / - | sed 's/^-//') | |
mkdir -p results | |
rm -f results/$dashed_disk-* | |
# name should be 'randrw_*' | |
run test -rw=randrw -rwmixread=75 -bs=4k -numjobs=1 -iodepth=64 -size=4G | |
data="$(cat results/$disk_dashed-* | jq -sc . | gzip -9 | base64 -w0)" | |
{ | |
for i in results/$disk_dashed-*; do | |
cat $i | jq -rc '.jobs[0] | {"name": "\(."job options".name)_write", "iodepth": ."job options".iodepth, bs: ."job options".bs, jobs: ."job options".numjobs, "clat_ms": (.write.lat_ns.mean/1000)|floor, "bw_mbs": (.write.bw_mean/1024)|floor, iops: .write.iops_mean|floor}' | |
cat $i | jq -rc '.jobs[0] | {"name": "\(."job options".name)_read", "iodepth": ."job options".iodepth, bs: ."job options".bs, jobs: ."job options".numjobs, "clat_ms": (.read.lat_ns.mean/1000)|floor, "bw_mbs": (.read.bw_mean/1024)|floor, iops: .read.iops_mean|floor}' | |
done | |
} | jq -s "{\"$disk\": {results: ., data: \"$data\" }}" | |
rm -f results/$disk_dashed-* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment