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