Whamcloud - gitweb
b=22075 buffalo-v2 should detect test timeouts
[fs/lustre-release.git] / lustre / tests / mdsrate-stat-large.sh
1 #!/bin/sh
2 #
3 # This test was used in a set of CMD3 tests (cmd3-8 test).
4
5 # File attribute retrieval rate for large file creation
6 # 3300 ops/sec/OST for single node 28500 ops/sec/OST aggregate
7
8 # In a dir containing 10 million striped files, the mdsrate Test Program will
9 # perform directory ordered stat's (readdir) for 10 minutes. This test will be
10 # run from a single node for #1 and from all nodes for #2 aggregate test to
11 # measure stat performance.  
12
13 LUSTRE=${LUSTRE:-`dirname $0`/..}
14 . $LUSTRE/tests/test-framework.sh
15 init_test_env $@
16 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
17
18 assert_env CLIENTS MDSRATE SINGLECLIENT MPIRUN
19
20 MACHINEFILE=${MACHINEFILE:-$TMP/$(basename $0 .sh).machines}
21 # Do not use name [df][0-9]* to avoid cleanup by rm, bug 18045
22 BASEDIR=$MOUNT/mdsrate
23 TESTDIR=$MOUNT/stat
24
25 # Requirements
26 NUM_FILES=${NUM_FILES:-1000000}
27 TIME_PERIOD=${TIME_PERIOD:-600}                        # seconds
28
29 # --random_order (default) -OR- --readdir_order
30 DIR_ORDER=${DIR_ORDER:-"--readdir_order"}
31
32 LOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
33 CLIENT=$SINGLECLIENT
34 NODES_TO_USE=${NODES_TO_USE:-$CLIENTS}
35 NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
36
37 rm -f $LOG
38
39 [ ! -x ${MDSRATE} ] && error "${MDSRATE} not built."
40
41 log "===== $0 ====== " 
42
43 check_and_setup_lustre
44
45 mkdir -p $BASEDIR
46 chmod 0777 $BASEDIR
47 $LFS setstripe $BASEDIR -c -1
48 get_stripe $BASEDIR
49
50 IFree=$(mdsrate_inodes_available)
51 if [ $IFree -lt $NUM_FILES ]; then
52     NUM_FILES=$IFree
53 fi
54
55 generate_machine_file $NODES_TO_USE $MACHINEFILE || error "can not generate machinefile"
56
57 if [ -n "$NOCREATE" ]; then
58     echo "NOCREATE=$NOCREATE  => no file creation."
59 else
60     mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d' --ignore
61
62     log "===== $0 Test preparation: creating ${NUM_FILES} files."
63
64     COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --create --dir ${TESTDIR}
65                         --nfiles ${NUM_FILES} --filefmt 'f%%d'"
66     echo "+" ${COMMAND}
67
68     NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
69     NUM_THREADS=$((NUM_CLIENTS * MDSCOUNT))
70     if [ $NUM_CLIENTS -gt 50 ]; then
71         NUM_THREADS=$NUM_CLIENTS
72     fi
73
74     mpi_run -np ${NUM_THREADS} -machinefile ${MACHINEFILE} ${COMMAND} 2>&1
75     [ ${PIPESTATUS[0]} != 0 ] && error "mdsrate file creation failed, aborting"
76
77 fi
78
79 COMMAND="${MDSRATE} ${MDSRATE_DEBUG} --stat --time ${TIME_PERIOD}
80         --dir ${TESTDIR} --nfiles ${NUM_FILES} --filefmt 'f%%d'
81         ${DIR_ORDER} ${SEED_OPTION}"
82
83 # 1
84 if [ -n "$NOSINGLE" ]; then
85     echo "NO Test for stats on a single client."
86 else
87     log "===== $0 ### 1 NODE STAT ###"
88     echo "+" ${COMMAND}
89
90     mpi_run -np 1 -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
91
92     if [ ${PIPESTATUS[0]} != 0 ]; then
93         [ -f $LOG ] && sed -e "s/^/log: /" $LOG
94         error "mdsrate stats on a single client failed, aborting"
95     fi
96 fi
97
98 # 2
99 [ $NUM_CLIENTS -eq 1 ] && NOMULTI=yes
100 if [ -n "$NOMULTI" ]; then
101     echo "NO test for stats on multiple nodes."
102 else
103     log "===== $0 ### ${NUM_CLIENTS} NODES STAT ###"
104     echo "+" ${COMMAND}
105
106     mpi_run -np ${NUM_CLIENTS} -machinefile ${MACHINEFILE} ${COMMAND} | tee ${LOG}
107
108     if [ ${PIPESTATUS[0]} != 0 ]; then
109         [ -f $LOG ] && sed -e "s/^/log: /" $LOG
110         error "mdsrate stats on multiple nodes failed, aborting"
111     fi
112 fi
113
114 equals_msg `basename $0`: test complete, cleaning up
115 mdsrate_cleanup $NUM_CLIENTS $MACHINEFILE $NUM_FILES $TESTDIR 'f%%d'
116 rmdir $BASEDIR || true
117 rm -f $MACHINEFILE
118 check_and_cleanup_lustre
119 #rm -f $LOG
120
121 exit 0