Skip to content

Instantly share code, notes, and snippets.

@benton
Last active May 13, 2021 21:25
Show Gist options
  • Save benton/a3c09ee3f68962e722106c485a4395bf to your computer and use it in GitHub Desktop.
Save benton/a3c09ee3f68962e722106c485a4395bf to your computer and use it in GitHub Desktop.
tests IO on Docker volume
#!/usr/bin/env bash
# tests IO on Docker volume
set -eox pipefail
TEST_DIR=/var/lib/docker/iotest
EC2_AVAIL_ZONE=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone`
DATE=$(date +"%Y-%m-%dT%H:%M:%S")
TIMESTAMP=$(date +"%Y-%m-%d-%H%M%S")
HOST=`hostname -s`
TESTNAME="${HOST}-${TIMESTAMP}"
OUTFILE=iotest.${TESTNAME}.csv
sudo rm -rf $TEST_DIR
sudo mkdir -p $TEST_DIR
rm -f $OUTFILE
touch $OUTFILE
echo -n "${HOST};${EC2_AVAIL_ZONE};${DATE};" >>$OUTFILE
sudo fio --directory=$TEST_DIR --name "${TESTNAME}-read" \
--direct=1 --rw=randread \
--bs=16k --size=8G --numjobs=16 --time_based --runtime=60 \
--group_reporting --norandommap --output-format=terse \
| tee -a $OUTFILE
echo -n "${HOST};${EC2_AVAIL_ZONE};${DATE};" >>$OUTFILE
sudo fio --directory=$TEST_DIR --ioengine=psync --name "${TESTNAME}-write" \
--direct=1 --rw=randwrite --bs=16k --size=8G --numjobs=16 --time_based \
--runtime=60 --group_reporting --norandommap --output-format=terse \
| tee -a $OUTFILE
sudo rm -rf $TEST_DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment