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
16 assert_env CLIENTS MDSRATE SINGLECLIENT MPIRUN
18 # Do not use name [df][0-9]* to avoid cleanup by rm, bug 18045
19 BASEDIR=$MOUNT/mdsrate
20 TESTDIR=$BASEDIR/lookup
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
39 MDSRATE_ENABLE_DNE=${MDSRATE_ENABLE_DNE:-false}
40 if $MDSRATE_ENABLE_DNE; then
42 mdtcount_opt="--mdtcount $MDSCOUNT"
50 mdsrate_STRIPEPARAMS=${mdsrate_STRIPEPARAMS:-${fs_STRIPEPARAMS:-"-c 1"}}
51 setstripe_getstripe $BASEDIR $mdsrate_STRIPEPARAMS
53 IFree=$(mdsrate_inodes_available)
54 if [ $IFree -lt $NUM_FILES ]; then
58 generate_machine_file $NODES_TO_USE $MACHINEFILE ||
59 error "can not generate machinefile"
61 p="$TMP/$TESTSUITE-$TESTNAME.parameters"
62 save_lustre_params $(get_facets MDS) mdt.*.enable_remote_dir_gid > $p
63 do_nodes $(comma_list $(mdts_nodes)) \
64 $LCTL set_param mdt.*.enable_remote_dir_gid=-1
66 if [ -n "$NOCREATE" ]; then
67 echo "NOCREATE=$NOCREATE => no file creation."
69 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d' --ignore
71 log "===== $0 Test preparation: creating ${NUM_FILES} files."
73 NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
74 NUM_THREADS=$((NUM_CLIENTS * MDSCOUNT))
75 if [ $NUM_CLIENTS -gt 50 ]; then
76 NUM_THREADS=$NUM_CLIENTS
78 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --mknod --dir ${TESTDIR}
79 --nfiles ${NUM_FILES} --filefmt 'f%%d'
80 $mdtcount_opt $debug_opt"
82 mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} -np ${NUM_THREADS} \
85 # No lockup if error occurs on file creation, abort.
86 if [ ${PIPESTATUS[0]} != 0 ]; then
87 error_noexit "mdsrate file creation failed, aborting"
88 restore_lustre_params < $p
89 mdsrate_cleanup $NUM_THREADS $MACHINEFILE $NUM_FILES \
90 $TESTDIR 'f%%d' --ignore
95 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --lookup --time ${TIME_PERIOD} ${SEED_OPTION}
96 --dir ${TESTDIR} --nfiles ${NUM_FILES} --filefmt 'f%%d'"
99 if [ -n "$NOSINGLE" ]; then
100 echo "NO Test for lookups on a single client."
102 log "===== $0 ### 1 NODE LOOKUPS ###"
104 mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} -np 1 ${COMMAND} |
107 if [ ${PIPESTATUS[0]} != 0 ]; then
108 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
109 error_noexit "mdsrate lookup on single client failed, aborting"
110 restore_lustre_params < $p
111 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \
112 $TESTDIR 'f%%d' --ignore
118 [ $NUM_CLIENTS -eq 1 ] && NOMULTI=yes
119 if [ -n "$NOMULTI" ]; then
120 echo "NO test for lookups on multiple nodes."
122 log "===== $0 ### ${NUM_CLIENTS} NODES LOOKUPS ###"
124 mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} -np ${NUM_CLIENTS} \
125 ${COMMAND} | tee ${LOG}
127 if [ ${PIPESTATUS[0]} != 0 ]; then
128 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
129 error_noexit "mdsrate lookup on multiple nodes failed, aborting"
130 restore_lustre_params < $p
131 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \
132 $TESTDIR 'f%%d' --ignore
138 restore_lustre_params < $p
139 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d'
140 rmdir $BASEDIR || true
142 check_and_cleanup_lustre