test060-mt-hot revision 1.1.1.3
1#! /bin/sh 2# $OpenLDAP$ 3## This work is part of OpenLDAP Software <http://www.openldap.org/>. 4## 5## Copyright 1998-2017 The OpenLDAP Foundation. 6## All rights reserved. 7## 8## Redistribution and use in source and binary forms, with or without 9## modification, are permitted only as authorized by the OpenLDAP 10## Public License. 11## 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>. 15 16# The default debug level logs more than 1Gb: 17case "$SLAPD_DEBUG_MT_HOT/$SLAPD_DEBUG" in 18/0 | /0x0 | /0X0 | /none | /NONE | /32768 | /0x8000 | 0X8000 | /0100000) :;; 19*) SLAPD_DEBUG=${SLAPD_DEBUG_MT_HOT-stats} ;; 20esac 21 22echo "running defines.sh" 23. $SRCDIR/scripts/defines.sh 24 25if test $MONITORDB = "no" ; then 26 echo "Monitor backend not available, test skipped" 27 exit 0 28fi 29 30if test x$TESTLOOPS = x ; then 31 TESTLOOPS=50 32fi 33 34mkdir -p $TESTDIR $DBDIR1 35 36# 37# Populate and start up slapd server with some random data 38# 39 40echo "Running slapadd to build slapd database..." 41. $CONFFILTER $BACKEND $MONITORDB < $MCONF > $ADDCONF 42$SLAPADD -f $ADDCONF -l $LDIFORDERED 43RC=$? 44if test $RC != 0 ; then 45 echo "slapadd failed ($RC)!" 46 exit $RC 47fi 48 49echo "Running slapindex to index slapd database..." 50. $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1 51$SLAPINDEX -f $CONF1 52RC=$? 53if test $RC != 0 ; then 54 echo "warning: slapindex failed ($RC)" 55 echo " assuming no indexing support" 56fi 57 58echo "Starting slapd on TCP/IP port $PORT1..." 59echo $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING 60$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 & 61PID=$! 62if test $WAIT != 0 ; then 63 echo PID $PID 64 read foo 65fi 66KILLPIDS="$PID" 67 68sleep 1 69 70# Perform a basic search, make sure of a functional setup 71echo "Testing basic monitor search..." 72for i in 0 1 2 3 4 5; do 73 $LDAPSEARCH -s base -b "$MONITORDN" -H $URI1 \ 74 '(objectclass=*)' > /dev/null 2>&1 75 RC=$? 76 if test $RC = 0 ; then 77 break 78 fi 79 echo "Waiting 5 seconds for slapd to start..." 80 sleep 5 81done 82 83if test $RC != 0 ; then 84 echo "mt-hot read failed ($RC)!" 85 test $KILLSERVERS != no && kill -HUP $KILLPIDS 86 exit $RC 87fi 88 89cat /dev/null > $MTREADOUT 90 91echo "Monitor searches" 92# Perform a basic single threaded search on a single connection 93THR=1 94OUTER=1 95INNER=`expr $TESTLOOPS \* 1000` 96echo "Testing basic mt-hot search: $THR threads ($OUTER x $INNER) loops..." 97echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \ 98 -e "$MONITORDN" \ 99 -m $THR -L $OUTER -l $INNER 100$SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \ 101 -e "$MONITORDN" -f "(objectclass=*)" \ 102 -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1 103RC=$? 104if test $RC != 0 ; then 105 echo "slapd-mtread failed ($RC)!" 106 test $KILLSERVERS != no && kill -HUP $KILLPIDS 107 exit $RC 108fi 109 110# Perform a basic multi-threaded search on a single connection 111THR=5 112OUTER=1 113INNER=`expr $TESTLOOPS \* 200` 114echo "Testing basic mt-hot search: $THR threads ($OUTER x $INNER) loops..." 115echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \ 116 -e "$MONITORDN" \ 117 -m $THR -L $OUTER -l $INNER 118$SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \ 119 -e "$MONITORDN" -f "(objectclass=*)" \ 120 -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1 121RC=$? 122if test $RC != 0 ; then 123 echo "slapd-mtread failed ($RC)!" 124 test $KILLSERVERS != no && kill -HUP $KILLPIDS 125 exit $RC 126fi 127 128# Perform a basic multi-threaded search on a single connection 129THR=100 130OUTER=5 131INNER=`expr $TESTLOOPS \* 2` 132echo "Testing basic mt-hot search: $THR threads ($OUTER x $INNER) loops..." 133echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \ 134 -e "$MONITORDN" \ 135 -m $THR -L $OUTER -l $INNER 136$SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \ 137 -e "$MONITORDN" -f "(objectclass=*)" \ 138 -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1 139RC=$? 140if test $RC != 0 ; then 141 echo "slapd-mtread failed ($RC)!" 142 test $KILLSERVERS != no && kill -HUP $KILLPIDS 143 exit $RC 144fi 145 146# Perform a single threaded random DB search on a single connection 147echo "Random searches" 148THR=1 149OUTER=1 150INNER=`expr $TESTLOOPS \* 1000` 151echo "Testing random mt-hot search: $THR threads ($OUTER x $INNER) loops..." 152echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \ 153 -e "$BASEDN" -f "(objectclass=*)" \ 154 -m $THR -L $OUTER -l $INNER 155$SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \ 156 -e "$BASEDN" -f "(objectclass=*)" \ 157 -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1 158RC=$? 159if test $RC != 0 ; then 160 echo "slapd-mtread failed ($RC)!" 161 test $KILLSERVERS != no && kill -HUP $KILLPIDS 162 exit $RC 163fi 164 165# Perform a multi-threaded random DB search on a single connection 166THR=5 167OUTER=1 168INNER=`expr $TESTLOOPS \* 200` 169echo "Testing random mt-hot search: $THR threads ($OUTER x $INNER) loops..." 170echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \ 171 -e "$BASEDN" -f "(objectclass=*)" \ 172 -m $THR -L $OUTER -l $INNER 173$SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \ 174 -e "$BASEDN" -f "(objectclass=*)" \ 175 -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1 176RC=$? 177if test $RC != 0 ; then 178 echo "slapd-mtread failed ($RC)!" 179 test $KILLSERVERS != no && kill -HUP $KILLPIDS 180 exit $RC 181fi 182 183# Perform a multi-threaded random DB search on a single connection 184THR=100 185OUTER=5 186INNER=`expr $TESTLOOPS \* 2` 187echo "Testing random mt-hot search: $THR threads ($OUTER x $INNER) loops..." 188echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \ 189 -e "$BASEDN" -f "(objectclass=*)" \ 190 -m $THR -L $OUTER -l $INNER 191$SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \ 192 -e "$BASEDN" -f "(objectclass=*)" \ 193 -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1 194RC=$? 195if test $RC != 0 ; then 196 echo "slapd-mtread failed ($RC)!" 197 test $KILLSERVERS != no && kill -HUP $KILLPIDS 198 exit $RC 199fi 200 201# Perform a basic multi-threaded search using multiple connections 202echo "Multiple threads and connection searches" 203CONN=5 204THR=5 205OUTER=1 206INNER=`expr $TESTLOOPS \* 200` 207echo "Testing basic mt-hot search: $THR threads $CONN conns ($OUTER x $INNER) loops..." 208echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \ 209 -e "$MONITORDN" \ 210 -c $CONN -m $THR -L $OUTER -l $INNER 211$SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \ 212 -e "$MONITORDN" -f "(objectclass=*)" \ 213 -c $CONN -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1 214RC=$? 215if test $RC != 0 ; then 216 echo "slapd-mtread failed ($RC)!" 217 test $KILLSERVERS != no && kill -HUP $KILLPIDS 218 exit $RC 219fi 220 221# Perform a basic multi-threaded search using multiple connections 222CONN=5 223THR=50 224OUTER=5 225INNER=`expr $TESTLOOPS \* 20` 226echo "Testing basic mt-hot search: $THR threads $CONN conns ($OUTER x $INNER) loops..." 227echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \ 228 -e "$MONITORDN" \ 229 -c $CONN -m $THR -L $OUTER -l $INNER 230$SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \ 231 -e "$MONITORDN" -f "(objectclass=*)" \ 232 -c $CONN -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1 233RC=$? 234if test $RC != 0 ; then 235 echo "slapd-mtread failed ($RC)!" 236 test $KILLSERVERS != no && kill -HUP $KILLPIDS 237 exit $RC 238fi 239 240# Perform a multi-threaded random DB search using multiple connections 241CONN=5 242THR=100 243OUTER=5 244INNER=`expr $TESTLOOPS \* 2` 245echo "Testing random mt-hot search: $THR threads $CONN conns ($OUTER x $INNER) loops..." 246echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \ 247 -e "$BASEDN" -f "(objectclass=*)" \ 248 -c $CONN -m $THR -L $OUTER -l $INNER 249$SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \ 250 -e "$BASEDN" -f "(objectclass=*)" \ 251 -c $CONN -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1 252RC=$? 253if test $RC != 0 ; then 254 echo "slapd-mtread failed ($RC)!" 255 test $KILLSERVERS != no && kill -HUP $KILLPIDS 256 exit $RC 257fi 258 259# Perform a multi-threaded random reads and writes using single connection 260CONN=1 261THR=10 262WTHR=10 263OUTER=5 264INNER=`expr $TESTLOOPS \* 2` 265echo "Testing random mt-hot r/w search: $THR read threads $WTHR write threads $CONN conns ($OUTER x $INNER) loops..." 266echo $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 269$SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \ 270 -e "$BASEDN" -f "(&(!(cn=rwtest*))(objectclass=*))" \ 271 -c $CONN -m $THR -M $WTHR -L $OUTER -l $INNER >> $MTREADOUT 2>&1 272RC=$? 273if test $RC != 0 ; then 274 echo "slapd-mtread failed ($RC)!" 275 test $KILLSERVERS != no && kill -HUP $KILLPIDS 276 exit $RC 277fi 278 279# Perform a multi-threaded random reads and writes using multiple connections 280CONN=5 281THR=10 282WTHR=10 283OUTER=5 284INNER=`expr $TESTLOOPS \* 2` 285echo "Testing random mt-hot r/w search: $THR read threads $WTHR write threads $CONN conns ($OUTER x $INNER) loops..." 286echo $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 289$SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \ 290 -e "$BASEDN" -f "(&(!(cn=rwtest*))(objectclass=*))" \ 291 -c $CONN -m $THR -M $WTHR -L $OUTER -l $INNER >> $MTREADOUT 2>&1 292RC=$? 293if test $RC != 0 ; then 294 echo "slapd-mtread failed ($RC)!" 295 test $KILLSERVERS != no && kill -HUP $KILLPIDS 296 exit $RC 297fi 298 299 300test $KILLSERVERS != no && kill -HUP $KILLPIDS 301 302echo ">>>>> Test succeeded" 303 304exit 0 305