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 BASEDIR=$MOUNT/mdsrate
21 TESTDIR=$BASEDIR/lookup
24 NUM_FILES=${NUM_FILES:-1000000}
25 TIME_PERIOD=${TIME_PERIOD:-600} # seconds
27 LOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
29 NODES_TO_USE=${NODES_TO_USE:-$CLIENTS}
30 NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
34 [ ! -x ${MDSRATE} ] && error "${MDSRATE} not built."
36 log "===== $0 ====== "
38 check_and_setup_lustre
42 $LFS setstripe $BASEDIR -c 1
45 IFree=$(mdsrate_inodes_available)
46 if [ $IFree -lt $NUM_FILES ]; then
50 generate_machine_file $NODES_TO_USE $MACHINEFILE || error "can not generate machinefile"
52 if [ -n "$NOCREATE" ]; then
53 echo "NOCREATE=$NOCREATE => no file creation."
55 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d' --ignore
57 log "===== $0 Test preparation: creating ${NUM_FILES} files."
59 NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
60 NUM_THREADS=$((NUM_CLIENTS * MDSCOUNT))
61 if [ $NUM_CLIENTS -gt 50 ]; then
62 NUM_THREADS=$NUM_CLIENTS
64 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --mknod --dir ${TESTDIR}
65 --nfiles ${NUM_FILES} --filefmt 'f%%d'"
67 mpi_run -np ${NUM_THREADS} -machinefile ${MACHINEFILE} ${COMMAND} 2>&1
69 # No lockup if error occurs on file creation, abort.
70 [ ${PIPESTATUS[0]} != 0 ] && error "mdsrate file creation failed, aborting"
73 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --lookup --time ${TIME_PERIOD} ${SEED_OPTION}
74 --dir ${TESTDIR} --nfiles ${NUM_FILES} --filefmt 'f%%d'"
77 if [ -n "$NOSINGLE" ]; then
78 echo "NO Test for lookups on a single client."
80 log "===== $0 ### 1 NODE LOOKUPS ###"
82 mpi_run -np 1 -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
84 if [ ${PIPESTATUS[0]} != 0 ]; then
85 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
86 error "mdsrate lookups on a single client failed, aborting"
91 [ $NUM_CLIENTS -eq 1 ] && NOMULTI=yes
92 if [ -n "$NOMULTI" ]; then
93 echo "NO test for lookups on multiple nodes."
95 log "===== $0 ### ${NUM_CLIENTS} NODES LOOKUPS ###"
97 mpi_run -np ${NUM_CLIENTS} -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
99 if [ ${PIPESTATUS[0]} != 0 ]; then
100 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
101 error "mdsrate lookups on multiple nodes failed, aborting"
105 equals_msg `basename $0`: test complete, cleaning up
106 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d'
107 rmdir $BASEDIR || true
109 check_and_cleanup_lustre