From 21ec90fa6f5d192df0e2753de0bace17bef5e7d2 Mon Sep 17 00:00:00 2001 From: Rupert Smith Date: Thu, 16 Aug 2007 10:16:48 +0000 Subject: Fixed multiplcation for expected message count on shared destinations p2p. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2@566643 13f79535-47bb-0310-9956-ffa450edef68 --- java/perftests/pom.xml | 32 ++++++++++++++++++++++ .../main/java/org/apache/qpid/ping/PingClient.java | 21 ++++++++++---- .../apache/qpid/requestreply/PingPongProducer.java | 23 +++++++++++----- 3 files changed, 64 insertions(+), 12 deletions(-) (limited to 'java') diff --git a/java/perftests/pom.xml b/java/perftests/pom.xml index 132eb83e8c..39cd5a0a3a 100644 --- a/java/perftests/pom.xml +++ b/java/perftests/pom.xml @@ -317,6 +317,38 @@ -n PTM-Qpid-01-1M -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true transacted=true commitBatchSize=10 batchSize=1000 messageSize=1048576 destinationCount=1 rate=0 maxPending=80000000 -n PTM-Qpid-02-1M -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true transacted=false commitBatchSize=10 batchSize=1000 messageSize=1048476 destinationCount=1 rate=0 maxPending=80000000 + + + -n TQB-Qpid-01 -d1M -s[1000] -c[1,32],samples=6,exp -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false transacted=true commitBatchSize=1 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=80000000 uniqueDests=false + -n TQB-Qpid-02 -d1M -s[1000] -c[1,32],samples=6,exp -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false transacted=false commitBatchSize=1 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=80000000 uniqueDests=false + -n PQB-Qpid-01 -d1M -s[1000] -c[1,32],samples=6,exp -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false transacted=true commitBatchSize=1 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=80000000 uniqueDests=false + -n PQB-Qpid-02 -d1M -s[1000] -c[1,32],samples=6,exp -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false transacted=false commitBatchSize=1 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=80000000 uniqueDests=false + + + -n FT-Qpid-01 -s[2500] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf messageSize=256 batchSize=10000 transacted=true broker="tcp://127.0.0.1:5001;tcp://127.0.0.1:5002" failBeforeSend=true -o $QPID_WORK/results -n FT-Qpid-02 -s[2500] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf messageSize=256 batchSize=10000 transacted=true broker="tcp://127.0.0.1:5001;tcp://127.0.0.1:5002" failAfterSend=true -o $QPID_WORK/results diff --git a/java/perftests/src/main/java/org/apache/qpid/ping/PingClient.java b/java/perftests/src/main/java/org/apache/qpid/ping/PingClient.java index e3b0249ed3..984b994c05 100644 --- a/java/perftests/src/main/java/org/apache/qpid/ping/PingClient.java +++ b/java/perftests/src/main/java/org/apache/qpid/ping/PingClient.java @@ -20,12 +20,14 @@ */ package org.apache.qpid.ping; -import java.util.List; -import java.util.Properties; +import org.apache.log4j.Logger; + +import org.apache.qpid.requestreply.PingPongProducer; import javax.jms.Destination; -import org.apache.qpid.requestreply.PingPongProducer; +import java.util.List; +import java.util.Properties; /** * PingClient is a {@link PingPongProducer} that does not need a {@link org.apache.qpid.requestreply.PingPongBouncer} @@ -36,7 +38,7 @@ import org.apache.qpid.requestreply.PingPongProducer; * are created they will all be run in parallel and be active in sending and consuming pings at the same time. * If the unique destinations flag is not set and a pub/sub ping cycle is being run, this means that they will all hear * pings sent by each other. The expected number of pings received will therefore be multiplied up by the number of - * active ping clients. The {@link #getConsumersPerTopic()} method is used to supply this multiplier under these + * active ping clients. The {@link #getConsumersPerDestination()} method is used to supply this multiplier under these * conditions. * *

@@ -47,6 +49,9 @@ import org.apache.qpid.requestreply.PingPongProducer; */ public class PingClient extends PingPongProducer { + /** Used for debugging. */ + private final Logger log = Logger.getLogger(PingClient.class); + /** Used to count the number of ping clients created. */ private static int _pingClientCount; @@ -82,14 +87,20 @@ public class PingClient extends PingPongProducer * * @return The scaling up of the number of expected pub/sub pings. */ - public int getConsumersPerTopic() + public int getConsumersPerDestination() { + log.debug("public int getConsumersPerDestination(): called"); + if (_isUnique) { + log.debug("1 consumer per destination."); + return 1; } else { + log.debug(_pingClientCount + " consumers per destination."); + return _pingClientCount; } } diff --git a/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java b/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java index 140e3bad1c..1a731b2b7e 100644 --- a/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java +++ b/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java @@ -435,10 +435,10 @@ public class PingPongProducer implements Runnable, MessageListener, ExceptionLis protected MessageConsumer _consumer; /** - * Holds the number of consumers that will be attached to each topic. Each pings will result in a reply from each of the - * attached clients + * Holds the number of consumers that will be attached to each destination in the test. Each pings will result in + * a message being received by each of these clients in a pub/sub tests, and by only one at a time in a p2p test. */ - static int _consumersPerTopic = 1; + static int _consumersPerDestination = 1; /** The prompt to display when asking the user to kill the broker for failover testing. */ private static final String KILL_BROKER_PROMPT = "Kill broker now, then press Return."; @@ -1427,18 +1427,27 @@ public class PingPongProducer implements Runnable, MessageListener, ExceptionLis } /** - * This value will be changed by PingClient to represent the number of clients connected to each topic. + * Gets the number of consumers that are listening to each destination in the test. * * @return int The number of consumers subscribing to each topic. */ - public int getConsumersPerTopic() + public int getConsumersPerDestination() { - return _consumersPerTopic; + return _consumersPerDestination; } + /** + * Calculates how many pings are expected to be received for the given number sent. + * + * @param numpings The number of pings that will be sent. + * + * @return The number that should be received, for the test to pass. + */ public int getExpectedNumPings(int numpings) { - return numpings * getConsumersPerTopic(); + log.debug("Each ping will be received by " + (_isPubSub ? getConsumersPerDestination() : 1) + " consumers."); + + return numpings * (_isPubSub ? getConsumersPerDestination() : 1); } /** -- cgit v1.2.1
CRC Card