3 # This test was used in a set of CMD3 tests (cmd3-5 test).
5 # Directory lookup retrieval rate 10 directories 1 million files each
6 # 6000 random lookups/sec per client node 62,000 random lookups/sec aggregate
8 # In 10 dirs containing 1 million files each the mdsrate Test Program will
9 # perform lookups for 10 minutes. This test is run from a single node for
10 # #1 and from all nodes for #2 aggregate test to measure lookup performance.
11 # TEst performs lookups across all 10 directories.
13 LUSTRE=${LUSTRE:-$(dirname $0)/..}
14 . $LUSTRE/tests/test-framework.sh
17 assert_env CLIENTS MDSRATE SINGLECLIENT MPIRUN
19 # Do not use name [df][0-9]* to avoid cleanup by rm, bug 18045
20 BASEDIR=$MOUNT/mdsrate
23 NUM_DIRS=${NUM_DIRS:-10}
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 mdsrate_STRIPEPARAMS=${mdsrate_STRIPEPARAMS:-${fs_STRIPEPARAMS:-"-c 1"}}
43 setstripe_getstripe $BASEDIR $mdsrate_STRIPEPARAMS
45 IFree=$(($(mdsrate_inodes_available) - NUM_DIRS))
46 if [ $IFree -lt $((NUM_FILES * NUM_DIRS)) ]; then
47 NUM_FILES=$((IFree / NUM_DIRS))
50 generate_machine_file $NODES_TO_USE $MACHINEFILE || error "can not generate machinefile"
52 DIRfmt="${BASEDIR}/lookup-%d"
55 # Unlink the files created in the directories under $BASEDIR.
56 # FIXME: does it make sense to add the possibility to unlink dirfmt to mdsrate?
58 mdsrate_cleanup_all() {
60 for i in $(seq 0 $NUM_DIRS); do
61 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES \
62 $BASEDIR/lookup-$i 'f%%d' --ignore
66 if [ -n "$NOCREATE" ]; then
67 echo "NOCREATE=$NOCREATE => no file creation."
71 log "===== $0 Test preparation: creating ${NUM_DIRS} dirs with ${NUM_FILES} files."
73 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --mknod
74 --ndirs ${NUM_DIRS} --dirfmt '${DIRfmt}'
75 --nfiles ${NUM_FILES} --filefmt 'f%%d'"
78 # For files creation we can use -np equal to NUM_DIRS
79 # This is just a test preparation, does not matter how many threads we
80 # use for files creation; we just should be aware that NUM_DIRS is less
81 # than or equal to the number of threads np
82 mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} -np ${NUM_DIRS} \
85 # No lookup if error occurs on file creation, abort.
86 if [ ${PIPESTATUS[0]} != 0 ]; then
87 error_noexit "mdsrate file creation failed, aborting"
93 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --lookup --time ${TIME_PERIOD} ${SEED_OPTION}
94 --ndirs ${NUM_DIRS} --dirfmt '${DIRfmt}'
95 --nfiles ${NUM_FILES} --filefmt 'f%%d'"
98 if [ -n "$NOSINGLE" ]; then
99 echo "NO Test for lookups on a single client."
101 log "===== $0 ### 1 NODE LOOKUPS ###"
103 mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} -np 1 ${COMMAND} |
106 if [ ${PIPESTATUS[0]} != 0 ]; then
107 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
108 error_noexit "mdsrate lookup on single client failed, aborting"
115 [ $NUM_CLIENTS -eq 1 ] && NOMULTI=yes
116 if [ -n "$NOMULTI" ]; then
117 echo "NO test for lookups on multiple nodes."
119 log "===== $0 ### ${NUM_CLIENTS} NODES LOOKUPS ###"
121 mpi_run ${MACHINEFILE_OPTION} ${MACHINEFILE} -np ${NUM_CLIENTS} \
122 ${COMMAND} | tee ${LOG}
124 if [ ${PIPESTATUS[0]} != 0 ]; then
125 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
126 error_noexit "mdsrate lookup on multiple nodes failed, aborting"
134 rmdir $BASEDIR || true
136 check_and_cleanup_lustre