3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2012 The OpenLDAP Foundation.
6 ## All rights reserved.
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
12 ## A copy of this license is available in the file LICENSE in the
13 ## top-level directory of the distribution or, alternatively, at
14 ## <http://www.OpenLDAP.org/license.html>.
16 # The default debug level logs more than 1Gb:
17 SLAPD_DEBUG=${SLAPD_DEBUG_MT_HOT-stats}
19 echo "running defines.sh"
20 . $SRCDIR/scripts/defines.sh
22 if test $MONITORDB = "no" ; then
23 echo "Monitor backend not available, test skipped"
27 if test x$TESTLOOPS = x ; then
31 mkdir -p $TESTDIR $DBDIR1
34 # Populate and start up slapd server with some random data
37 echo "Running slapadd to build slapd database..."
38 . $CONFFILTER $BACKEND $MONITORDB < $MCONF > $ADDCONF
39 $SLAPADD -f $ADDCONF -l $LDIFORDERED
41 if test $RC != 0 ; then
42 echo "slapadd failed ($RC)!"
46 echo "Running slapindex to index slapd database..."
47 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
50 if test $RC != 0 ; then
51 echo "warning: slapindex failed ($RC)"
52 echo " assuming no indexing support"
55 echo "Starting slapd on TCP/IP port $PORT1..."
56 echo $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING
57 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
59 if test $WAIT != 0 ; then
67 # Perform a basic search, make sure of a functional setup
68 echo "Testing basic monitor search..."
69 for i in 0 1 2 3 4 5; do
70 $LDAPSEARCH -s base -b "$MONITORDN" -H $URI1 \
71 '(objectclass=*)' > /dev/null 2>&1
73 if test $RC = 0 ; then
76 echo "Waiting 5 seconds for slapd to start..."
80 if test $RC != 0 ; then
81 echo "mt-hot read failed ($RC)!"
82 test $KILLSERVERS != no && kill -HUP $KILLPIDS
86 cat /dev/null > $MTREADOUT
88 echo "Monitor searches"
89 # Perform a basic single threaded search on a single connection
92 INNER=`expr $TESTLOOPS \* 1000`
93 echo "Testing basic mt-hot search: $THR threads ($OUTER x $INNER) loops..."
94 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
96 -m $THR -L $OUTER -l $INNER
97 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
98 -e "$MONITORDN" -f "(objectclass=*)" \
99 -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
101 if test $RC != 0 ; then
102 echo "slapd-mtread failed ($RC)!"
103 test $KILLSERVERS != no && kill -HUP $KILLPIDS
107 # Perform a basic multi-threaded search on a single connection
110 INNER=`expr $TESTLOOPS \* 200`
111 echo "Testing basic mt-hot search: $THR threads ($OUTER x $INNER) loops..."
112 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
114 -m $THR -L $OUTER -l $INNER
115 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
116 -e "$MONITORDN" -f "(objectclass=*)" \
117 -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
119 if test $RC != 0 ; then
120 echo "slapd-mtread failed ($RC)!"
121 test $KILLSERVERS != no && kill -HUP $KILLPIDS
125 # Perform a basic multi-threaded search on a single connection
128 INNER=`expr $TESTLOOPS \* 2`
129 echo "Testing basic mt-hot search: $THR threads ($OUTER x $INNER) loops..."
130 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
132 -m $THR -L $OUTER -l $INNER
133 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
134 -e "$MONITORDN" -f "(objectclass=*)" \
135 -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
137 if test $RC != 0 ; then
138 echo "slapd-mtread failed ($RC)!"
139 test $KILLSERVERS != no && kill -HUP $KILLPIDS
143 # Perform a single threaded random DB search on a single connection
144 echo "Random searches"
147 INNER=`expr $TESTLOOPS \* 1000`
148 echo "Testing random mt-hot search: $THR threads ($OUTER x $INNER) loops..."
149 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
150 -e "$BASEDN" -f "(objectclass=*)" \
151 -m $THR -L $OUTER -l $INNER
152 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
153 -e "$BASEDN" -f "(objectclass=*)" \
154 -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
156 if test $RC != 0 ; then
157 echo "slapd-mtread failed ($RC)!"
158 test $KILLSERVERS != no && kill -HUP $KILLPIDS
162 # Perform a multi-threaded random DB search on a single connection
165 INNER=`expr $TESTLOOPS \* 200`
166 echo "Testing random mt-hot search: $THR threads ($OUTER x $INNER) loops..."
167 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
168 -e "$BASEDN" -f "(objectclass=*)" \
169 -m $THR -L $OUTER -l $INNER
170 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
171 -e "$BASEDN" -f "(objectclass=*)" \
172 -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
174 if test $RC != 0 ; then
175 echo "slapd-mtread failed ($RC)!"
176 test $KILLSERVERS != no && kill -HUP $KILLPIDS
180 # Perform a multi-threaded random DB search on a single connection
183 INNER=`expr $TESTLOOPS \* 2`
184 echo "Testing random mt-hot search: $THR threads ($OUTER x $INNER) loops..."
185 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
186 -e "$BASEDN" -f "(objectclass=*)" \
187 -m $THR -L $OUTER -l $INNER
188 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
189 -e "$BASEDN" -f "(objectclass=*)" \
190 -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
192 if test $RC != 0 ; then
193 echo "slapd-mtread failed ($RC)!"
194 test $KILLSERVERS != no && kill -HUP $KILLPIDS
198 # Perform a basic multi-threaded search using multiple connections
199 echo "Multiple threads and connection searches"
203 INNER=`expr $TESTLOOPS \* 200`
204 echo "Testing basic mt-hot search: $THR threads $CONN conns ($OUTER x $INNER) loops..."
205 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
207 -c $CONN -m $THR -L $OUTER -l $INNER
208 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
209 -e "$MONITORDN" -f "(objectclass=*)" \
210 -c $CONN -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
212 if test $RC != 0 ; then
213 echo "slapd-mtread failed ($RC)!"
214 test $KILLSERVERS != no && kill -HUP $KILLPIDS
218 # Perform a basic multi-threaded search using multiple connections
222 INNER=`expr $TESTLOOPS \* 20`
223 echo "Testing basic mt-hot search: $THR threads $CONN conns ($OUTER x $INNER) loops..."
224 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
226 -c $CONN -m $THR -L $OUTER -l $INNER
227 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
228 -e "$MONITORDN" -f "(objectclass=*)" \
229 -c $CONN -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
231 if test $RC != 0 ; then
232 echo "slapd-mtread failed ($RC)!"
233 test $KILLSERVERS != no && kill -HUP $KILLPIDS
237 # Perform a multi-threaded random DB search using multiple connections
241 INNER=`expr $TESTLOOPS \* 2`
242 echo "Testing random mt-hot search: $THR threads $CONN conns ($OUTER x $INNER) loops..."
243 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
244 -e "$BASEDN" -f "(objectclass=*)" \
245 -c $CONN -m $THR -L $OUTER -l $INNER
246 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
247 -e "$BASEDN" -f "(objectclass=*)" \
248 -c $CONN -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
250 if test $RC != 0 ; then
251 echo "slapd-mtread failed ($RC)!"
252 test $KILLSERVERS != no && kill -HUP $KILLPIDS
256 # Perform a multi-threaded random reads and writes using single connection
261 INNER=`expr $TESTLOOPS \* 2`
262 echo "Testing random mt-hot r/w search: $THR read threads $WTHR write threads $CONN conns ($OUTER x $INNER) loops..."
263 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
264 -e "$BASEDN" -f "(&(!(cn=rwtest*))(objectclass=*))" \
265 -c $CONN -m $THR -M $WTHR -L $OUTER -l $INNER
266 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
267 -e "$BASEDN" -f "(&(!(cn=rwtest*))(objectclass=*))" \
268 -c $CONN -m $THR -M $WTHR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
270 if test $RC != 0 ; then
271 echo "slapd-mtread failed ($RC)!"
272 test $KILLSERVERS != no && kill -HUP $KILLPIDS
276 # Perform a multi-threaded random reads and writes using multiple connections
281 INNER=`expr $TESTLOOPS \* 2`
282 echo "Testing random mt-hot r/w search: $THR read threads $WTHR write threads $CONN conns ($OUTER x $INNER) loops..."
283 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
284 -e "$BASEDN" -f "(&(!(cn=rwtest*))(objectclass=*))" \
285 -c $CONN -m $THR -M $WTHR -L $OUTER -l $INNER
286 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
287 -e "$BASEDN" -f "(&(!(cn=rwtest*))(objectclass=*))" \
288 -c $CONN -m $THR -M $WTHR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
290 if test $RC != 0 ; then
291 echo "slapd-mtread failed ($RC)!"
292 test $KILLSERVERS != no && kill -HUP $KILLPIDS
297 test $KILLSERVERS != no && kill -HUP $KILLPIDS
299 echo ">>>>> Test succeeded"