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 # --random_order (default) -OR- --readdir_order
29 DIR_ORDER=${DIR_ORDER:-"--readdir_order"}
31 LOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
33 NODES_TO_USE=${NODES_TO_USE:-$CLIENTS}
34 NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
38 [ ! -x ${MDSRATE} ] && error "${MDSRATE} not built."
40 log "===== $0 ====== "
42 check_and_setup_lustre
46 IFree=$(inodes_available)
47 if [ $IFree -lt $NUM_FILES ]; then
51 generate_machine_file $NODES_TO_USE $MACHINEFILE || error "can not generate machinefile"
53 $LFS setstripe $TESTDIR -i 0 -c 1
56 if [ -n "$NOCREATE" ]; then
57 echo "NOCREATE=$NOCREATE => no file creation."
59 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d' --ignore
61 log "===== $0 Test preparation: creating ${NUM_FILES} files."
63 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --mknod --dir ${TESTDIR}
64 --nfiles ${NUM_FILES} --filefmt 'f%%d'"
67 NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
68 NUM_THREADS=$((NUM_CLIENTS * MDSCOUNT))
69 if [ $NUM_CLIENTS -gt 50 ]; then
70 NUM_THREADS=$NUM_CLIENTS
73 mpi_run -np ${NUM_THREADS} -machinefile ${MACHINEFILE} ${COMMAND} 2>&1
74 [ ${PIPESTATUS[0]} != 0 ] && error "mdsrate file creation failed, aborting"
78 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --stat --time ${TIME_PERIOD}
79 --dir ${TESTDIR} --nfiles ${NUM_FILES} --filefmt 'f%%d'
80 ${DIR_ORDER} ${SEED_OPTION}"
83 if [ -n "$NOSINGLE" ]; then
84 echo "NO Test for stats on a single client."
86 log "===== $0 ### 1 NODE STAT ###"
89 mpi_run -np 1 -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
91 if [ ${PIPESTATUS[0]} != 0 ]; then
92 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
93 error "mdsrate on a single client failed, aborting"
98 [ $NUM_CLIENTS -eq 1 ] && NOMULTI=yes
99 if [ -n "$NOMULTI" ]; then
100 echo "NO test for stats on multiple nodes."
102 log "===== $0 ### ${NUM_CLIENTS} NODES STAT ###"
105 mpi_run -np ${NUM_CLIENTS} -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
107 if [ ${PIPESTATUS[0]} != 0 ]; then
108 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
109 error "mdsrate stats on multiple nodes failed, aborting"
113 equals_msg `basename $0`: test complete, cleaning up
114 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d'
116 check_and_cleanup_lustre