#!/bin/sh # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # # A basic "benchmark" to generate performacne samples of throughput # and latency against a single cluster member while they are replicating. # # Must be run in the qpid src/tests build directory. # # 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= 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" ;; esac done 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; } export TESTDIR # For perfdist CLIENTS=($CLIENTS) # Convert to array trap "rm -f $FILES" EXIT dosamples() { FILE=`mktemp` FILES="$FILES $FILE" TABS=`echo "$HEADING" | sed s'/[^ ]//g'` { echo "\"$*\"$TABS" echo "$HEADING" for (( i=0; i<$SAMPLES; ++i)) ; do echo "`$*`" ; done echo } | tee $FILE } HEADING="pub sub total Mb" dosamples $SCRIPTDIR/perfdist $BROKER_FLAGS --count $COUNT --nsubs 2 --npubs 2 --qt 2 -s -- ${CLIENTS[*]} HEADING="pub" dosamples ssh -A ${CLIENTS[0]} $TESTDIR/publish --routing-key perftest0 -s $BROKER_FLAGS --count $COUNT HEADING="sub" dosamples ssh -A ${CLIENTS[0]} $TESTDIR/consume --queue perftest0 -s $BROKER_FLAGS --count $COUNT HEADING="min max avg" dosamples ssh -A ${CLIENTS[0]} $TESTDIR/echotest --count $ECHO -s echo echo "Tab separated spreadsheet (also stored in benchmark.tab):" echo paste $FILES | tee benchmark.tab