summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-12-13 20:39:28 +0000
committerAlan Conway <aconway@apache.org>2007-12-13 20:39:28 +0000
commit0d3521880f6c98ef529b78786cc561a2ae18bb12 (patch)
tree427557eb23dd57710fd91644587e02e3c6fdb9b1 /cpp
parent290f052bdcfa112292c891dc4f179e20bf06c812 (diff)
downloadqpid-python-0d3521880f6c98ef529b78786cc561a2ae18bb12.tar.gz
perftest:
- changed default message size to 1024 - made --pub-confirm=true the default for accurate publish rates. - added Mbytes/sec rate to results perfdist: takes a single host list for publishr and subscriber clients. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@604022 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rwxr-xr-xcpp/src/tests/perfdist47
-rw-r--r--cpp/src/tests/perftest.cpp26
2 files changed, 42 insertions, 31 deletions
diff --git a/cpp/src/tests/perfdist b/cpp/src/tests/perfdist
index 820fc535cb..816d2d99f6 100755
--- a/cpp/src/tests/perfdist
+++ b/cpp/src/tests/perfdist
@@ -1,45 +1,50 @@
#!/bin/bash
#
+# Distributed perftest.
+# Runs perftest clients on multiple hosts using ssh.
+#
+
set -e
usage() {
cat <<EOF
-usage: $0 <perftest-args> --pubhosts <publish-hosts> --subhosts <subscribe-hosts>
+usage: $0 <perftest-args> -- <client-hosts ...>
+
+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.
+
+Do not pass preftest action flags: --setup, --control, --publish, --subscribe.
+The script will pass them to the appropriate client processes.
-All perftest args must come before --pubhosts or --subhosts. If
---npubs or --nsubs is larger than corresponding hosts list, the list
-is used round-robin.
+Note all perftest args must come before --.
-Do not pass action flags --setup, --control, --publish, --subscribe they
-will be passed to the appropriate processes.
+Error: $*
EOF
exit 1
}
collect() { eval $COLLECT=\""\$$COLLECT $*"\"; }
-
+NPUBS=1
+NSUBS=1
COLLECT=ARGS
while test $# -gt 0; do
case $1 in
- --publish|--subscribe|--setup|--control) usage ;;
+ --publish|--subscribe|--setup|--control) usage "Don't pass perftest action flags: $1" ;;
--npubs) collect $1 $2; NPUBS=$2; shift 2 ;;
--nsubs) collect $1 $2; NSUBS=$2; shift 2 ;;
- --pubhosts) COLLECT=PUBHOSTS; shift ;;
- --subhosts) COLLECT=SUBHOSTS; shift ;;
+ --) COLLECT=HOSTS; shift ;;
*) collect $1; shift ;;
esac
done
-if [ -z "$PUBHOSTS" ]; then echo "Missing --pubhosts"; usage; fi
-if [ -z "$SUBHOSTS" ]; then echo "Missing --subhosts"; usage; fi
-
-PERFTEST="`PATH=$PWD:$PATH which perftest` $ARGS"
+if [ -z "$HOSTS" ]; then usage "No hosts listed after --"; fi
+PATH="`dirname $0`:$PATH"
+PERFTEST="`which perftest` $ARGS" || usage "Can't find perftest executable"
-start() {
- ssh $2 $PERFTEST --$1
-}
+HOSTS=($HOSTS)
+start() { ssh ${HOSTS[i % ${#HOSTS[*]}]} $PERFTEST $*& }
$PERFTEST --setup
-PUBS=($PUBHOSTS)
-for (( i=0 ; i < $NPUBS ; ++i)); do start publish ${PUBS[i % ${#PUBS[*]}]} & done
-SUBS=($SUBHOSTS)
-for (( i=0 ; i < $NSUBS ; ++i)); do start subscribe ${SUBS[i % ${#SUBS[*]}]} & done
+for (( i=0 ; i < $NPUBS ; ++i)); do start --publish; done
+for (( ; i < $NPUBS+$NSUBS ; ++i)); do start --subscribe; done
$PERFTEST --control
diff --git a/cpp/src/tests/perftest.cpp b/cpp/src/tests/perftest.cpp
index bf6b0fe4d5..8ba0f21fc5 100644
--- a/cpp/src/tests/perftest.cpp
+++ b/cpp/src/tests/perftest.cpp
@@ -89,7 +89,7 @@ struct Opts : public TestOptions {
Opts() :
TestOptions(helpText),
setup(false), control(false), publish(false), subscribe(false),
- pubs(1), count(500000), size(64), confirm(false), durable(false),
+ pubs(1), count(500000), size(1024), confirm(true), durable(false),
subs(1), ack(0),
qt(1), mode(SHARED), summary(false)
{
@@ -107,7 +107,7 @@ struct Opts : public TestOptions {
("npubs", optValue(pubs, "N"), "Create N publishers.")
("count", optValue(count, "N"), "Each publisher sends N messages.")
("size", optValue(size, "BYTES"), "Size of messages in bytes.")
- ("pub-confirm", optValue(confirm), "Publisher use confirm-mode.")
+ ("pub-confirm", optValue(confirm, "yes|no"), "Publisher use confirm-mode.")
("durable", optValue(durable, "yes|no"), "Publish messages as durable.")
("nsubs", optValue(subs, "N"), "Create N subscribers.")
@@ -115,7 +115,7 @@ struct Opts : public TestOptions {
"N==0: Subscriber uses unconfirmed mode")
("qt", optValue(qt, "N"), "Create N queues or topics.")
- ("summary,s", optValue(summary), "Summary output only.");
+ ("summary,s", optValue(summary), "Summary output: pubs/sec subs/sec transfers/sec Mbytes/sec");
}
// Computed values
@@ -315,20 +315,26 @@ struct Controller : public Client {
process(opts.totalSubs, "sub_done", boost::ref(subRates));
AbsTime end=now();
double time=secs(start, end);
-
+ double txrate=opts.transfers/time;
+ double mbytes=(txrate*opts.size)/(1024*1024);
+
if (!opts.summary) {
- cout << endl << "Publish rates: " << endl;
+ cout << endl << "Total " << opts.transfers << " transfers of "
+ << opts.size << " bytes in "
+ << time << " seconds." << endl;
+ cout << endl << "Publish transfers/sec: " << endl;
pubRates.print(cout);
- cout << endl << "Subscribe rates: " << endl;
+ cout << endl << "Subscribe transfers/sec: " << endl;
subRates.print(cout);
- cout << endl << "Total transfers: " << opts.transfers << endl;
- cout << "Total time (secs): " << time << endl;
- cout << "Total rate: " << opts.transfers/time << endl;
+ cout << endl
+ << "Total transfers/sec: " << txrate << endl
+ << "Total Mbytes/sec: " << mbytes << endl;
}
else {
cout << pubRates.mean() << "\t"
<< subRates.mean() << "\t"
- << opts.transfers/time << endl;
+ << txrate << "\t"
+ << mbytes << endl;
}
}
catch (const std::exception& e) {