qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r604022 - in /incubator/qpid/trunk/qpid/cpp/src/tests: perfdist perftest.cpp
Date Thu, 13 Dec 2007 20:39:29 GMT
Author: aconway
Date: Thu Dec 13 12:39:28 2007
New Revision: 604022

URL: http://svn.apache.org/viewvc?rev=604022&view=rev
Log:
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.

Modified:
    incubator/qpid/trunk/qpid/cpp/src/tests/perfdist
    incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp

Modified: incubator/qpid/trunk/qpid/cpp/src/tests/perfdist
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/perfdist?rev=604022&r1=604021&r2=604022&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/perfdist (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/perfdist Thu Dec 13 12:39:28 2007
@@ -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

Modified: incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp?rev=604022&r1=604021&r2=604022&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp Thu Dec 13 12:39:28 2007
@@ -89,7 +89,7 @@
     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 @@
             ("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 @@
              "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 @@
             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) {



Mime
View raw message