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)
28 check_and_setup_lustre
32 DP_DIO=${DP_DIO:-"no"}
34 DOM_SIZE=${DOM_SIZE:-"1M"}
41 DP_DOM_DNE=$DIR/dp_dne
42 DP_STATS=${DP_STATS:-"no"}
44 # total number of files
45 DP_FNUM=${DP_FNUM:-16384}
49 # 1 stripe for normal files
51 $LFS setstripe -c 2 $DP_NORM ||
52 error "Cannot create test directory for ordinary files"
54 if [[ $MDSCOUNT -gt 1 ]] ; then
55 $LFS setdirstripe -i 0 -c $MDSCOUNT $DP_DOM_DNE ||
56 error_noexit "Cannot create striped directory"
57 $LFS setstripe -E ${DOM_SIZE} -L mdt -E EOF $DP_DOM_DNE ||
58 error_noexit "Cannot create test directory for dom files"
62 $LFS setstripe -E ${DOM_SIZE} -L mdt -E EOF $DP_DOM ||
63 error "Cannot create test directory for dom files"
68 $LCTL set_param -n osc.*.stats=0
69 $LCTL set_param -n mdc.*.stats=0
70 $LCTL set_param -n ${cli}.*.${cli}_stats=0
71 $LCTL set_param -n ${cli}.*.rpc_stats=0
72 $LCTL set_param -n llite.*.read_ahead_stats=0
73 $LCTL set_param -n llite.*.unstable_stats=0
80 echo ----- MDC RPCs: $(calc_stats mdc.*.stats req_active)
81 echo ----- OSC RPCs: $(calc_stats osc.*.stats req_active)
83 if [ "x$DP_STATS" != "xyes" ] ; then
87 $LCTL get_param ${cli}.*.${cli}_stats
88 $LCTL get_param ${cli}.*.rpc_stats
89 # for OSC get both OSC and MDC stats
90 if [ $cli == "osc" ] ; then
91 $LCTL get_param mdc.*.stats
93 $LCTL get_param ${cli}.*.stats
94 $LCTL get_param ${cli}.*.unstable_stats
95 $LCTL get_param ${cli}.*.${cli}_cached_mb
96 $LCTL get_param llite.*.read_ahead_stats
102 cancel_lru_locks $cli
103 ### drop all debug except critical
104 $LCTL set_param -n debug="error warning console emerg"
110 local cmdlog=$TMP/dp_cmd.log
113 dp_setup_test $DP_OSC
114 if ! grep -qw "$MOUNT" /proc/mounts ; then
115 echo "!!!!! Lustre is not mounted !!!!!, aborting"
119 echo "## $cmd" | awk '{ if (NR==1) {gsub(/[ \t\r\n]+/, " "); \
120 gsub(/\|.*$/, ""); print }}'
121 echo "## $(date +'%F %H:%M:%S'): START"
122 eval $cmd 2>&1 | tee $cmdlog || true
125 if [ $rc -eq 0 ] && grep -q "p4_error:" $cmdlog ; then
129 dp_collect_stats $DP_OSC
130 remount_client $DIR > /dev/null
135 if ! which mdtest > /dev/null 2>&1 ; then
136 echo "Mdtest is not installed, skipping"
140 local mdtest=$(which mdtest)
142 local TDIR=${1:-$MOUNT}
143 local th_num=$((DP_FNUM * 2 / DP_NUM))
146 [ "$SLOW" = "yes" ] && bsizes="4096 32768"
148 for bsize in $bsizes ; do
149 dp_run_cmd "mpirun -np $DP_NUM $mdtest -i 3 -I $th_num -F \
150 -z 1 -b 1 -L -u -w $bsize -R -d $TDIR"
151 if [ ${PIPESTATUS[0]} != 0 ]; then
152 error "MDtest failed, aborting"
161 if [ ! -f createmany ] ; then
162 echo "Createmany is not installed, skipping"
166 if [ ! -f smalliomany ] ; then
167 echo "Smalliomany is not installed, skipping"
171 local TDIR=${1:-$DIR}
174 local MIN=$((count * 16))
175 [ $MDSSIZE -le $MIN ] && count=$((MDSSIZE / 16))
177 dp_run_cmd "./createmany -o $TDIR/file- $count | grep 'total:'"
178 if [ ${PIPESTATUS[0]} != 0 ]; then
179 error "File creation failed, aborting"
182 if [ -f statmany ]; then
183 dp_run_cmd "./statmany -s $TDIR/file- $count $((count * 5)) |
185 if [ ${PIPESTATUS[0]} != 0 ]; then
186 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 echo "IOR is not installed, skipping"
214 local IOR=$(which IOR)
215 local iter=$((DP_FNUM / DP_NUM))
218 if [ "x$DP_DIO" == "xyes" ] ; then
222 local TDIR=${1:-$MOUNT}
224 [ "$SLOW" = "yes" ] && bsizes="4 32"
226 for bsize in $bsizes ; do
227 segments=$((128 / bsize))
229 dp_run_cmd "mpirun -np $DP_NUM $IOR \
230 -a POSIX -b ${bsize}K -t ${bsize}K -o $TDIR/ -k \
231 -s $segments -w -r -i $iter -F -E -z -m -Z $direct"
232 if [ ${PIPESTATUS[0]} != 0 ]; then
233 error "IOR write test for ${bsize}K failed, aborting"
236 # check READ performance only (no cache)
237 dp_run_cmd "mpirun -np $DP_NUM $IOR \
238 -a POSIX -b ${bsize}K -t ${bsize}K -o $TDIR/ -X 42\
239 -s $segments -r -i $iter -F -E -z -m -Z $direct"
240 if [ ${PIPESTATUS[0]} != 0 ]; then
241 error "IOR read test for ${bsize}K failed, aborting"
250 if ! which dbench > /dev/null 2>&1 ; then
251 echo "Dbench is not installed, skipping"
255 local TDIR=${1:-$MOUNT}
257 if [ "x$DP_DOM_DNE" == "x$TDIR" ] ; then
258 echo "dbench uses subdirs, skipping for DNE dir"
262 dp_run_cmd "dbench -D $TDIR $DP_NUM | egrep -v 'warmup|execute'"
263 if [ ${PIPESTATUS[0]} != 0 ]; then
264 error "Dbench failed, aborting"
272 # https://github.com/axboe/fio/archive/fio-2.8.zip
273 if ! which fio > /dev/null 2>&1 ; then
274 echo "No FIO installed, skipping"
278 local fnum=128 # per thread
279 local total=$((fnum * DP_NUM)) # files in all threads
280 local loops=$((DP_FNUM / total)) # number of loops
284 if [ $loops -eq 0 ] ; then
288 if [ "x$DP_DIO" == "xyes" ] ; then
291 direct="--buffered=1 --bs_unaligned=1"
294 if [ "x$DP_STATS" != "xyes" ] ; then
298 local TDIR=${1:-$MOUNT}
299 base_cmd="fio --name=smallio --ioengine=posixaio $output \
300 --iodepth=$((DP_NUM * 4)) --directory=$TDIR \
301 --nrfiles=$fnum --openfiles=10000 \
302 --numjobs=$DP_NUM --filesize=64k --lockfile=readwrite"
304 dp_run_cmd "$base_cmd --create_only=1" > /dev/null
305 if [ ${PIPESTATUS[0]} != 0 ]; then
306 error "FIO file creation failed, aborting"
310 [ "$SLOW" = "yes" ] && bsizes="4 32"
312 for bsize in $bsizes ; do
313 local write_cmd="$base_cmd --bs=${bsize}k --rw=randwrite \
314 $direct --file_service_type=random --randrepeat=1 \
315 --norandommap --group_reporting=1 --loops=$loops"
316 if [ "x$DP_STATS" != "xyes" ] ; then
317 dp_run_cmd "$write_cmd | awk -F\; '{printf \"WRITE: \
318 BW %dKiB/sec, IOPS %d, lat (%d/%d/%d)usec\n\", \
319 \$48, \$49, \$53, \$57, \$81}'"
321 dp_run_cmd "$write_cmd"
323 if [ ${PIPESTATUS[0]} != 0 ]; then
324 error "FIO write test with ${bsize}k failed, aborting"
327 local read_cmd="$base_cmd --bs=${bsize}k --rw=randread \
328 $direct --file_service_type=random --randrepeat=1 \
329 --norandommap --group_reporting=1 --loops=$loops"
330 if [ "x$DP_STATS" != "xyes" ] ; then
331 dp_run_cmd "$read_cmd | awk -F\; '{printf \"READ : \
332 BW %dKiB/sec, IOPS %d, lat (%d/%d/%d)usec\n\", \
333 \$7, \$8, \$12, \$16, \$40}'"
335 dp_run_cmd "$read_cmd"
337 if [ ${PIPESTATUS[0]} != 0 ]; then
338 error "FIO read test with ${bsize}k failed, aborting"
346 if ! which compilebench > /dev/null 2>&1 ; then
347 echo "Compilebench is not installed, skipping"
351 local TDIR=${1:-$MOUNT}
353 dp_run_cmd "compilebench -D $TDIR -i 2 -r 2 --makej"
354 if [ ${PIPESTATUS[0]} != 0 ]; then
355 error "Compilebench failed, aborting"
363 local facets=$(get_facets MDS)
364 local nodes=$(comma_list $(mdts_nodes))
365 local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
367 save_lustre_params $facets "mdt.*.dom_lock" >> $p
369 printf "\n##### $test: DoM files\n"
370 do_nodes $nodes "lctl set_param -n mdt.*.dom_lock=1"
374 if [ -d $DP_DOM_DNE ] ; then
375 printf "\n##### $test: DoM files + DNE\n"
377 run_${test} $DP_DOM_DNE
380 printf "\n##### $test: OST files\n"
384 restore_lustre_params < $p
391 run_test smallio "Performance comparision: smallio"
396 run_test mdtest "Performance comparision: mdtest"
401 run_test IOR "Performance comparision: IOR"
406 run_test dbench "Performance comparision: dbench"
411 run_test fio "Performance comparision: FIO"
414 dp_test_run compbench
416 run_test compbench "Performance comparision: compilebench"
418 FAIL_ON_ERROR=$SAVED_FAIL_ON_ERROR
419 $LCTL set_param -n debug="$SAVED_DEBUG"
422 check_and_cleanup_lustre