3 # Run select tests by setting ONLY, or as arguments to the script.
4 # Skip specific tests by setting EXCEPT.
10 ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"$DOM_PERFORMANCE_EXCEPT"}
11 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
13 [ "$SLOW" = "no" ] && EXCEPT_SLOW=""
15 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
17 . $LUSTRE/tests/test-framework.sh
20 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
23 SAVED_FAIL_ON_ERROR=$FAIL_ON_ERROR
26 SAVED_DEBUG=$($LCTL get_param -n debug 2> /dev/null)
29 . $LUSTRE/tests/functions.sh
31 check_and_setup_lustre
33 # if MACHINEFILE set and exists -- use it
34 MACHINEFILE=${MACHINEFILE:-$TMP/$(basename $0 .sh)-$(hostname).machines}
35 clients=${CLIENTS:-$HOSTNAME}
36 generate_machine_file $clients $MACHINEFILE ||
37 error "Failed to generate machine file"
39 DP_DIO=${DP_DIO:-"no"}
41 DOM_SIZE=${DOM_SIZE:-"1M"}
46 DP_DOM_DNE=$DIR/dp_dne
47 DP_STATS=${DP_STATS:-"no"}
52 rm -rf $DP_NORM $DP_DOM $DP_DOM_DNE
55 # total number of files
56 DP_FNUM=${DP_FNUM:-16384}
60 # 1 stripe for normal files
62 $LFS setstripe -c 2 $DP_NORM ||
63 error "Cannot create test directory for ordinary files"
65 if [[ $MDSCOUNT -gt 1 ]] ; then
66 $LFS setdirstripe -i 0 -c $MDSCOUNT $DP_DOM_DNE ||
67 error_noexit "Cannot create striped directory"
68 $LFS setstripe -E ${DOM_SIZE} -L mdt -E EOF $DP_DOM_DNE ||
69 error_noexit "Cannot create test directory for dom files"
73 $LFS setstripe -E ${DOM_SIZE} -L mdt -E EOF $DP_DOM ||
74 error "Cannot create test directory for dom files"
79 $LCTL set_param -n osc.*.stats=0
80 $LCTL set_param -n mdc.*.stats=0
81 $LCTL set_param -n ${cli}.*.${cli}_stats=0
82 $LCTL set_param -n ${cli}.*.rpc_stats=0
83 $LCTL set_param -n llite.*.read_ahead_stats=0
84 $LCTL set_param -n llite.*.unstable_stats=0
91 echo ----- MDC RPCs: $(calc_stats mdc.*.stats req_active)
92 echo ----- OSC RPCs: $(calc_stats osc.*.stats req_active)
94 if [ "x$DP_STATS" != "xyes" ] ; then
98 $LCTL get_param ${cli}.*.${cli}_stats
99 $LCTL get_param ${cli}.*.rpc_stats
100 # for OSC get both OSC and MDC stats
101 if [ $cli == "osc" ] ; then
102 $LCTL get_param mdc.*.stats
104 $LCTL get_param ${cli}.*.stats
105 $LCTL get_param ${cli}.*.unstable_stats
106 $LCTL get_param ${cli}.*.${cli}_cached_mb
107 $LCTL get_param llite.*.read_ahead_stats
113 cancel_lru_locks $cli
114 ### drop all debug except critical
115 $LCTL set_param -n debug="error warning console emerg"
121 local cmdlog=$TMP/dp_cmd.log
124 dp_setup_test $DP_OSC
125 if ! grep -qw "$MOUNT" /proc/mounts ; then
126 echo "!!!!! Lustre is not mounted !!!!!, aborting"
130 echo "## $cmd" | awk '{ if (NR==1) {gsub(/[ \t\r\n]+/, " "); \
131 gsub(/\|.*$/, ""); print }}'
132 echo "## $(date +'%F %H:%M:%S'): START"
133 eval $cmd 2>&1 | tee $cmdlog || true
136 if [ $rc -eq 0 ] && grep -q "p4_error:" $cmdlog ; then
140 dp_collect_stats $DP_OSC
141 remount_client $DIR > /dev/null
146 if ! which mdtest > /dev/null 2>&1 ; then
147 skip_env "Mdtest is not installed, skipping"
150 local mdtest=$(which mdtest)
152 local TDIR=${1:-$MOUNT}
153 local th_num=$((DP_FNUM * 2 / DP_NUM))
158 [ "$SLOW" = "yes" ] && bsizes="4096 32768"
160 for bsize in $bsizes ; do
161 dp_run_cmd "mpi_run -np $DP_NUM $mdtest -i 3 -I $th_num -F \
162 -z 1 -b 1 -L -u -w $bsize -R -d $TDIR"
163 if [ ${PIPESTATUS[0]} != 0 ]; then
164 error "MDtest failed, aborting"
173 local TDIR=${1:-$DIR}
176 local MIN=$((count * 16))
177 local mdssize=$(mdssize_from_index $TDIR 0)
178 [ $mdssize -le $MIN ] && count=$((mdssize / 16))
180 dp_run_cmd "createmany -o $TDIR/file- $count | grep 'total:'"
181 if [ ${PIPESTATUS[0]} != 0 ]; then
182 error "File creation failed, aborting"
185 dp_run_cmd "statmany -s $TDIR/file- $count $((count * 5)) |
187 if [ ${PIPESTATUS[0]} != 0 ]; then
188 error "File stat failed, aborting"
191 for opc in w a r ; do
192 dp_run_cmd "smalliomany -${opc} $TDIR/file- $count 300 |
194 if [ ${PIPESTATUS[0]} != 0 ]; then
195 error "SmallIO -${opc} failed, aborting"
200 dp_run_cmd "unlinkmany $TDIR/file- $count | grep 'total:'"
201 if [ ${PIPESTATUS[0]} != 0 ]; then
202 error "SmallIO failed, aborting"
209 if ! which IOR > /dev/null 2>&1 ; then
210 skip_env "IOR is not installed, skipping"
213 local IOR=$(which IOR)
214 local iter=$((DP_FNUM / DP_NUM))
217 if [ "x$DP_DIO" == "xyes" ] ; then
221 local TDIR=${1:-$MOUNT}
226 [ "$SLOW" = "yes" ] && bsizes="4 32"
228 for bsize in $bsizes ; do
229 segments=$((128 / bsize))
231 dp_run_cmd "mpi_run -np $DP_NUM $IOR \
232 -a POSIX -b ${bsize}K -t ${bsize}K -o $TDIR/ -k \
233 -s $segments -w -r -i $iter -F -E -z -m -Z $direct" |
234 awk '($1 !~ /^(write|read|access)$/) || NF>12 {print}'
235 if [ ${PIPESTATUS[0]} != 0 ]; then
236 error "IOR write test for ${bsize}K failed, aborting"
239 # check READ performance only (no cache)
240 dp_run_cmd "mpi_run -np $DP_NUM $IOR \
241 -a POSIX -b ${bsize}K -t ${bsize}K -o $TDIR/ -X 42\
242 -s $segments -r -i $iter -F -E -z -m -Z $direct" |
243 awk '($1 !~ /^(read|access|remove)$/) || NF>12 {print}'
244 if [ ${PIPESTATUS[0]} != 0 ]; then
245 error "IOR read test for ${bsize}K failed, aborting"
254 if ! which dbench > /dev/null 2>&1 ; then
255 skip_env "Dbench is not installed, skipping"
258 local TDIR=${1:-$MOUNT}
260 if [ "x$DP_DOM_DNE" == "x$TDIR" ] ; then
261 echo "dbench uses subdirs, skipping for DNE dir"
265 dp_run_cmd "dbench -D $TDIR $DP_NUM | egrep -v 'warmup|execute'"
266 if [ ${PIPESTATUS[0]} != 0 ]; then
267 error "Dbench failed, aborting"
275 # https://github.com/axboe/fio/archive/fio-2.8.zip
276 if ! which fio > /dev/null 2>&1 ; then
277 skip_env "No FIO installed, skipping"
280 local fnum=128 # per thread
281 local total=$((fnum * DP_NUM)) # files in all threads
282 local loops=$((DP_FNUM / total)) # number of loops
286 if [ $loops -eq 0 ] ; then
290 if [ "x$DP_DIO" == "xyes" ] ; then
293 direct="--buffered=1 --bs_unaligned=1"
296 if [ "x$DP_STATS" != "xyes" ] ; then
300 local TDIR=${1:-$MOUNT}
301 base_cmd="fio --name=smallio --ioengine=posixaio $output \
302 --iodepth=$((DP_NUM * 4)) --directory=$TDIR \
303 --nrfiles=$fnum --openfiles=10000 \
304 --numjobs=$DP_NUM --filesize=64k --lockfile=readwrite"
306 dp_run_cmd "$base_cmd --create_only=1" > /dev/null
307 if [ ${PIPESTATUS[0]} != 0 ]; then
308 error "FIO file creation failed, aborting"
312 [ "$SLOW" = "yes" ] && bsizes="4 32"
314 for bsize in $bsizes ; do
315 local write_cmd="$base_cmd --bs=${bsize}k --rw=randwrite \
316 $direct --file_service_type=random --randrepeat=1 \
317 --norandommap --group_reporting=1 --loops=$loops"
318 if [ "x$DP_STATS" != "xyes" ] ; then
319 dp_run_cmd "$write_cmd | awk -F\; '{printf \"WRITE: \
320 BW %dKiB/sec, IOPS %d, lat (%d/%d/%d)usec\n\", \
321 \$48, \$49, \$53, \$57, \$81}'"
323 dp_run_cmd "$write_cmd"
325 if [ ${PIPESTATUS[0]} != 0 ]; then
326 error "FIO write test with ${bsize}k failed, aborting"
329 local read_cmd="$base_cmd --bs=${bsize}k --rw=randread \
330 $direct --file_service_type=random --randrepeat=1 \
331 --norandommap --group_reporting=1 --loops=$loops"
332 if [ "x$DP_STATS" != "xyes" ] ; then
333 dp_run_cmd "$read_cmd | awk -F\; '{printf \"READ : \
334 BW %dKiB/sec, IOPS %d, lat (%d/%d/%d)usec\n\", \
335 \$7, \$8, \$12, \$16, \$40}'"
337 dp_run_cmd "$read_cmd"
339 if [ ${PIPESTATUS[0]} != 0 ]; then
340 error "FIO read test with ${bsize}k failed, aborting"
349 if [ x$cbench_DIR = x ]; then
350 compilebench=$(which compilebench 2> /dev/null)
353 [ -x compilebench ] ||
354 skip_env "compilebench is missing in $cbench_DIR"
355 compilebench=compilebench
358 [ x$compilebench != x ] ||
359 skip_env "Compilebench is not installed, skipping"
361 local TDIR=${1:-$MOUNT}
363 dp_run_cmd "$compilebench -D $TDIR -i 2 -r 2 --makej"
364 if [ ${PIPESTATUS[0]} != 0 ]; then
365 error "Compilebench failed, aborting"
373 local facets=$(get_facets MDS)
374 local nodes=$(comma_list $(mdts_nodes))
375 local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
377 save_lustre_params $facets "mdt.*.dom_lock" >> $p
379 printf "\n##### $test: DoM files\n"
380 do_nodes $nodes "lctl set_param -n mdt.*.dom_lock=1"
384 if [ -d $DP_DOM_DNE ] ; then
385 printf "\n##### $test: DoM files + DNE\n"
387 run_${test} $DP_DOM_DNE
390 printf "\n##### $test: OST files\n"
394 restore_lustre_params < $p
401 run_test smallio "Performance comparision: smallio"
406 run_test mdtest "Performance comparision: mdtest"
411 run_test IOR "Performance comparision: IOR"
416 run_test dbench "Performance comparision: dbench"
421 run_test fio "Performance comparision: FIO"
424 dp_test_run compbench
426 run_test compbench "Performance comparision: compilebench"
428 FAIL_ON_ERROR=$SAVED_FAIL_ON_ERROR
429 $LCTL set_param -n debug="$SAVED_DEBUG"
432 check_and_cleanup_lustre