3 # This test was used in a set of CMD3 tests (cmd3-5 test).
5 # Directory lookup retrieval rate single directory 10 million files
6 # 5900 random lookups/sec per client node 62,000 random lookups/sec aggregate
8 # In a dir containing 10 million non-striped files the mdsrate Test Program will
9 # perform lookups for 10 minutes. This test can be run from a single node for
10 # #1 and from all nodes for #2 aggregate test to measure lookup performance.
12 LUSTRE=${LUSTRE:-`dirname $0`/..}
13 . $LUSTRE/tests/test-framework.sh
15 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
16 assert_env CLIENTS MDSRATE SINGLECLIENT MPIRUN
18 MACHINEFILE=${MACHINEFILE:-$TMP/$(basename $0 .sh).machines}
19 # Do not use name [df][0-9]* to avoid cleanup by rm, bug 18045
20 TESTDIR=$MOUNT/mdsrate
23 NUM_FILES=${NUM_FILES:-1000000}
24 TIME_PERIOD=${TIME_PERIOD:-600} # seconds
26 LOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
28 NODES_TO_USE=${NODES_TO_USE:-$CLIENTS}
29 NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
33 [ ! -x ${MDSRATE} ] && error "${MDSRATE} not built."
35 log "===== $0 ====== "
37 check_and_setup_lustre
41 IFree=$(inodes_available)
42 if [ $IFree -lt $NUM_FILES ]; then
46 generate_machine_file $NODES_TO_USE $MACHINEFILE || error "can not generate machinefile"
48 $LFS setstripe $TESTDIR -c 1
51 if [ -n "$NOCREATE" ]; then
52 echo "NOCREATE=$NOCREATE => no file creation."
54 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d' --ignore
56 log "===== $0 Test preparation: creating ${NUM_FILES} files."
58 NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
59 NUM_THREADS=$((NUM_CLIENTS * MDSCOUNT))
60 if [ $NUM_CLIENTS -gt 50 ]; then
61 NUM_THREADS=$NUM_CLIENTS
63 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --mknod --dir ${TESTDIR}
64 --nfiles ${NUM_FILES} --filefmt 'f%%d'"
66 mpi_run -np ${NUM_THREADS} -machinefile ${MACHINEFILE} ${COMMAND} 2>&1
68 # No lockup if error occurs on file creation, abort.
69 [ ${PIPESTATUS[0]} != 0 ] && error "mdsrate file creation failed, aborting"
72 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --lookup --time ${TIME_PERIOD} ${SEED_OPTION}
73 --dir ${TESTDIR} --nfiles ${NUM_FILES} --filefmt 'f%%d'"
76 if [ -n "$NOSINGLE" ]; then
77 echo "NO Test for lookups on a single client."
79 log "===== $0 ### 1 NODE LOOKUPS ###"
81 mpi_run -np 1 -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
83 if [ ${PIPESTATUS[0]} != 0 ]; then
84 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
85 error "mdsrate lookups on a single client failed, aborting"
90 [ $NUM_CLIENTS -eq 1 ] && NOMULTI=yes
91 if [ -n "$NOMULTI" ]; then
92 echo "NO test for lookups on multiple nodes."
94 log "===== $0 ### ${NUM_CLIENTS} NODES LOOKUPS ###"
96 mpi_run -np ${NUM_CLIENTS} -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
98 if [ ${PIPESTATUS[0]} != 0 ]; then
99 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
100 error "mdsrate lookups on multiple nodes failed, aborting"
104 equals_msg `basename $0`: test complete, cleaning up
105 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d'
107 check_and_cleanup_lustre