3 # This test was used in a set of CMD3 tests (cmd3-8 test).
5 # File attribute retrieval rate for large file creation
6 # 3300 ops/sec/OST for single node 28500 ops/sec/OST aggregate
8 # In a dir containing 10 million striped files, the mdsrate Test Program will
9 # perform directory ordered stat's (readdir) for 10 minutes. This test will be
10 # run from a single node for #1 and from all nodes for #2 aggregate test to
11 # 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 BASEDIR=$MOUNT/mdsrate
26 NUM_FILES=${NUM_FILES:-1000000}
27 TIME_PERIOD=${TIME_PERIOD:-600} # seconds
29 LOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
31 NODES_TO_USE=${NODES_TO_USE:-$CLIENTS}
32 NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
36 [ ! -x ${MDSRATE} ] && error "${MDSRATE} not built."
38 log "===== $0 ====== "
40 check_and_setup_lustre
44 $LFS setstripe $BASEDIR -c -1
47 IFree=$(mdsrate_inodes_available)
48 if [ $IFree -lt $NUM_FILES ]; then
52 generate_machine_file $NODES_TO_USE $MACHINEFILE || error "can not generate machinefile"
54 if [ -n "$NOCREATE" ]; then
55 echo "NOCREATE=$NOCREATE => no file creation."
57 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d' --ignore
59 log "===== $0 Test preparation: creating ${NUM_FILES} files."
61 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --create --dir ${TESTDIR}
62 --nfiles ${NUM_FILES} --filefmt 'f%%d'"
65 NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
66 NUM_THREADS=$((NUM_CLIENTS * MDSCOUNT))
67 if [ $NUM_CLIENTS -gt 50 ]; then
68 NUM_THREADS=$NUM_CLIENTS
71 mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} -np ${NUM_THREADS} \
74 if [ ${PIPESTATUS[0]} != 0 ]; then
75 error_noexit "mdsrate file creation failed, aborting"
76 mdsrate_cleanup $NUM_THREADS $MACHINEFILE $NUM_FILES \
77 $TESTDIR 'f%%d' --ignore
82 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --stat --time ${TIME_PERIOD}
83 --dir ${TESTDIR} --nfiles ${NUM_FILES} --filefmt 'f%%d'"
86 if [ -n "$NOSINGLE" ]; then
87 echo "NO Test for stats on a single client."
89 log "===== $0 ### 1 NODE STAT ###"
92 mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} -np 1 ${COMMAND} |
95 if [ ${PIPESTATUS[0]} != 0 ]; then
96 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
97 error_noexit "mdsrate stat on single client failed, aborting"
98 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \
99 $TESTDIR 'f%%d' --ignore
105 [ $NUM_CLIENTS -eq 1 ] && NOMULTI=yes
106 if [ -n "$NOMULTI" ]; then
107 echo "NO test for stats on multiple nodes."
109 log "===== $0 ### ${NUM_CLIENTS} NODES STAT ###"
112 mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} -np ${NUM_CLIENTS} \
113 ${COMMAND} | tee ${LOG}
115 if [ ${PIPESTATUS[0]} != 0 ]; then
116 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
117 error_noexit "mdsrate stat on multiple nodes failed, aborting"
118 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \
119 $TESTDIR 'f%%d' --ignore
126 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d'
127 rmdir $BASEDIR || true
129 check_and_cleanup_lustre