diff options
Diffstat (limited to 'qpid/cpp/src/tests')
| -rwxr-xr-x | qpid/cpp/src/tests/benchmark | 52 | ||||
| -rwxr-xr-x | qpid/cpp/src/tests/perfdist | 38 | ||||
| -rwxr-xr-x | qpid/cpp/src/tests/start_cluster_hosts | 16 |
3 files changed, 63 insertions, 43 deletions
diff --git a/qpid/cpp/src/tests/benchmark b/qpid/cpp/src/tests/benchmark index 9e8023043b..5381fd69fa 100755 --- a/qpid/cpp/src/tests/benchmark +++ b/qpid/cpp/src/tests/benchmark @@ -21,33 +21,45 @@ # and latency against a single cluster member while they are replicating. # # Must be run in the qpid src/tests build directory. -# +# +usage() { +cat <<EOF +Usage: $0 [options] -- client hosts --- broker hosts +Read the script for options. +EOF +} # Defaults TESTDIR=${TESTDIR:-$PWD} # Absolute path to test exes on all hosts. -SCRIPTDIR=${SCRIPTDIR:-$PWD/`dirname $0`} # Absolute path to test exes on all hosts. -SAMPLES=10 # Runs of each test. -COUNT=${COUNT:-10000} # Count for pub/sub tests. -ECHO=${ECHO:-1000} # Count for echo test. -BROKER_FLAGS= +SCRIPTDIR=${SCRIPTDIR:-$PWD/`dirname $0`} # Absolute path to test scripts on all hosts. +SAMPLES=10 # Runs of each test. +COUNT=${COUNT:-10000} # Count for pub/sub tests. +SIZE=${SIZE:-600} # Size of messages +ECHO=${ECHO:-1000} # Count for echo test. -while getopts "t:b:p:s:c:n:e" opt ; do - case $opt in - t) TESTDIR=$OPTARG ;; - b) BROKER_FLAGS="$BROKER_FLAGS -b $OPTARG" ;; - p) BROKER_FLAGS="$BROKER_FLAGS -p $OPTARG" ;; - s) SAMPLES=$OPTARG ;; - c) CLIENTS="$CLIENTS $OPTARG" ;; - n) COUNT="$OPTARG" ;; - e) ECHO="$OPTARG" ;; +collect() { eval $COLLECT=\""\$$COLLECT $*"\"; } +COLLECT=ARGS +while test $# -gt 0; do + case $1 in + --testdir) TESTDIR=$2 ; shift 2 ;; + --samples) SAMPLES=$2 ; shift 2 ;; + --count) COUNT=$2 ; shift 2 ;; + --echos) ECHO==$2 ; shift 2 ;; + --size) SIZE==$2 ; shift 2 ;; + --) COLLECT=CLIENTARG; shift ;; + ---) COLLECT=BROKERARG; shift;; + *) collect $1; shift ;; esac done +CLIENTS=${CLIENTARG:-$CLIENTS} +BROKERS=${BROKERARG:-$BROKERS} test -z "$CLIENTS" && { echo "Must specify at least one client host."; exit 1; } -test -z "$BROKER_FLAGS" && { echo "Must specify a broker host."; exit 1; } +test -z "$BROKERS" && { echo "Must specify at least one broker host."; exit 1; } export TESTDIR # For perfdist CLIENTS=($CLIENTS) # Convert to array +BROKERS=($BROKERS) trap "rm -f $FILES" EXIT dosamples() { @@ -63,13 +75,13 @@ dosamples() { } HEADING="pub sub total Mb" -dosamples $SCRIPTDIR/perfdist $BROKER_FLAGS --count $COUNT --nsubs 2 --npubs 2 --qt 2 -s -- ${CLIENTS[*]} +dosamples $SCRIPTDIR/perfdist --count $COUNT --nsubs 2 --npubs 2 --qt 2 -s -- ${CLIENTS[*]} --- ${BROKERS[*]} HEADING="pub" -dosamples ssh -A ${CLIENTS[0]} $TESTDIR/publish --routing-key perftest0 -s $BROKER_FLAGS --count $COUNT +dosamples ssh -A ${CLIENTS[0]} $TESTDIR/publish --routing-key perftest0 --count $COUNT -s -b ${BROKERS[0]} HEADING="sub" -dosamples ssh -A ${CLIENTS[0]} $TESTDIR/consume --queue perftest0 -s $BROKER_FLAGS --count $COUNT +dosamples ssh -A ${CLIENTS[0]} $TESTDIR/consume --queue perftest0 -s --count $COUNT -b ${BROKERS[0]} HEADING="min max avg" -dosamples ssh -A ${CLIENTS[0]} $TESTDIR/echotest --count $ECHO -s +dosamples ssh -A ${CLIENTS[0]} $TESTDIR/echotest --count $ECHO -s -b ${BROKERS[0]} echo echo "Tab separated spreadsheet (also stored in benchmark.tab):" diff --git a/qpid/cpp/src/tests/perfdist b/qpid/cpp/src/tests/perfdist index 59b6396fe0..9ba92310a9 100755 --- a/qpid/cpp/src/tests/perfdist +++ b/qpid/cpp/src/tests/perfdist @@ -7,17 +7,16 @@ set -e usage() { cat <<EOF -usage: $0 <perftest-args> -- <client-hosts ...> +usage: $0 <perftest-args> -- <client-hosts ...> [ --- <broker hosts...> ] +Client & broker hosts can also be set in env vars CLIENTS and BROKERS. -Run perftest with clients running on the listed hosts. Clients are -assigned to hosts publishers first, then subscribers the host list is -used round-robin if there are more clients than hosts. perftest-args should -include a --host <brokerhost> flag (and --port if necessary). +Run perftest with clients running on the clients and brokers running +on the specified hosts. Clients are assigned to client hosts round +robin: publishers first, then subscribers. If there are multiple +brokers (for cluster tests) clients connect to them round robin. -Do not pass preftest action flags: --setup, --control, --publish, --subscribe. -The script will pass them to the appropriate client processes. - -Note all perftest args must come before --. +Broker hosts can be listed with -b in perftest-args or after --- +at the end of the arguments. Error: $* EOF @@ -36,19 +35,28 @@ while test $# -gt 0; do --npubs) collect $1 $2; NPUBS=$2; shift 2 ;; --nsubs) collect $1 $2; NSUBS=$2; shift 2 ;; -s|--summary) collect $1; QUIET=yes; shift 1 ;; - --) COLLECT=HOSTS; shift ;; + -b|--broker) BROKERS="$BROKERS $2"; shift 2;; + --) COLLECT=CLIENTARG; shift ;; + ---) COLLECT=BROKERARG; shift;; *) collect $1; shift ;; esac done -if [ -z "$HOSTS" ]; then usage "No hosts listed after --"; fi +CLIENTS=${CLIENTARG:-$CLIENTS} +if [ -z "$CLIENTS" ]; then usage "No client hosts listed after --"; fi +BROKERS=${BROKERARG:-$BROKERS} +if [ -z "$BROKERS" ]; then usage "No brokers specified"; fi + PERFTEST="$TESTDIR/perftest $ARGS" -HOSTS=($HOSTS) +CLIENTS=($CLIENTS) +BROKERS=($BROKERS) start() { - HOST=${HOSTS[i % ${#HOSTS[*]}]} - test -z "$QUIET" && echo "Client $i on $HOST $*" - ssh -fT $HOST "PATH=$ADDPATH:\$PATH" $PERFTEST "$@" + CLIENT=${CLIENTS[i % ${#CLIENTS[*]}]} + BROKER=${BROKERS[i % ${#BROKERS[*]}]} + ARGS="$* --broker $BROKER" + test -z "$QUIET" && echo "Client $i on $CLIENT: $ARGS" + ssh -fT $CLIENT $PERFTEST "$@" } $PERFTEST --setup diff --git a/qpid/cpp/src/tests/start_cluster_hosts b/qpid/cpp/src/tests/start_cluster_hosts index 37dda882ca..683798453b 100755 --- a/qpid/cpp/src/tests/start_cluster_hosts +++ b/qpid/cpp/src/tests/start_cluster_hosts @@ -16,14 +16,14 @@ QPIDD=${QPIDD:-$PWD/../qpidd} LIBQPIDCLUSTER=${LIBQPIDCLUSTER:-$PWD/../.libs/libqpidcluster.so} -CLUSTER=$USER # User name is default cluster name. +NAME=$USER # User name is default cluster name. RESTART=NO -while getopts "kp:c:q:r" ARG ; do +while getopts "kp:n:q:r" ARG ; do case $ARG in k) KILL=yes ;; p) PORT="$OPTARG" ;; - c) CLUSTER=$OPTARG ;; + n) NAME=$OPTARG ;; q) QPIDD=$OPTARG ;; l) LIBQPIDCLUSTER=$OPTARG ;; r) RESTART=yes ;; @@ -33,17 +33,17 @@ done shift `expr $OPTIND - 1` test -n "$PORT" && PORTOPT="-p $PORT" test "$KILL" = yes && KILL="$QPIDD -q $PORTOPT ;" -test -z "$*" && { echo Must specify at least one host; exit 1; } +CLUSTER=${*:-$CLUSTER} # Use args or env +test -z "$CLUSTER" && { echo Must specify at least one host; exit 1; } -OPTS="-d $PORTOPT --load-module $LIBQPIDCLUSTER --cluster-name=$CLUSTER --no-data-dir --auth=no --log-output=syslog" +OPTS="-d $PORTOPT --load-module $LIBQPIDCLUSTER --cluster-name=$NAME --no-data-dir --auth=no --log-output=syslog --log-enable=info+" num=0 -for h in $*; do +for h in $CLUSTER; do num=`expr $num + 1` # Give a unique log prefix to each node. cmd="$KILL $QPIDD $OPTS --log-prefix $num.$h" - echo == $h - out=`echo "$cmd" | ssh $h newgrp ais` || { echo $out ; exit 1; } + out=`echo "$cmd" | ssh $h newgrp ais` || { echo == $h error: $out ; exit 1; } if [ "$PORT" = 0 ] ; then p=$out; else p=$PORT; fi echo "$h $p" done |
