3 # This test was used in a set of CMD3 tests (cmd3-7 test).
5 # File attribute retrieval rate for small file creation
6 # 3200 ops/sec for single node 29,000 ops/sec aggregate
8 # In a dir containing 10 million non-striped files, the mdsrate Test Program
9 # will perform directory ordered stat's (readdir) for 10 minutes. This test
10 # will be run from a single node for #1 and from all nodes for #2
11 # aggregate test to measure stat performance.
13 LUSTRE=${LUSTRE:-`dirname $0`/..}
14 . $LUSTRE/tests/test-framework.sh
16 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
18 assert_env CLIENTS MDSRATE SINGLECLIENT MPIRUN
20 MACHINEFILE=${MACHINEFILE:-$TMP/$(basename $0 .sh).machines}
21 # Do not use name [df][0-9]* to avoid cleanup by rm, bug 18045
22 TESTDIR=$MOUNT/mdsrate
25 NUM_FILES=${NUM_FILES:-1000000}
26 TIME_PERIOD=${TIME_PERIOD:-600} # seconds
28 LOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
30 NODES_TO_USE=${NODES_TO_USE:-$CLIENTS}
31 NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
35 [ ! -x ${MDSRATE} ] && error "${MDSRATE} not built."
37 log "===== $0 ====== "
39 check_and_setup_lustre
43 IFree=$(mdsrate_inodes_available)
44 if [ $IFree -lt $NUM_FILES ]; then
48 generate_machine_file $NODES_TO_USE $MACHINEFILE || error "can not generate machinefile"
50 $LFS setstripe $TESTDIR -i 0 -c 1
53 if [ -n "$NOCREATE" ]; then
54 echo "NOCREATE=$NOCREATE => no file creation."
56 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d' --ignore
58 log "===== $0 Test preparation: creating ${NUM_FILES} files."
60 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --mknod --dir ${TESTDIR}
61 --nfiles ${NUM_FILES} --filefmt 'f%%d'"
64 mpi_run -np ${NUM_CLIENTS} -machinefile ${MACHINEFILE} ${COMMAND} 2>&1
65 [ ${PIPESTATUS[0]} != 0 ] && error "mdsrate file creation failed, aborting"
69 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --stat --time ${TIME_PERIOD}
70 --dir ${TESTDIR} --nfiles ${NUM_FILES} --filefmt 'f%%d'"
73 if [ -n "$NOSINGLE" ]; then
74 echo "NO Test for stats on a single client."
76 log "===== $0 ### 1 NODE STAT ###"
79 mpi_run -np 1 -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
81 if [ ${PIPESTATUS[0]} != 0 ]; then
82 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
83 error "mdsrate on a single client failed, aborting"
88 [ $NUM_CLIENTS -eq 1 ] && NOMULTI=yes
89 if [ -n "$NOMULTI" ]; then
90 echo "NO test for stats on multiple nodes."
92 log "===== $0 ### ${NUM_CLIENTS} NODES STAT ###"
95 mpi_run -np ${NUM_CLIENTS} -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
97 if [ ${PIPESTATUS[0]} != 0 ]; then
98 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
99 error "mdsrate stats on multiple nodes failed, aborting"
103 equals_msg `basename $0`: test complete, cleaning up
104 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d'
106 check_and_cleanup_lustre