summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2007-01-12 14:44:20 +0000
committerMartin Ritchie <ritchiem@apache.org>2007-01-12 14:44:20 +0000
commit74b689ed355abed3f94747c8a78c1284363603cd (patch)
tree66671514d9abecfbef50f8d655989413860131f2 /java
parent1d229505561e9339753f474338a79ed42f0a58f9 (diff)
downloadqpid-python-74b689ed355abed3f94747c8a78c1284363603cd.tar.gz
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. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@495584 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/perftests/RunningPerformanceTests.txt68
-rwxr-xr-xjava/perftests/bin/serviceRequestReply-QuickTest.sh2
-rwxr-xr-xjava/perftests/bin/topic-QuickTest.sh55
-rwxr-xr-xjava/perftests/bin/topicListener.sh3
-rwxr-xr-xjava/perftests/bin/topicPublisher.sh2
-rw-r--r--java/perftests/src/main/java/org/apache/qpid/topic/Publisher.java31
-rw-r--r--java/perftests/src/main/java/perftests.log4j3
7 files changed, 124 insertions, 40 deletions
diff --git a/java/perftests/RunningPerformanceTests.txt b/java/perftests/RunningPerformanceTests.txt
index 0b1d6d4f90..ff3d5ef4f5 100644
--- a/java/perftests/RunningPerformanceTests.txt
+++ b/java/perftests/RunningPerformanceTests.txt
@@ -5,7 +5,7 @@ This performance test suite contains a number of tests.
- Service request-reply
- Ping-Pong
-- Headers
+- Topic
Service request-reply
---------------------
@@ -20,7 +20,7 @@ message to the well known service queue. The test allows you to time how long
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 @@ After receiving all the messages the client outputs the rate it achieved.
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.
+The time taken to send all messages and receive a response from all clients is displayed.
-Headers
--------
+Quick Run:
+./topic-QuickTest.sh <host> <port> <messages> <clients> <batches>
-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.
+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.
-You run the listener processes first:
+Detailed Run:
+
+You must run the listener processes first:
-run_many.sh 10 header "headersListener.sh -host 10.0.0.1 -port 5672"
+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:
-topicPublisher.sh -host 10.0.0.1 -port 5672 -clients 10 -messages 10000 \ No newline at end of file
+Additional parameters to scripts
+
+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
diff --git a/java/perftests/bin/serviceRequestReply-QuickTest.sh b/java/perftests/bin/serviceRequestReply-QuickTest.sh
index 667e6c2d87..b79e94e291 100755
--- a/java/perftests/bin/serviceRequestReply-QuickTest.sh
+++ b/java/perftests/bin/serviceRequestReply-QuickTest.sh
@@ -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
diff --git a/java/perftests/bin/topic-QuickTest.sh b/java/perftests/bin/topic-QuickTest.sh
new file mode 100755
index 0000000000..931f102893
--- /dev/null
+++ b/java/perftests/bin/topic-QuickTest.sh
@@ -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 $@
+
+
diff --git a/java/perftests/bin/topicListener.sh b/java/perftests/bin/topicListener.sh
index 454efefe7d..757a8c9edb 100755
--- a/java/perftests/bin/topicListener.sh
+++ b/java/perftests/bin/topicListener.sh
@@ -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 $@
diff --git a/java/perftests/bin/topicPublisher.sh b/java/perftests/bin/topicPublisher.sh
index cc3a8736cc..8bcdaca3c4 100755
--- a/java/perftests/bin/topicPublisher.sh
+++ b/java/perftests/bin/topicPublisher.sh
@@ -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 $@
diff --git a/java/perftests/src/main/java/org/apache/qpid/topic/Publisher.java b/java/perftests/src/main/java/org/apache/qpid/topic/Publisher.java
index d788029ee9..c3b19b558a 100644
--- a/java/perftests/src/main/java/org/apache/qpid/topic/Publisher.java
+++ b/java/perftests/src/main/java/org/apache/qpid/topic/Publisher.java
@@ -51,7 +51,7 @@ public class Publisher implements MessageListener
_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 @@ public class Publisher implements MessageListener
}
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 @@ public class Publisher implements MessageListener
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 @@ public class Publisher implements MessageListener
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 @@ public class Publisher implements MessageListener
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
diff --git a/java/perftests/src/main/java/perftests.log4j b/java/perftests/src/main/java/perftests.log4j
index 5410f9ecd2..d5196b4c79 100644
--- a/java/perftests/src/main/java/perftests.log4j
+++ b/java/perftests/src/main/java/perftests.log4j
@@ -24,13 +24,14 @@ log4j.additivity.org.apache.qpid=false
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