Author: rgreig
Date: Thu Jan 18 08:58:35 2007
New Revision: 497498
URL: http://svn.apache.org/viewvc?view=rev&rev=497498
Log:
(Pacth by Rupert Smith) Fixed mistake in PingPongProducer, it was creating its
message counter after
sending messages, so sometimes the onMessage loop had already received mesages
before the counter was created.
Modified:
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java
incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java
incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java
Modified:
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java?view=diff&rev=497498&r1=497497&r2=497498
==============================================================================
---
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java
(original)
+++
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java
Thu Jan 18 08:58:35 2007
@@ -125,16 +125,12 @@
// Create a session to listen for messages on and one to send replies
on, transactional depending on the
// command line option.
- Session consumerSession = (Session)
getConnection().createSession(transacted, Session.AUTO_ACKNOWLEDGE);
- Session producerSession = (Session)
getConnection().createSession(transacted, Session.AUTO_ACKNOWLEDGE);
+ _consumerSession = (Session) getConnection().createSession(transacted,
Session.AUTO_ACKNOWLEDGE);
+ _producerSession = (Session) getConnection().createSession(transacted,
Session.AUTO_ACKNOWLEDGE);
// Create the queue to listen for message on.
Queue q = new AMQQueue(queueName);
- MessageConsumer consumer = consumerSession.createConsumer(q, PREFETCH,
NO_LOCAL, EXCLUSIVE, selector);
-
- // Hang on to the sessions for the messages and replies.
- _consumerSession = consumerSession;
- _producerSession = producerSession;
+ MessageConsumer consumer = _consumerSession.createConsumer(q,
PREFETCH, NO_LOCAL, EXCLUSIVE, selector);
_verbose = verbose;
_persistent = persistent;
Modified:
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java?view=diff&rev=497498&r1=497497&r2=497498
==============================================================================
---
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java
(original)
+++
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java
Thu Jan 18 08:58:35 2007
@@ -215,7 +215,7 @@
}
/**
- * Primes the test loop by sending a few messages, then introducing a
short wait. This allows the bounce back client
+ * Primes the test loop by sending a few messages, then introduces a short
wait. This allows the bounce back client
* on the other end a chance to configure its reply producer on the reply
to destination. It is also worth calling
* this a few times, in order to prime the JVMs JIT compilation.
*
@@ -309,6 +309,11 @@
String messageCorrelationId =
Long.toString(idGenerator.incrementAndGet());
message.setJMSCorrelationID(messageCorrelationId);
+ // Create a count down latch to count the number of replies with. This
is created before the message is sent
+ // so that the message is not received before the count down is
created.
+ CountDownLatch trafficLight = new CountDownLatch(numPings);
+ trafficLights.put(messageCorrelationId, trafficLight);
+
for (int i = 0; i < numPings; i++)
{
// Re-timestamp the message.
@@ -323,17 +328,12 @@
// Keep the messageId to correlate with the reply.
//String messageId = message.getJMSMessageID();
-
if (_verbose)
{
_logger.info(timestampFormatter.format(new Date()) + ": Pinged at
with correlation id, " + messageCorrelationId);
}
// Block the current thread until a reply to the message is received,
or it times out.
- CountDownLatch trafficLight = new CountDownLatch(numPings);
- trafficLights.put(messageCorrelationId, trafficLight);
-
- // Note that this call expects a timeout in nanoseconds, millisecond
timeout is multiplied up.
trafficLight.await(timeout, TimeUnit.MILLISECONDS);
// Work out how many replies were receieved.
Modified:
incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java?view=diff&rev=497498&r1=497497&r2=497498
==============================================================================
---
incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java
(original)
+++
incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java
Thu Jan 18 08:58:35 2007
@@ -10,13 +10,25 @@
import org.apache.log4j.Logger;
import org.apache.log4j.NDC;
-import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.AMQQueue;
-import org.apache.qpid.jms.Connection;
-import org.apache.qpid.jms.MessageProducer;
-import org.apache.qpid.jms.Session;
-
/**
+ *
+ * PingTestPerf is a ping test, that has been written with the intention of
being scaled up to run many times
+ * simultaneously to simluate many clients/producers/connections.
+ *
+ * <p/>A single run of the test using the default JUnit test runner will
result in the sending and timing of a single
+ * full round trip ping. This test may be scaled up using a suitable JUnit
test runner. See [EMAIL PROTECTED] TKTestRunner} or
+ * [EMAIL PROTECTED] PPTestRunner} for more information on how to do this.
+ *
+ * <p/>The setup/teardown cycle establishes a connection to a broker and sets
up a queue to send ping messages to and a
+ * temporary queue for replies. This setup is only established once for all
the test repeats/threads that may be run,
+ * except if the connection is lost in which case an attempt to re-establish
the setup is made.
+ *
+ * <p/>The test cycle is: Connects to a queue, creates a temporary queue,
creates messages containing a property that
+ * is the name of the temporary queue, fires off a message on the original
queue and waits for a response on the
+ * temporary queue.
+ *
+ * <p/>Configurable test properties: message size, transacted or not,
persistent or not. Broker connection details.
+ *
* <p><table id="crc"><caption>CRC Card</caption>
* <tr><th> Responsibilities <th> Collaborations
* </table>
Modified:
incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java?view=diff&rev=497498&r1=497497&r2=497498
==============================================================================
---
incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java
(original)
+++
incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java
Thu Jan 18 08:58:35 2007
@@ -16,20 +16,21 @@
/**
* PingPongTestPerf is a full round trip ping test, that has been written with
the intention of being scaled up to run
- * many times simultaneously. A full round trip ping sends a message from a
producer to a conumer, then the consumer
- * replies to the message on a temporary queue.
+ * many times simultaneously to simluate many clients/producer/connections. A
full round trip ping sends a message from
+ * a producer to a conumer, then the consumer replies to the message on a
temporary queue.
*
- * <p/>A single run of the test using the default JUnit test runner will
result in the sending and timing of a single
- * full round trip ping. This test may be scaled up using a suitable JUnit
test runner. See [EMAIL PROTECTED] TKTestRunner} or
- * [EMAIL PROTECTED] PPTestRunner} for more information on how to do this.
+ * <p/>A single run of the test using the default JUnit test runner will
result in the sending and timing of the number
+ * of pings specified by the test size and time how long it takes for all of
these to complete. This test may be scaled
+ * up using a suitable JUnit test runner. See [EMAIL PROTECTED] TKTestRunner}
or [EMAIL PROTECTED] PPTestRunner} for more information on how
+ * to do this.
*
* <p/>The setup/teardown cycle establishes a connection to a broker and sets
up a queue to send ping messages to and a
- * temporary queue for replies. This setup is only established once for all
the test repeats/threads that may be run,
- * except if the connection is lost in which case an attempt to re-establish
the setup is made.
+ * temporary queue for replies. This setup is only established once for all
the test repeats, but each test threads
+ * gets its own connection/producer/consumer, this is only re-established if
the connection is lost.
*
* <p/>The test cycle is: Connects to a queue, creates a temporary queue,
creates messages containing a property that
- * is the name of the temporary queue, fires off a message on the original
queue and waits for a response on the
- * temporary queue.
+ * is the name of the temporary queue, fires off many messages on the original
queue and waits for them all to come
+ * back on the temporary queue.
*
* <p/>Configurable test properties: message size, transacted or not,
persistent or not. Broker connection details.
*