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."
57 echo "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 "mpirun ... 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 ###"
81 echo "Running lookups on 1 node(s)."
83 mpi_run -np 1 -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
85 if [ ${PIPESTATUS[0]} != 0 ]; then
86 [ -f $LOG ] && cat $LOG
87 error "mpirun ... mdsrate ... failed, aborting"
92 if [ -n "$NOMULTI" ]; then
93 echo "NO test for lookups on multiple nodes."
95 log "===== $0 ### ${NUM_CLIENTS} NODES LOOKUPS ###"
96 echo "Running lookups on ${NUM_CLIENTS} node(s)."
98 mpi_run -np ${NUM_CLIENTS} -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
100 if [ ${PIPESTATUS[0]} != 0 ]; then
101 [ -f $LOG ] && cat $LOG
102 error "mpirun ... mdsrate ... failed, aborting"
106 equals_msg `basename $0`: test complete, cleaning up
107 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d'
109 check_and_cleanup_lustre