Updated the performance tests

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@618617 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-02-05 12:05:52 +00:00
parent c24574c801
commit c99f05529f
5 changed files with 29 additions and 7 deletions

View File

@ -38,8 +38,8 @@ public class AMQStoreDurableTopicTest extends SimpleDurableTopicTest {
}
protected void setUp() throws Exception {
numberofProducers=2;
numberOfConsumers=10;
numberofProducers=1;
numberOfConsumers=1;
this.consumerSleepDuration=0;
super.setUp();
}

View File

@ -26,7 +26,6 @@ import javax.jms.MessageListener;
import javax.jms.Session;
import javax.jms.Topic;
import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQMessageAudit;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -39,6 +38,7 @@ public class PerfConsumer implements MessageListener {
protected Connection connection;
protected MessageConsumer consumer;
protected long sleepDuration;
protected boolean enableAudit = true;
protected ActiveMQMessageAudit audit = new ActiveMQMessageAudit(16 * 1024,20);
protected PerfRate rate = new PerfRate();
@ -79,7 +79,7 @@ public class PerfConsumer implements MessageListener {
public void onMessage(Message msg) {
rate.increment();
try {
if (msg.getJMSDestination() instanceof Topic && !this.audit.isInOrder(msg.getJMSMessageID())) {
if (enableAudit && !this.audit.isInOrder(msg.getJMSMessageID())) {
LOG.error("Message out of order!!" + msg);
}
if (this.audit.isDuplicate(msg)){
@ -104,4 +104,12 @@ public class PerfConsumer implements MessageListener {
public synchronized void setSleepDuration(long sleepDuration) {
this.sleepDuration = sleepDuration;
}
public boolean isEnableAudit() {
return enableAudit;
}
public void setEnableAudit(boolean doAudit) {
this.enableAudit = doAudit;
}
}

View File

@ -49,6 +49,10 @@ public class PerfProducer implements Runnable {
public void setDeliveryMode(int mode) throws JMSException {
producer.setDeliveryMode(mode);
}
public void setTimeToLive(int ttl) throws JMSException {
producer.setTimeToLive(ttl);
}
public void shutDown() throws JMSException {
connection.close();

View File

@ -29,6 +29,7 @@ public class SimpleNonPersistentQueueTest extends SimpleQueueTest {
protected PerfProducer createProducer(ConnectionFactory fac, Destination dest, int number, byte[] payload) throws JMSException {
PerfProducer pp = new PerfProducer(fac, dest, payload);
pp.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
pp.setTimeToLive(100);
return pp;
}
}

View File

@ -16,6 +16,7 @@
*/
package org.apache.activemq.perf;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Session;
@ -30,10 +31,18 @@ public class SimpleQueueTest extends SimpleTopicTest {
}
protected void setUp() throws Exception {
numberOfConsumers = 10;
numberofProducers = 10;
this.consumerSleepDuration=20;
numberOfConsumers = 1;
numberofProducers = 2;
this.consumerSleepDuration=0;
super.setUp();
}
protected PerfConsumer createConsumer(ConnectionFactory fac, Destination dest, int number) throws JMSException {
PerfConsumer consumer = new PerfConsumer(fac, dest);
boolean enableAudit = numberOfConsumers <= 1;
System.out.println("Enable Audit = " + enableAudit);
consumer.setEnableAudit(enableAudit);
return consumer;
}
}