Author: ritchiem
Date: Fri Jan 12 06:44:20 2007
New Revision: 495584
URL: http://svn.apache.org/viewvc?view=rev&rev=495584
Log:
QPID-283
Documented topic test
Updated perftests.log4j to include log level in output to make it clear when
there is a non test output
Fixed bug in Publisher where batches of 2 would result in a div by zero error.
scripts created and edited to use the amqj.test.logging.level.
Added:
incubator/qpid/trunk/qpid/java/perftests/bin/topic-QuickTest.sh (with
props)
Modified:
incubator/qpid/trunk/qpid/java/perftests/RunningPerformanceTests.txt
incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestReply-QuickTest.sh
incubator/qpid/trunk/qpid/java/perftests/bin/topicListener.sh
incubator/qpid/trunk/qpid/java/perftests/bin/topicPublisher.sh
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Publisher.java
incubator/qpid/trunk/qpid/java/perftests/src/main/java/perftests.log4j
Modified: incubator/qpid/trunk/qpid/java/perftests/RunningPerformanceTests.txt
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/RunningPerformanceTests.txt?view=diff&rev=495584&r1=495583&r2=495584
==============================================================================
--- incubator/qpid/trunk/qpid/java/perftests/RunningPerformanceTests.txt
(original)
+++ incubator/qpid/trunk/qpid/java/perftests/RunningPerformanceTests.txt Fri
Jan 12 06:44:20 2007
@@ -5,7 +5,7 @@
- Service request-reply
- Ping-Pong
-- Headers
+- Topic
Service request-reply
---------------------
@@ -20,7 +20,7 @@
it takes to send messages and receive the response back. It also allows
varying
of the message size.
-QuickRun:
+Quick Run:
./serviceRequestReply-QuickTest.sh <brokerdetails> <number of messages>
@@ -49,48 +49,64 @@
Ping-Pong
---------
+Description:
+Quick Run:
+Detailed Run:
+Topic
+-------
+Description:
+A more realistic test is the topic test, which tests the
+performance of the topic exchange to a configurable number of clients (e.g.
50).
+A publisher sends batches of of messages to a topic that a number of clients
are
+subscribed to. The clients recevie each all the messages and then send a
response.
-Headers
--------
+The time taken to send all messages and receive a response from all clients is
displayed.
+Quick Run:
-A more realistic test is the "headers test", which tests the
-performance of routing messages based on message headers to a
-configurable number of clients (e.g. 50). A publisher sends 10000
-messages to each client and waits to receive a message from each
-client when it has received all the messages.
+./topic-QuickTest.sh <host> <port> <messages> <clients> <batches>
-You run the listener processes first:
+This provides a quick test to run everything against a running broker. Simply
specify host, port, the number of messages, number of clients and number of
batches to run this quick test.
-run_many.sh 10 header "headersListener.sh -host 10.0.0.1 -port 5672"
+Detailed Run:
+
+You must run the listener processes first:
+
+run_many.sh 10 topic "topicListener.sh [-host <host> -port <port>]"
In this command, the first argument means start 10 processes, the
second is just a name use in the log files generated and the third
-argument is the command to run. In this case it runs another shell
-script but it could be anything.
+argument is the command to run the specified number of times.
+
+The topicListener by default connects to localhost:5672 this can be changed
using the above flags.
Then run the publisher process:
-headersPublisher.sh -host 10.0.0.1 -port 5672 10000 10
+headersPublisher.sh [-host <host> -port <port> -messages <number> -clients
<number> -batch <number>]
-The last two arguments are: the number of messages to send to each
-client, and the number of clients.
+The default is to connect to localhost:5672 and send 1 batch of 1000 messages
expecting 1 client to respond.
Note that before starting the publisher you should wait about 30
seconds to ensure all the clients are registered with the broker (you
can see this from the broker output). Otherwise the numbers will be
slightly skewed.
-A third useful test, which can easily be ported to other JMS
-implementations is the "topic test". It does the same as the headers
-test but using a standard topic (e.g. pub sub).
-
-To run the listeners:
-
-run_many.sh 10 topic "topicListener.sh -host 10.0.0.1 -port 5672"
-and to run the publisher:
+Additional parameters to scripts
-topicPublisher.sh -host 10.0.0.1 -port 5672 -clients 10 -messages 10000
\ No newline at end of file
+Publisher
+-payload <int> : specify the payload size (256b Default)
+-delay <long> : Number of seconds to send between batches (0
Default)
+-warmup <int> : Number of messages to send as a warm up (0
Default)
+-ack <int> : Acknowledgement mode
+ - 1 : Auto
+ - 2 : Client
+ - 3 : Dups_OK
+ - 257 : No (Default)
+ - 258 : Pre
+-factory <string> : ConnectionFactoryInitialiser class
+-persistent <"true"|other> : User persistent messages if string equals "true"
(false Default)
+-clientId <string> : Set client id
+-subscriptionId <string> : set subscription id
Modified:
incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestReply-QuickTest.sh
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestReply-QuickTest.sh?view=diff&rev=495584&r1=495583&r2=495584
==============================================================================
---
incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestReply-QuickTest.sh
(original)
+++
incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestReply-QuickTest.sh
Fri Jan 12 06:44:20 2007
@@ -20,7 +20,7 @@
# args supplied: <brokerdetails> <num messages>
if [[ $# != 2 ]] ; then
- echo "usage: ./serviceQuickTest.sh <brokerdetails> <Number of messages>
[<P[ersistent]|N[onPersistent] (default N)> <T[ransacted]|N[onTransacted]
(default N)>]"
+ echo "usage: ./serviceRequestReply-QuickTest.sh <brokerdetails> <Number of
messages> [<P[ersistent]|N[onPersistent] (default N)>
<T[ransacted]|N[onTransacted] (default N)>]"
exit 1
fi
Added: incubator/qpid/trunk/qpid/java/perftests/bin/topic-QuickTest.sh
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/bin/topic-QuickTest.sh?view=auto&rev=495584
==============================================================================
--- incubator/qpid/trunk/qpid/java/perftests/bin/topic-QuickTest.sh (added)
+++ incubator/qpid/trunk/qpid/java/perftests/bin/topic-QuickTest.sh Fri Jan 12
06:44:20 2007
@@ -0,0 +1,55 @@
+#!/bin/bash
+#
+# 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.
+#
+# args supplied: <host> <port> <messages> <clients> <batches>
+
+if [[ $# < 5 ]] ; then
+ echo "usage: ./topic-QuickTest.sh <host> <port> <messages> <clients>
<batches> [other params for both listener and publisher]"
+ exit 1
+fi
+
+host=$1
+shift
+
+port=$1
+shift
+
+nomessages=$1
+shift
+
+noclients=$1
+shift
+
+batches=$1
+shift
+
+sleeptime=$(( 2 * $noclients ))
+
+. ./setupclasspath.sh
+echo $CP
+
+./run_many.sh $noclients topic "$JAVA_HOME/bin/java -cp $CP
-Damqj.logging.level='warn' -Damqj.test.logging.level='info'
-Dlog4j.configuration=src/perftests.log4j org.apache.qpid.topic.Listener -host
$host -port $port $@" &
+
+echo
+echo "Pausing for $sleeptime seconds to allow clients to connect"
+sleep $sleeptime
+
+$JAVA_HOME/bin/java -cp $CP -Damqj.logging.level="warn"
-Damqj.test.logging.level="info" -Dlog4j.configuration=src/perftests.log4j
org.apache.qpid.topic.Publisher -host $host -port $port -messages $nomessages
-clients $noclients -batch $batches $@
+
+
Propchange: incubator/qpid/trunk/qpid/java/perftests/bin/topic-QuickTest.sh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/qpid/trunk/qpid/java/perftests/bin/topic-QuickTest.sh
------------------------------------------------------------------------------
svn:executable = *
Modified: incubator/qpid/trunk/qpid/java/perftests/bin/topicListener.sh
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/bin/topicListener.sh?view=diff&rev=495584&r1=495583&r2=495584
==============================================================================
--- incubator/qpid/trunk/qpid/java/perftests/bin/topicListener.sh (original)
+++ incubator/qpid/trunk/qpid/java/perftests/bin/topicListener.sh Fri Jan 12
06:44:20 2007
@@ -22,4 +22,5 @@
# XXX -Xmx512m -Xms512m -XX:NewSize=150m
. ./setupclasspath.sh
echo $CP
-$JAVA_HOME/bin/java -cp $CP -Damqj.logging.level="INFO"
org.apache.qpid.topic.Listener $*
+
+$JAVA_HOME/bin/java -cp $CP -Damqj.logging.level="warn"
-Damqj.test.logging.level="info" -Dlog4j.configuration=src/perftests.log4j
org.apache.qpid.topic.Listener $@
Modified: incubator/qpid/trunk/qpid/java/perftests/bin/topicPublisher.sh
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/bin/topicPublisher.sh?view=diff&rev=495584&r1=495583&r2=495584
==============================================================================
--- incubator/qpid/trunk/qpid/java/perftests/bin/topicPublisher.sh (original)
+++ incubator/qpid/trunk/qpid/java/perftests/bin/topicPublisher.sh Fri Jan 12
06:44:20 2007
@@ -20,4 +20,4 @@
# XXX -Xmx512m -Xms512m -XX:NewSize=150m
. ./setupclasspath.sh
-$JAVA_HOME/bin/java -cp $CP -Damqj.logging.level="INFO"
org.apache.qpid.topic.Publisher $*
+$JAVA_HOME/bin/java -cp $CP -Damqj.logging.level="warn"
-Damqj.test.logging.level="info" -Dlog4j.configuration=src/perftests.log4j
org.apache.qpid.topic.Publisher $@
Modified:
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Publisher.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Publisher.java?view=diff&rev=495584&r1=495583&r2=495584
==============================================================================
---
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Publisher.java
(original)
+++
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Publisher.java
Fri Jan 12 06:44:20 2007
@@ -51,7 +51,7 @@
_factory.createControlConsumer().setMessageListener(this);
_connection.start();
- if(warmup > 0)
+ if (warmup > 0)
{
System.out.println("Runing warmup (" + warmup + " msgs)");
long time = batch(warmup, consumerCount);
@@ -59,11 +59,14 @@
}
long[] times = new long[batches];
- for(int i = 0; i < batches; i++)
+ for (int i = 0; i < batches; i++)
{
- if(i > 0) Thread.sleep(delay*1000);
+ if (i > 0)
+ {
+ Thread.sleep(delay * 1000);
+ }
times[i] = batch(msgCount, consumerCount);
- System.out.println("Batch " + (i+1) + " of " + batches + "
completed in " + times[i] + " ms.");
+ System.out.println("Batch " + (i + 1) + " of " + batches + "
completed in " + times[i] + " ms.");
}
long min = min(times);
@@ -131,7 +134,7 @@
static long min(long[] times)
{
long min = times.length > 0 ? times[0] : 0;
- for(int i = 0; i < times.length; i++)
+ for (int i = 0; i < times.length; i++)
{
min = Math.min(min, times[i]);
}
@@ -141,7 +144,7 @@
static long max(long[] times)
{
long max = times.length > 0 ? times[0] : 0;
- for(int i = 0; i < times.length; i++)
+ for (int i = 0; i < times.length; i++)
{
max = Math.max(max, times[i]);
}
@@ -151,14 +154,22 @@
static long avg(long[] times, long min, long max)
{
long sum = 0;
- for(int i = 0; i < times.length; i++)
+ for (int i = 0; i < times.length; i++)
{
sum += times[i];
}
- sum -= min;
- sum -= max;
- return (sum / (times.length - 2));
+ int adjustment = 0;
+
+ // Remove min and max if we have run enough batches.
+ if (times.length > 2)
+ {
+ sum -= min;
+ sum -= max;
+ adjustment = 2;
+ }
+
+ return (sum / (times.length - adjustment));
}
public static void main(String[] argv) throws Exception
Modified: incubator/qpid/trunk/qpid/java/perftests/src/main/java/perftests.log4j
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/src/main/java/perftests.log4j?view=diff&rev=495584&r1=495583&r2=495584
==============================================================================
--- incubator/qpid/trunk/qpid/java/perftests/src/main/java/perftests.log4j
(original)
+++ incubator/qpid/trunk/qpid/java/perftests/src/main/java/perftests.log4j Fri
Jan 12 06:44:20 2007
@@ -24,13 +24,14 @@
log4j.logger.org.apache.qpid.requestreply=${amqj.test.logging.level}, fileApp
log4j.logger.org.apache.qpid.pingpong=${amqj.test.logging.level}
+log4j.logger.org.apache.qpid.topic=${amqj.test.logging.level}
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.Threshold=all
log4j.appender.console.layout=org.apache.log4j.PatternLayout
#log4j.appender.console.layout.ConversionPattern=%t %d %p [%c{4}] %m%n
-log4j.appender.console.layout.ConversionPattern=[%c] %m%n
+log4j.appender.console.layout.ConversionPattern=%p [%c] %m%n
log4j.appender.fileApp=org.apache.log4j.FileAppender
log4j.appender.fileApp.file=${log.dir}/perftests.volumetest.log