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
16 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
17 assert_env CLIENTS MDSRATE SINGLECLIENT MPIRUN
19 MACHINEFILE=${MACHINEFILE:-$TMP/$(basename $0 .sh).machines}
20 # Do not use name [df][0-9]* to avoid cleanup by rm, bug 18045
21 TESTDIR=$MOUNT/mdsrate
24 NUM_DIRS=${NIM_DIRS:-10}
25 NUM_FILES=${NUM_FILES:-1000000}
26 TIME_PERIOD=${TIME_PERIOD:-600} # seconds
28 LOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
30 NODES_TO_USE=${NODES_TO_USE:-$CLIENTS}
31 NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
35 [ ! -x ${MDSRATE} ] && error "${MDSRATE} not built."
37 log "===== $0 ====== "
39 check_and_setup_lustre
43 IFree=$(inodes_available)
44 if [ $IFree -lt $((NUM_FILES * NUM_DIRS)) ]; then
45 NUM_FILES=$((IFree / NUM_DIRS))
48 generate_machine_file $NODES_TO_USE $MACHINEFILE || error "can not generate machinefile"
50 $LFS setstripe $TESTDIR -c 1
53 DIRfmt="${TESTDIR}/t6-%d"
55 if [ -n "$NOCREATE" ]; then
56 echo "NOCREATE=$NOCREATE => no file creation."
58 # FIXME: does it make sense to add the possibility to unlink dirfmt to mdsrate?
59 for i in $(seq 0 $NUM_DIRS); do
60 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR/t6-$i 'f%%d' --ignore
63 log "===== $0 Test preparation: creating ${NUM_DIRS} dirs with ${NUM_FILES} files."
65 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --mknod
66 --ndirs ${NUM_DIRS} --dirfmt '${DIRfmt}'
67 --nfiles ${NUM_FILES} --filefmt 'f%%d'"
70 # For files creation we can use -np equal to NUM_DIRS
71 # This is just a test preparation, does not matter how many threads we use for files creation;
72 # we just should be aware that NUM_DIRS is less than or equal to the number of threads np
73 mpi_run -np ${NUM_DIRS} -machinefile ${MACHINEFILE} ${COMMAND} 2>&1
75 # No lookup if error occurs on file creation, abort.
76 [ ${PIPESTATUS[0]} != 0 ] && error "mdsrate file creation failed, aborting"
79 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --lookup --time ${TIME_PERIOD} ${SEED_OPTION}
80 --ndirs ${NUM_DIRS} --dirfmt '${DIRfmt}'
81 --nfiles ${NUM_FILES} --filefmt 'f%%d'"
84 if [ -n "$NOSINGLE" ]; then
85 echo "NO Test for lookups on a single client."
87 log "===== $0 ### 1 NODE LOOKUPS ###"
89 mpi_run -np 1 -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
91 if [ ${PIPESTATUS[0]} != 0 ]; then
92 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
93 error "mdsrate lookups on a single client failed, aborting"
98 [ $NUM_CLIENTS -eq 1 ] && NOMULTI=yes
99 if [ -n "$NOMULTI" ]; then
100 echo "NO test for lookups on multiple nodes."
102 log "===== $0 ### ${NUM_CLIENTS} NODES LOOKUPS ###"
104 mpi_run -np ${NUM_CLIENTS} -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
106 if [ ${PIPESTATUS[0]} != 0 ]; then
107 [ -f $LOG ] && sed -e "s/^/log: /" $LOG
108 error "mdsrate lookups on multiple nodes failed, aborting"
112 equals_msg `basename $0`: test complete, cleaning up
113 # FIXME: does it make sense to add the possibility to unlink dirfmt to mdsrate?
114 for i in $(seq 0 $NUM_DIRS); do
115 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR/t6-$i 'f%%d' --ignore
119 rmdir $TESTDIR || true
121 check_and_cleanup_lustre