3 # This script is to be run on a client machine and will test all the
4 # OSTs to determine which is the fastest and slowest
5 # The current test method
6 # Create a directory for each OST
7 # Use 'lfs setstripe' to set the Lustre striping such that IO goes to
9 # Use 'dd' to write a file of a specified size
10 # Use 'dd' to read a file of a specified size
12 # Find the slowest OST
15 declare -a rTime=() # Time to read some data
16 declare -a wTime=() # Time to write some data
17 declare -a rMBs=() # Read speed
18 declare -a wMBs=() # Write speed
21 OSTS=0 # Number of OSTS we will loop over
22 OFILE=testdummy # File name to use
23 BSIZE=1024 # size of blocks to be written
24 MNT='' # Location of Lustre file system
25 DIR="tmpdir" # Name used to create a series of tmp directories
26 VERBOSE=1 # Set this to get verbose output ( TODO - use getopts? )
30 echo "Usage: $0 <size of test file in KB> <Lustre directory>"
36 # check for a mounted Lustre filesystem
37 MNT=`grep lustre /proc/mounts | awk '{print $2}'`
39 echo "Mounted Lustre filesystem not found"
43 # Check for Lustre utilites in PATH
48 # We assume that all devices with 'osc' in the string are OSTs
49 OSTS=`lctl dl | grep -c osc`
53 # Create a file full of zeros
58 dd if=/dev/zero of=$MNT/$DIR/$OFILE count=$SIZE bs=$BSIZE 2> /dev/null
63 echo "$OSTS OST devices found"
65 while [ $CNT -lt $OSTS ]; do
66 echo "Ost index $CNT Read speed ${rMBs[$CNT]} Write speed ${wMBs[$CNT]}"
67 echo "Ost index $CNT Read time ${rTime[$CNT]} Write time ${wTime[$CNT]}"
77 if [ ! -f $MNT/$DIR/$OFILE ] && [ $ACTION == 'read' ]; then
82 if [ $ACTION == 'read' ]; then
83 OUTS=`dd if=$MNT/$DIR/$OFILE of=/dev/null count=$SIZE bs=$BSIZE 2> /dev/null`
84 elif [ $ACTION == 'write' ]; then
85 OUTS=`dd of=$MNT/$DIR/$OFILE if=/dev/zero count=$SIZE bs=$BSIZE 2> /dev/null`
87 echo "Action not read||write"
92 tdelta=`awk "BEGIN {printf \"%7.2f\", $t1 - $t0; exit}"`
93 sdelta=$(( $SIZE * $BSIZE ))
94 delta=`awk "BEGIN {printf \"%7.2f\", ($SIZE * $BSIZE / ( $t1 - $t0 )) / ( 1024 * 1024 ) ; exit}"`
96 if [ $ACTION == 'read' ]; then
108 while [ $CNT -lt $OSTS ]; do
109 if [ $OP == "read" ]; then
110 echo "${rMBs[$CNT]} $OP"
111 elif [ $OP == "write" ]; then
112 echo "${wMBs[$CNT]} $OP"
118 done | awk '{ c++; t+= $1; op = $2 }; END { printf "Average %s Speed: %7.2f\n", op, t/c }'
125 while [ $CNT -lt $OSTS ]; do
126 if [ $OP == "read" ]; then
127 echo "${rMBs[$CNT]} $CNT $OP"
128 elif [ $OP == "write" ]; then
129 echo "${wMBs[$CNT]} $CNT $OP"
136 if (NR == 1) { min = $1; indx = $2; op = $3 }
137 else if (min > $1){ min = $1; indx = $ 2; op = $3}
139 END {printf "%s - Worst OST indx %d %7.2f MB/s\n", op, indx, min}'
145 while [ $CNT -lt $OSTS ]; do
146 if [ $OP == "read" ]; then
147 echo "${rMBs[$CNT]} $CNT $OP"
148 elif [ $OP == "write" ]; then
149 echo "${wMBs[$CNT]} $CNT $OP"
156 if (NR == 1) { max = $1; indx = $2; op = $3 }
157 else if (max < $1){ max = $1; indx = $ 2; op = $3 }
159 END {printf "%s - Best OST indx %d %7.2f MB/s\n", op, indx, max}'
169 while [ $CNT -lt $OSTS ]; do
170 rm -rf $MNT/${DIR}${CNT}
171 mkdir -p $MNT/${DIR}${CNT}
172 lfs setstripe $MNT/${DIR}${CNT} 0 $CNT 1
173 run_test ${DIR}${CNT} $MYSIZE $CNT write
174 run_test ${DIR}${CNT} $MYSIZE $CNT read
182 display_average write
191 if [ $VERBOSE ]; then