#!/bin/sh # ioperftest.sh: Drive an iozone-based performance test. # # Doug White # # This script sets up 4 runs of iozone for the system configuration # given in the configuration file specified. The config file specifies: # # System name and version and RAID parameters # Target filesystem to run tests against # Size of the test files # # The script will also capture the system architecture. # # The test is set up to run iozone with an increasing number of children. # It will run the test with 1, 2, 4, then 8 children to test how well the # system handles more and more diverse I/O patterns. # # The configuration file looks like this: # ## ioperftest example configuration file ## ## description: Description of this config or system (informational) #description Example configuration ## ## output-location: Where to place the output of the tests. ## The script creates directories and files under this point ## corresponding to the system architecture and version. #output-location: /home/dwhite/iotest/output ## ## target-filesystem: Location to place the test files in, ## passed as the -F option to iozone; the script ## creates subdirectories under this point. The user running ## the script must be able to create directories here. #target-filesystem /test/dwhite ## ## The next two options allow for humanized numbers. ## The suffix 'k' means kilobytes and 'g' means gigabytes. ## ## filesize: Size of the files to create. Passed to iozone as ## the -s option. #filesize 10g ## ## iosize: Size of the I/O blocks to read or write. Passed to ## iozone as the -r option. #iosize 128k ## ## The following config directives are optional. ## ## iozone-path: Path to the iozone binary. Defaults to ## searching PATH. ## iozone-path /usr/local/bin/iozone-278 # description= outroot= targroot= filesize= iosize= iozone="iozone" DESCRIPTION= OUTROOT= TARGROOT= FILESIZE= IOSIZE= IOZONE="iozone" export description outroot targroot filesize iosize iozone export DESCRIPTION export OUTROOT export TARGROOT export FILESIZE export IOSIZE export IOZONE # Check arguments if [ $# -ne 1 ] ; then echo "usage: $0 configfile" exit 1 fi configfile=$1 if [ ! -r $configfile ] ; then echo "$0: Config file $1 is not readable" exit 2 fi # Slurp config egrep -v '^#|^$' $configfile | while read line; do set $line case $1 in description) shift; description=$* export description ;; output-location) outroot=$2 export outroot ;; target-filesystem) targroot=$2 export targroot ;; filesize) filesize=$2 export filesize ;; iosize) iosize=$2 export iosize ;; iozone-path) iozone=$2 export iozone ;; *) echo "$0: Unknown configuration directive: $1" exit 3 ;; esac echo $description $outroot $targroot $filesize $iosize $iozone done # Make sure we have the required items set if [ -z ${outroot} ] ; then echo "$0: Output directory not specified" exit 4 fi if [ -z ${targroot} ] ; then echo "$0: Target filesystem not specified" exit 4 fi if [ -z $filesize ] ; then echo "$0: Output filesize not specified" exit 4 fi if [ -z $iosize ] ; then echo "$0: I/O blocksize not specified" exit 4 fi targ=$targroot/ioperf # Grab some system information set -- `uname -prs` osname=$1 osrel=$2 archname=$3 echo "$0: Running test on $osname $osrel on $archname" # Barf if anything past here fails since its probably a perms issue set -e # Set the location of the output file outdir=$outroot/$osname/$archname/$osrel mkdir -p $outdir # Find the next available run number outfile="" runnum=1 while true ; do outfile=${outdir}/${runnum}.txt if [ -f $outfile ] ; then runnum=$(($runnum+1)) else break fi done echo "$0: Writing test output to $outfile" touch $outfile # Wipe any preexisting test files if [ -d $targ ] ; then echo "$0: Trashing existing test files" rm -rf $targ fi # Construct the output directory mkdir -p $targ # Run our tests for numchildren in 1 2 4 8 ; do i=1 outdirs="" while [ i -le $numchildren ] ; do outdirs="$outdirs $targroot/$i" i=$(($i+1)) done echo "$0: Output directory list: $outdirs" echo "$0: Iozone command line:" echo $iozone -s $filesize -r $iosize -i 0 -i 1 -R -t $numchildren -F $outdirs # $iozone -s $filesize -r $iosize -i 0 -i 1 -R -t $numchildren -F $outdirs >> $outfile done echo "$0: Tests done"