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 ${MACHINEFILE_OPTION} ${MACHINEFILE} -np ${NUM_THREADS} \
70 # No lockup if error occurs on file creation, abort.
71 if [ ${PIPESTATUS[0]} != 0 ]; then
72 error_noexit "mdsrate file creation failed, aborting"
73 mdsrate_cleanup $NUM_THREADS $MACHINEFILE $NUM_FILES \
74 $TESTDIR 'f%%d' --ignore
79 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --lookup --time ${TIME_PERIOD} ${SEED_OPTION}
80 --dir ${TESTDIR} --nfiles ${NUM_FILES} --filefmt 'f%%d'"
83 if [ -n "$NOSINGLE" ]; then
84 echo "NO Test for lookups on a single client."
86 log "===== $0 ### 1 NODE LOOKUPS ###"
88 mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} -np 1 ${COMMAND} |
91 if [ ${PIPESTATUS[0]} != 0 ]; then
92 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
93 error_noexit "mdsrate lookup on single client failed, aborting"
94 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \
95 $TESTDIR 'f%%d' --ignore
101 [ $NUM_CLIENTS -eq 1 ] && NOMULTI=yes
102 if [ -n "$NOMULTI" ]; then
103 echo "NO test for lookups on multiple nodes."
105 log "===== $0 ### ${NUM_CLIENTS} NODES LOOKUPS ###"
107 mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} -np ${NUM_CLIENTS} \
108 ${COMMAND} | tee ${LOG}
110 if [ ${PIPESTATUS[0]} != 0 ]; then
111 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
112 error_noexit "mdsrate lookup on multiple nodes failed, aborting"
113 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \
114 $TESTDIR 'f%%d' --ignore
120 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d'
121 rmdir $BASEDIR || true
123 check_and_cleanup_lustre