Whamcloud - gitweb
LU-17276 tests: performance test for same range lock
[fs/lustre-release.git] / lustre / tests / performance-sanity.sh
1 #!/bin/bash
2
3 set -e
4
5 TESTNAME=$(basename $0 .sh)
6 LOG=${LOG:-"$TMP/${TESTNAME}.log"}
7
8 LUSTRE=${LUSTRE:-$(dirname $0)/..}
9 . $LUSTRE/tests/test-framework.sh
10 init_test_env "$@"
11 init_logging
12
13 ALWAYS_EXCEPT="$PERFORMANCE_SANITY_EXCEPT "
14 build_test_filter
15
16 check_and_setup_lustre
17
18 env_verify()
19 {
20         [[ -x "$MPIRUN" ]] || skip_env "no mpirun program found"
21         [[ -x "$MDTEST" ]] || skip_env "no mdtest program found"
22         get_mpiuser_id $MPI_USER
23         MPI_RUNAS=${MPI_RUNAS:-"runas -u $MPI_USER_UID -g $MPI_USER_GID"}
24         $GSS_KRB5 && refresh_krb5_tgt $MPI_USER_UID $MPI_USER_GID $MPI_RUNAS
25 }
26
27 test_1() {
28         env_verify
29         echo "Small files creation performance test"
30         # LU-2600/LU-4108 - Decrease load on zfs
31         if [[ "$SLOW" == no && "$mds1_FSTYPE" == zfs ]]; then
32                 NUM_FILES=10000
33         fi
34         run_mdtest create-small
35 }
36 run_test 1 "small files create/open/delete"
37
38 test_2() {
39         env_verify
40         echo "Large files creation performance test"
41         run_mdtest create-large
42 }
43 run_test 2 "large files create/open/delete"
44
45 test_3() {
46         env_verify
47         NUM_DIRS=1
48         NUM_FILES=200000
49         echo "Single directory lookup rate for $NUM_FILES files"
50         run_mdtest lookup-single
51 }
52 run_test 3 "lookup rate 200k files in single directory"
53
54 test_4() {
55         env_verify
56         NUM_DIRS=100
57         NUM_FILES=200000
58         echo "Directory lookup rate $NUM_DIRS directories, $((NUM_FILES/NUM_DIRS)) files each"
59         run_mdtest lookup-multi
60 }
61 run_test 4 "lookup rate 200k files in 100 directories"
62
63 test_5a() {
64         touch $DIR/$tfile
65         for((i=0; i < 20001; i++)) {
66                 echo "W$((i * 10)), 5"
67                 [ $i -eq 20000 ] && echo "T5" && continue
68         } | flocks_test 6 $DIR/$tfile
69         rm -r $DIR/$tfile
70 }
71 run_test 5a "enqueue 20k no overlap flocks on same file"
72
73 test_5b() {
74         touch $DIR/$tfile
75         for((i=0; i < 20001; i++)) {
76                 [ $i -eq 0 ] && echo "W0,99999999" && continue
77                 echo "R$((i * 10)), 5"
78                 [ $i -eq 20000 ] && echo "T5" && continue
79         } | flocks_test 6 $DIR/$tfile
80         rm -r $DIR/$tfile
81 }
82 run_test 5b "split a flock 20k times"
83
84 test_5c() {
85         touch $DIR/$tfile
86         for((i=0; i < 20001; i++)) {
87                 echo "R$((i * 10)), 5"
88                 [ $i -eq 20000 ] && echo "W0,99999999" && echo "T0" && continue
89         } | flocks_test 6 $DIR/$tfile
90         rm -r $DIR/$tfile
91 }
92 run_test 5c "merge 20k flocks"
93
94 test_5d() {
95         local v=0
96
97         touch $DIR/$tfile
98         for((i=0; i < 20001; i++)) {
99                 echo "F$i"
100                 echo "R400, $((100 + v))"
101                 [ $i -eq 0 -a $v -eq 0 ] && echo "S20100"
102                 [ $i -eq 20000 ] && {
103                         echo "T5"
104                         [ $v -eq 1 ] && break
105                         v=$((v + 1))
106                         i=0
107                 }
108         } | flocks_test 6 $DIR/$tfile
109         rm -r $DIR/$tfile
110 }
111 run_test 5d "Enqueue 20k same range flocks, then expand them"
112
113 complete_test $SECONDS
114 check_and_cleanup_lustre
115 exit_status