Performance Benchmark Notes 2014

This script was used in the performance benchmarks of this blog post: https://www.upcloud.com/blog/going-beyond-ssd-with-maxiops/

echo "Checking for required dependencies"
function requires() {
if [ `$1 >/dev/null; echo $?` -ne 0 ]; then
TO_INSTALL="$TO_INSTALL $2"
fi
}
function requires_command() {
requires "which $1" $1
}
TO_INSTALL=""
if [ `which apt-get >/dev/null 2>&1; echo $?` -ne 0 ]; then
PACKAGE_MANAGER='yum'
requires 'yum list installed kernel-devel' 'kernel-devel'
requires 'yum list installed libaio-devel' 'libaio-devel'
requires 'yum list installed gcc-c++' 'gcc-c++'
requires 'perl -MTime::HiRes -e 1' 'perl-Time-HiRes'
else
PACKAGE_MANAGER='apt-get'
MANAGER_OPTS='--fix-missing'
UPDATE='apt-get update'
requires 'dpkg -s build-essential' 'build-essential'
requires 'dpkg -s libaio-dev' 'libaio-dev'
requires 'perl -MTime::HiRes -e 1' 'perl'
fi
rm -rf sb-bench
mkdir -p sb-bench
cd sb-bench
requires_command 'gcc'
requires_command 'make'
requires_command 'curl'
requires_command 'traceroute'
if [ "`whoami`" != "root" ]; then
SUDO='sudo'
fi
if [ "$TO_INSTALL" != '' ]; then
echo "Using $PACKAGE_MANAGER to install$TO_INSTALL"
if [ "$UPDATE" != '' ]; then
echo "Doing package update"
$SUDO $UPDATE
fi
$SUDO $PACKAGE_MANAGER install -y $TO_INSTALL $MANAGER_OPTS
fi
FIO_VERSION=2.0.9
FIO_DIR=fio-$FIO_VERSION
# args: [name] [target dir] [url]
function require_download() {
if ! [ -e "`pwd`/$2" ]; then
echo "Downloading $1..."
wget -q --no-check-certificate -O - $3 | tar -xzf -
fi
}
require_download FIO fio-$FIO_DIR https://github.com/Crowd9/Benchmark/raw/master/fio-$FIO_VERSION.tar.gz
cat > $FIO_DIR/reads.ini << EOF [global] randrepeat=1 ioengine=libaio bs=4k ba=4k size=1G direct=1 gtod_reduce=1 norandommap iodepth=64 numjobs=1 [randomreads] startdelay=0 filename=/dev/sdb1 readwrite=randread EOF cat > $FIO_DIR/writes.ini << EOF [global] randrepeat=1 ioengine=libaio bs=4k ba=4k size=1G direct=1 gtod_reduce=1 norandommap iodepth=64 numjobs=1 [randomwrites] startdelay=0 filename=/dev/sdb1 readwrite=randwrite EOF cd $FIO_DIR make echo "FIO random reads: " ./fio reads.ini echo "FIO random writes: " ./fio writes.ini