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_DNE=${DP_DNE:-"no"}
33 DP_DIO=${DP_DIO:-"no"}
35 DOM_SIZE=${DOM_SIZE:-"1M"}
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 1 $DP_NORM ||
52 error "Cannot create test directory for ordinary files"
54 if [ "x$DP_DNE" == "xyes" ] ; then
55 $LFS setdirstripe -i 0 -c 2 $DP_DOM ||
56 error "Cannot create striped directory"
61 $LFS setstripe -E ${DOM_SIZE} -L mdt -E EOF $DP_DOM ||
62 error "Cannot create test directory for dom files"
67 $LCTL set_param -n osc.*.stats=0
68 $LCTL set_param -n mdc.*.stats=0
69 $LCTL set_param -n ${cli}.*.${cli}_stats=0
70 $LCTL set_param -n ${cli}.*.rpc_stats=0
71 $LCTL set_param -n llite.*.read_ahead_stats=0
72 $LCTL set_param -n llite.*.unstable_stats=0
79 echo ----- MDC RPCs: $(calc_stats mdc.*.stats req_active)
80 echo ----- OSC RPCs: $(calc_stats osc.*.stats req_active)
82 if [ "x$DP_STATS" != "xyes" ] ; then
86 $LCTL get_param ${cli}.*.${cli}_stats
87 $LCTL get_param ${cli}.*.rpc_stats
88 # for OSC get both OSC and MDC stats
89 if [ $cli == "osc" ] ; then
90 $LCTL get_param mdc.*.stats
92 $LCTL get_param ${cli}.*.stats
93 $LCTL get_param ${cli}.*.unstable_stats
94 $LCTL get_param ${cli}.*.${cli}_cached_mb
95 $LCTL get_param llite.*.read_ahead_stats
101 cancel_lru_locks $cli
103 $LCTL set_param -n debug=0
109 local cmdlog=$TMP/dp_cmd.log
112 dp_setup_test $DP_OSC
113 if ! grep -qw "$MOUNT" /proc/mounts ; then
114 echo "!!!!! Lustre is not mounted !!!!!, aborting"
118 echo "## $cmd" | awk '{ if (NR==1) {gsub(/[ \t\r\n]+/, " "); \
119 gsub(/\|.*$/, ""); print }}'
120 echo "## $(date +'%F %H:%M:%S'): START"
121 eval $cmd 2>&1 | tee $cmdlog || true
124 if [ $rc -eq 0 ] && grep -q "p4_error:" $cmdlog ; then
128 dp_collect_stats $DP_OSC
129 remount_client $DIR > /dev/null
134 if ! which mdtest > /dev/null 2>&1 ; then
135 echo "Mdtest is not installed, skipping"
139 local mdtest=$(which mdtest)
141 local TDIR=${1:-$MOUNT}
142 local th_num=$((DP_FNUM * 2 / DP_NUM))
145 [ "$SLOW" = "yes" ] && bsizes="4096 16384"
147 for bsize in $bsizes ; do
148 dp_run_cmd "mpirun -np $DP_NUM $mdtest -i 3 -I $th_num -F \
149 -z 1 -b 1 -L -u -w $bsize -R -d $TDIR"
150 if [ ${PIPESTATUS[0]} != 0 ]; then
151 error "MDtest failed, aborting"
160 if [ ! -f createmany ] ; then
161 echo "Createmany is not installed, skipping"
165 if [ ! -f smalliomany ] ; then
166 echo "Smalliomany is not installed, skipping"
170 local TDIR=${1:-$DIR}
173 local MIN=$((count * 16))
174 [ $MDSSIZE -le $MIN ] && count=$((MDSSIZE / 16))
176 dp_run_cmd "./createmany -o $TDIR/file- $count | grep 'total:'"
177 if [ ${PIPESTATUS[0]} != 0 ]; then
178 error "File creation failed, aborting"
181 if [ -f statmany ]; then
182 dp_run_cmd "./statmany -s $TDIR/file- $count $((count * 5)) |
184 if [ ${PIPESTATUS[0]} != 0 ]; then
185 error "File stat failed, aborting"
190 for opc in w a r ; do
191 dp_run_cmd "./smalliomany -${opc} $TDIR/file- $count 300 |
193 if [ ${PIPESTATUS[0]} != 0 ]; then
194 error "SmallIO -${opc} failed, aborting"
199 dp_run_cmd "./unlinkmany $TDIR/file- $count | grep 'total:'"
200 if [ ${PIPESTATUS[0]} != 0 ]; then
201 error "SmallIO failed, aborting"
208 if ! which IOR > /dev/null 2>&1 ; then
209 echo "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}
223 [ "$SLOW" = "yes" ] && bsizes="4 16"
225 for bsize in $bsizes ; do
226 segments=$((128 / bsize))
228 dp_run_cmd "mpirun -np $DP_NUM $IOR \
229 -a POSIX -b ${bsize}K -t ${bsize}K -o $TDIR/ -k \
230 -s $segments -w -r -i $iter -F -E -z -m -Z $direct"
231 if [ ${PIPESTATUS[0]} != 0 ]; then
232 error "IOR write test for ${bsize}K failed, aborting"
235 # check READ performance only (no cache)
236 dp_run_cmd "mpirun -np $DP_NUM $IOR \
237 -a POSIX -b ${bsize}K -t ${bsize}K -o $TDIR/ -X 42\
238 -s $segments -r -i $iter -F -E -z -m -Z $direct"
239 if [ ${PIPESTATUS[0]} != 0 ]; then
240 error "IOR read test for ${bsize}K failed, aborting"
249 if ! which dbench > /dev/null 2>&1 ; then
250 echo "Dbench is not installed, skipping"
254 if [ "x$DP_DNE" == "xyes" ] ; then
255 echo "dbench uses subdirs, skipping for DNE setup"
259 local TDIR=${1:-$MOUNT}
261 dp_run_cmd "dbench -D $TDIR $DP_NUM | egrep -v 'warmup|execute'"
262 if [ ${PIPESTATUS[0]} != 0 ]; then
263 error "Dbench failed, aborting"
271 # https://github.com/axboe/fio/archive/fio-2.8.zip
272 if ! which fio > /dev/null 2>&1 ; then
273 echo "No FIO installed, skipping"
277 local fnum=128 # per thread
278 local total=$((fnum * DP_NUM)) # files in all threads
279 local loops=$((DP_FNUM / total)) # number of loops
283 if [ $loops -eq 0 ] ; then
287 if [ "x$DP_DIO" == "xyes" ] ; then
290 direct="--buffered=1 --bs_unaligned=1"
293 if [ "x$DP_STATS" != "xyes" ] ; then
297 local TDIR=${1:-$MOUNT}
298 base_cmd="fio --name=smallio --ioengine=posixaio $output \
299 --iodepth=$((DP_NUM * 4)) --directory=$TDIR \
300 --nrfiles=$fnum --openfiles=10000 \
301 --numjobs=$DP_NUM --filesize=64k --lockfile=readwrite"
303 dp_run_cmd "$base_cmd --create_only=1" > /dev/null
304 if [ ${PIPESTATUS[0]} != 0 ]; then
305 error "FIO file creation failed, aborting"
309 [ "$SLOW" = "yes" ] && bsizes="4 16"
311 for bsize in $bsizes ; do
312 dp_run_cmd "$base_cmd --bs=${bsize}k --rw=randwrite $direct \
313 --file_service_type=random --randrepeat=1 \
314 --norandommap --group_reporting=1 --loops=$loops |
315 awk -F\; '{printf \"WRITE: BW %dKiB/sec, IOPS %d, \
316 lat (%d/%d/%d)usec\n\",\
317 \$48, \$49, \$53, \$57, \$81}'"
318 if [ ${PIPESTATUS[0]} != 0 ]; then
319 error "FIO write test with ${bsize}k failed, aborting"
322 dp_run_cmd "$base_cmd --bs=${bsize}k --rw=randread $direct \
323 --file_service_type=random --randrepeat=1 \
324 --norandommap --group_reporting=1 --loops=$loops |
325 awk -F\; '{printf \"READ : BW %dKiB/sec, IOPS %d, \
326 lat (%d/%d/%d)usec\n\",\
327 \$7, \$8, \$12, \$16, \$40}'"
328 if [ ${PIPESTATUS[0]} != 0 ]; then
329 error "FIO read test with ${bsize}k failed, aborting"
338 local facets=$(get_facets MDS)
339 local nodes=$(comma_list $(mdts_nodes))
340 local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
342 save_lustre_params $facets "mdt.*.dom_lock" >> $p
344 printf "\n##### $test: DoM files, IO lock on open\n"
345 do_nodes $nodes "lctl set_param -n mdt.*.dom_lock=1"
349 printf "\n##### $test: DoM files, no IO lock on open\n"
350 do_nodes $nodes "lctl set_param -n mdt.*.dom_lock=0"
354 printf "\n##### $test: OST files\n"
358 restore_lustre_params < $p
364 run_test smallio "Performance comparision: smallio"
369 run_test mdtest "Performance comparision: mdtest"
374 run_test IOR "Performance comparision: IOR"
379 run_test dbench "Performance comparision: dbench"
384 run_test fio "Performance comparision: FIO"
386 FAIL_ON_ERROR=$SAVED_FAIL_ON_ERROR
387 $LCTL set_param -n debug="$SAVED_DEBUG"
390 check_and_cleanup_lustre