Created
February 5, 2013 19:13
-
-
Save dillera/4716828 to your computer and use it in GitHub Desktop.
Benchmark FIO card
This file contains 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/bash | |
###################################### | |
# | |
# FusionIO Benchmarking | |
# 2013 | |
if [ "$#" == "0" ]; then | |
echo "No arguments provided, please run like: fio_bench.sh /dev/[fiocontroller] /dev/[fiodevice]" | |
exit 1 | |
fi | |
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root" 1>&2 | |
exit 1 | |
fi | |
fiocontroller=$1 | |
fiodevice=$2 | |
startperfstats () { | |
perf_stats="dstat -tcdmpniD ${fiodevice:(-4)} --tcp --udp --float --output $1.perf.csv" | |
eval ${perf_stats} & | |
} | |
stopperfstats () { | |
perf_stats_PID=`ps ax | grep -e dstat | grep -e ${fiodevice:(-4)} | awk '{print $1}'` | |
kill -9 $perf_stats_PID | |
} | |
WriteJobs () { | |
#Write Job definitions: | |
echo 'starting to write out jobs, using $fiocontroller and $fiodevice' | |
DEVICE=$fiodevice | |
HOMEDIR="/tmp/$(basename $0).$$" | |
mkdir -p $HOMEDIR | |
cat <<EOF > /$HOMEDIR/fio-job-01.ini | |
[global] | |
readwrite=randrw | |
rwmixread=0 | |
blocksize=512 | |
ioengine=sync | |
numjobs=1 | |
thread=0 | |
direct=1 | |
iodepth=1 | |
iodepth_batch=1 | |
iodepth_batch_complete=1 | |
group_reporting=1 | |
ramp_time=5 | |
norandommap=1 | |
description=fio random 512 write LATENCY | |
time_based=1 | |
runtime=30 | |
randrepeat=0 | |
[$DEVICE] | |
filename=$DEVICE | |
EOF | |
cat <<EOF > /$HOMEDIR/fio-job-02.ini | |
[global] | |
readwrite=randrw | |
rwmixread=0 | |
blocksize=512 | |
ioengine=libaio | |
numjobs=4 | |
thread=0 | |
direct=1 | |
iodepth=32 | |
iodepth_batch=16 | |
iodepth_batch_complete=16 | |
group_reporting=1 | |
ramp_time=5 | |
norandommap=1 | |
description=fio random 512 write peak IOPS | |
time_based=1 | |
runtime=30 | |
randrepeat=0 | |
[$DEVICE] | |
filename=$DEVICE | |
EOF | |
cat <<EOF > /$HOMEDIR/fio-job-03.ini | |
[global] | |
readwrite=rw | |
rwmixread=0 | |
blocksize=512 | |
ioengine=libaio | |
numjobs=4 | |
thread=0 | |
direct=1 | |
iodepth=32 | |
iodepth_batch=16 | |
iodepth_batch_complete=16 | |
group_reporting=1 | |
ramp_time=5 | |
norandommap=1 | |
description=fio sequential 512 write peak IOPS | |
time_based=1 | |
runtime=30 | |
randrepeat=0 | |
[$DEVICE] | |
filename=$DEVICE | |
EOF | |
cat <<EOF > /$HOMEDIR/fio-job-04.ini | |
[global] | |
readwrite=randrw | |
rwmixread=0 | |
blocksize=1M | |
ioengine=libaio | |
numjobs=4 | |
thread=0 | |
direct=1 | |
iodepth=32 | |
iodepth_batch=16 | |
iodepth_batch_complete=16 | |
group_reporting=1 | |
ramp_time=5 | |
norandommap=1 | |
description=fio random 1M write peak BW | |
time_based=1 | |
runtime=30 | |
randrepeat=0 | |
[$DEVICE] | |
filename=$DEVICE | |
EOF | |
cat <<EOF > /$HOMEDIR/fio-job-05.ini | |
[global] | |
readwrite=write | |
rwmixread=0 | |
blocksize=1M | |
ioengine=libaio | |
thread=0 | |
size=100% | |
iodepth=16 | |
group_reporting=1 | |
description=fio PRECONDITION sequential 1M complete write | |
[$DEVICE] | |
filename=$DEVICE | |
EOF | |
cat <<EOF > /$HOMEDIR/fio-job-06.ini | |
[global] | |
readwrite=randrw | |
rwmixread=100 | |
blocksize=512 | |
ioengine=sync | |
numjobs=1 | |
thread=0 | |
direct=1 | |
iodepth=1 | |
iodepth_batch=1 | |
iodepth_batch_complete=1 | |
group_reporting=1 | |
ramp_time=5 | |
norandommap=1 | |
description=fio random 512 read LATENCY | |
time_based=1 | |
runtime=30 | |
randrepeat=0 | |
[$DEVICE] | |
filename=$DEVICE | |
EOF | |
cat <<EOF > /$HOMEDIR/fio-job-07.ini | |
[global] | |
readwrite=randrw | |
rwmixread=100 | |
blocksize=512 | |
ioengine=libaio | |
numjobs=4 | |
thread=0 | |
direct=1 | |
iodepth=32 | |
iodepth_batch=16 | |
iodepth_batch_complete=16 | |
group_reporting=1 | |
ramp_time=5 | |
norandommap=1 | |
description=fio random 512 read peak IOPS | |
time_based=1 | |
runtime=30 | |
randrepeat=0 | |
[$DEVICE] | |
filename=$DEVICE | |
EOF | |
cat <<EOF > /$HOMEDIR/fio-job-08.ini | |
[global] | |
readwrite=rw | |
rwmixread=100 | |
blocksize=512 | |
ioengine=libaio | |
numjobs=4 | |
thread=0 | |
direct=1 | |
iodepth=32 | |
iodepth_batch=16 | |
iodepth_batch_complete=16 | |
group_reporting=1 | |
ramp_time=5 | |
norandommap=1 | |
description=fio sequential 512 read peak IOPS | |
time_based=1 | |
runtime=30 | |
randrepeat=0 | |
[$DEVICE] | |
filename=$DEVICE | |
EOF | |
cat <<EOF > /$HOMEDIR/fio-job-09.ini | |
[global] | |
readwrite=randrw | |
rwmixread=100 | |
blocksize=1M | |
ioengine=libaio | |
numjobs=4 | |
thread=0 | |
direct=1 | |
iodepth=32 | |
iodepth_batch=16 | |
iodepth_batch_complete=16 | |
group_reporting=1 | |
ramp_time=5 | |
norandommap=1 | |
description=fio random 1M read peak BW | |
time_based=1 | |
runtime=30 | |
randrepeat=0 | |
[$DEVICE] | |
filename=$DEVICE | |
EOF | |
echo 'finished writing out jobs' | |
} | |
# Start main run | |
# Write out ini files for jobs, using new random dir in /tmp | |
WriteJobs | |
# move into this run's dir in /tmp so we have access to all the ini files | |
cd $HOMEDIR | |
# check for dstat package | |
if ! rpm -qa | grep -q dstat; then | |
yum -y install dstat | |
fi | |
# check for fio stats package (not fio drivers) | |
if ! rpm -qa | grep -q fio-2; then | |
yum install fio | |
fi | |
#update FIO ini files: | |
sed -i "s#/dev/fioa"#${fiodevice}# fio-job-* | |
#Benchmark testing: | |
#Execute 512B block write tests: | |
umount $fiodevice | |
fio-detach $fiocontroller | |
fio-format $fiocontroller -b 512B -y | |
fio-attach $fiocontroller | |
startperfstats fio-job-01 | |
fio --output=fio.output.01.log fio-job-01.ini | |
stopperfstats | |
fio-detach $fiocontroller | |
fio-format $fiocontroller -b 512B -y | |
fio-attach $fiocontroller | |
startperfstats fio-job-02 | |
fio --output=fio.output.02.log fio-job-02.ini | |
stopperfstats | |
fio-detach $fiocontroller | |
fio-format $fiocontroller -b 512B -y | |
fio-attach $fiocontroller | |
startperfstats fio-job-03 | |
fio --output=fio.output.03.log fio-job-03.ini | |
stopperfstats | |
#Execute 4096B block write tests: | |
fio-detach $fiocontroller | |
fio-format $fiocontroller -b 4096B -y | |
fio-attach $fiocontroller | |
startperfstats fio-job-04 | |
fio --output=fio.output.04.log fio-job-04.ini | |
stopperfstats | |
fio-detach $fiocontroller | |
fio-format $fiocontroller -b 4096B -y | |
fio-attach $fiocontroller | |
#Read Precondition - full device write: | |
startperfstats fio-job-05 | |
fio --output=fio.output.05.log fio-job-05.ini | |
stopperfstats | |
#Large block read test: | |
startperfstats fio-job-09 | |
fio --output=fio.output.09.log fio-job-09.ini | |
stopperfstats | |
#Execute 512B Read tests: | |
fio-detach $fiocontroller | |
fio-format $fiocontroller -b 512B -y | |
fio-attach $fiocontroller | |
#Precondition for reads: | |
fio fio-job-05.ini | |
startperfstats fio-job-06 | |
fio --output=fio.output.06.log fio-job-06.ini | |
stopperfstats | |
startperfstats fio-job-07 | |
fio --output=fio.output.07.log fio-job-07.ini | |
stopperfstats | |
startperfstats fio-job-08 | |
fio --output=fio.output.08.log fio-job-08.ini | |
stopperfstats | |
echo "Finished" | |
exit 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment