mirror of https://github.com/apache/activemq.git
Parameter cleanup.
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@412278 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
99b088dcd4
commit
4fb36fe50c
|
@ -19,7 +19,6 @@
|
|||
<plugin>
|
||||
<groupId>incubator-activemq</groupId>
|
||||
<artifactId>maven-activemq-perf-plugin</artifactId>
|
||||
<version>4.1-SNAPSHOT</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
|
|
@ -25,42 +25,34 @@
|
|||
<dependency>
|
||||
<groupId>incubator-activemq</groupId>
|
||||
<artifactId>activemq-core</artifactId>
|
||||
<version>4.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>incubator-activemq</groupId>
|
||||
<artifactId>activemq-console</artifactId>
|
||||
<version>4.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>incubator-activemq</groupId>
|
||||
<artifactId>activeio-core</artifactId>
|
||||
<version>3.0-beta2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
<version>10.1.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derbynet</artifactId>
|
||||
<version>10.1.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>backport-util-concurrent</groupId>
|
||||
<artifactId>backport-util-concurrent</artifactId>
|
||||
<version>2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jms_1.1_spec</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -110,11 +110,12 @@ public class ConsumerMojo
|
|||
*/
|
||||
private String recvCount;
|
||||
|
||||
/**
|
||||
/*
|
||||
* @parameter expression="${consumer.recvDuration}" default-value="60000"
|
||||
* @required
|
||||
*/
|
||||
|
||||
private String recvDuration;
|
||||
*/
|
||||
|
||||
/**
|
||||
* @parameter expression="${consumer.recvType}" default-value="time"
|
||||
|
@ -196,36 +197,35 @@ public class ConsumerMojo
|
|||
public String[] createArgument() {
|
||||
String[] options = new String[25];
|
||||
|
||||
System.out.println("--- " + duration + " ----");
|
||||
options[0] = "-Dsampler.duration=" + duration; // 1 min
|
||||
options[1] = "-Dsampler.interval=" + interval; // 5 secs
|
||||
options[2] = "-Dsampler.rampUpTime=" + rampUpTime; // 10 secs
|
||||
options[3] = "-Dsampler.rampDownTime=" + rampDownTime; // 10 secs
|
||||
options[0] = "sampler.duration=" + duration; // 1 min
|
||||
options[1] = "sampler.interval=" + interval; // 5 secs
|
||||
options[2] = "sampler.rampUpTime=" + rampUpTime; // 10 secs
|
||||
options[3] = "sampler.rampDownTime=" + rampDownTime; // 10 secs
|
||||
|
||||
options[4] = "-Dclient.spiClass=" + spiClass;
|
||||
options[5] = "-Dclient.sessTransacted=" + sessTransacted;
|
||||
options[6] = "-Dclient.sessAckMode=" + sessAckMode;
|
||||
options[7] = "-Dclient.destName=" + destName;
|
||||
options[8] = "-Dclient.destCount=" + destCount;
|
||||
options[9] = "-Dclient.destComposite=" + destComposite;
|
||||
options[4] = "client.spiClass=" + spiClass;
|
||||
options[5] = "client.sessTransacted=" + sessTransacted;
|
||||
options[6] = "client.sessAckMode=" + sessAckMode;
|
||||
options[7] = "client.destName=" + destName;
|
||||
options[8] = "client.destCount=" + destCount;
|
||||
options[9] = "client.destComposite=" + destComposite;
|
||||
|
||||
options[10] = "-Dconsumer.durable=" + durable;
|
||||
options[11] = "-Dconsumer.asyncRecv=" + asyncRecv;
|
||||
options[12] = "-Dconsumer.recvCount=" + recvCount; // 1000 messages
|
||||
options[13] = "-Dconsumer.recvDuration=" + recvDuration; // 1 min
|
||||
options[14] = "-Dconsumer.recvType=" + recvType;
|
||||
options[10] = "consumer.durable=" + durable;
|
||||
options[11] = "consumer.asyncRecv=" + asyncRecv;
|
||||
options[12] = "consumer.recvCount=" + recvCount; // 1000 messages
|
||||
options[13] = "consumer.recvDuration=" + duration; // use sampler.duration.
|
||||
options[14] = "consumer.recvType=" + recvType;
|
||||
|
||||
options[15] = "-Dfactory.brokerUrl=" + brokerUrl;
|
||||
options[16] = "-Dfactory.optimAck=" + optimAck;
|
||||
options[17] = "-Dfactory.optimDispatch=" + optimDispatch;
|
||||
options[18] = "-Dfactory.prefetchQueue=" + prefetchQueue;
|
||||
options[19] = "-Dfactory.prefetchTopic=" + prefetchTopic;
|
||||
options[20] = "-Dfactory.useRetroactive=" + useRetroactive;
|
||||
options[15] = "factory.brokerUrl=" + brokerUrl;
|
||||
options[16] = "factory.optimAck=" + optimAck;
|
||||
options[17] = "factory.optimDispatch=" + optimDispatch;
|
||||
options[18] = "factory.prefetchQueue=" + prefetchQueue;
|
||||
options[19] = "factory.prefetchTopic=" + prefetchTopic;
|
||||
options[20] = "factory.useRetroactive=" + useRetroactive;
|
||||
|
||||
options[21] = "-DsysTest.numClients=" + numClients;
|
||||
options[22] = "-DsysTest.totalDests=" + totalDests;
|
||||
options[23] = "-DsysTest.destDistro=" + destDistro;
|
||||
options[24] = "-DsysTest.reportDirectory=" + reportDirectory;
|
||||
options[21] = "sysTest.numClients=" + numClients;
|
||||
options[22] = "sysTest.totalDests=" + totalDests;
|
||||
options[23] = "sysTest.destDistro=" + destDistro;
|
||||
options[24] = "sysTest.reportDirectory=" + reportDirectory;
|
||||
|
||||
return options;
|
||||
}
|
||||
|
|
|
@ -102,11 +102,12 @@ public class ProducerMojo
|
|||
*/
|
||||
private String sendCount;
|
||||
|
||||
/**
|
||||
/*
|
||||
* @parameter expression="${producer.sendDuration}" default-value="60000"
|
||||
* @required
|
||||
*/
|
||||
|
||||
private String sendDuration;
|
||||
*/
|
||||
|
||||
/**
|
||||
* @parameter expression="${producer.sendType}" default-value="time"
|
||||
|
@ -160,30 +161,30 @@ public class ProducerMojo
|
|||
public String[] createArgument() {
|
||||
|
||||
String[] options = new String[20];
|
||||
options[0] = "-Dsampler.duration=" + duration; // 1 min
|
||||
options[1] = "-Dsampler.interval=" + interval; // 5 secs
|
||||
options[2] = "-Dsampler.rampUpTime=" + rampUpTime; // 10 secs
|
||||
options[3] = "-Dsampler.rampDownTime=" + rampDownTime; // 10 secs
|
||||
options[0] = "sampler.duration=" + duration; // 1 min
|
||||
options[1] = "sampler.interval=" + interval; // 5 secs
|
||||
options[2] = "sampler.rampUpTime=" + rampUpTime; // 10 secs
|
||||
options[3] = "sampler.rampDownTime=" + rampDownTime; // 10 secs
|
||||
|
||||
options[4] = "-Dclient.spiClass=" + spiClass;
|
||||
options[5] = "-Dclient.sessTransacted=" + sessTransacted;
|
||||
options[6] = "-Dclient.sessAckMode=" + sessAckMode;
|
||||
options[7] = "-Dclient.destName=" + destName;
|
||||
options[8] = "-Dclient.destCount=" + destCount;
|
||||
options[9] = "-Dclient.destComposite=" + destComposite;
|
||||
options[4] = "client.spiClass=" + spiClass;
|
||||
options[5] = "client.sessTransacted=" + sessTransacted;
|
||||
options[6] = "client.sessAckMode=" + sessAckMode;
|
||||
options[7] = "client.destName=" + destName;
|
||||
options[8] = "client.destCount=" + destCount;
|
||||
options[9] = "client.destComposite=" + destComposite;
|
||||
|
||||
options[10] = "-Dproducer.messageSize="+messageSize;
|
||||
options[11] = "-Dproducer.sendCount="+sendCount; // 1000 messages
|
||||
options[12] = "-Dproducer.sendDuration="+sendDuration; // 1 min
|
||||
options[13] = "-Dproducer.sendType="+sendType;
|
||||
options[10] = "producer.messageSize="+messageSize;
|
||||
options[11] = "producer.sendCount="+sendCount; // 1000 messages
|
||||
options[12] = "producer.sendDuration="+duration; // use sampler.duration.
|
||||
options[13] = "producer.sendType="+sendType;
|
||||
|
||||
options[14] = "-Dfactory.brokerUrl="+brokerUrl;
|
||||
options[15] = "-Dfactory.asyncSend="+asyncSend;
|
||||
options[14] = "factory.brokerUrl="+brokerUrl;
|
||||
options[15] = "factory.asyncSend="+asyncSend;
|
||||
|
||||
options[16] = "-DsysTest.numClients=" + numClients;
|
||||
options[17] = "-DsysTest.totalDests=" + totalDests;
|
||||
options[18] = "-DsysTest.destDistro=" + destDistro;
|
||||
options[19] = "-DsysTest.reportDirectory=" + reportDirectory;
|
||||
options[16] = "sysTest.numClients=" + numClients;
|
||||
options[17] = "sysTest.totalDests=" + totalDests;
|
||||
options[18] = "sysTest.destDistro=" + destDistro;
|
||||
options[19] = "sysTest.reportDirectory=" + reportDirectory;
|
||||
|
||||
return options;
|
||||
}
|
||||
|
|
|
@ -17,36 +17,30 @@
|
|||
|
||||
package org.apache.activemq.tool;
|
||||
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import javax.jms.MessageListener;
|
||||
import javax.jms.MessageConsumer;
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.Destination;
|
||||
import javax.jms.Topic;
|
||||
import javax.jms.Message;
|
||||
import java.util.Properties;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import javax.jms.*;
|
||||
import java.util.Properties;
|
||||
|
||||
public class JmsConsumerClient extends JmsPerformanceSupport {
|
||||
private static final Log log = LogFactory.getLog(JmsConsumerClient.class);
|
||||
|
||||
private static final String PREFIX_CONFIG_CONSUMER = "consumer.";
|
||||
public static final String TIME_BASED_RECEIVING = "time";
|
||||
public static final String COUNT_BASED_RECEIVING = "count";
|
||||
public static final String TIME_BASED_RECEIVING = "time";
|
||||
public static final String COUNT_BASED_RECEIVING = "count";
|
||||
|
||||
protected Properties jmsConsumerSettings = new Properties();
|
||||
protected Properties jmsConsumerSettings = new Properties();
|
||||
protected MessageConsumer jmsConsumer;
|
||||
|
||||
protected boolean durable = false;
|
||||
protected boolean durable = false;
|
||||
protected boolean asyncRecv = true;
|
||||
protected String consumerName = "TestConsumerClient";
|
||||
protected String consumerName = "TestConsumerClient";
|
||||
|
||||
protected long recvCount = 1000000; // Receive a million messages by default
|
||||
protected long recvDuration = 5 * 60 * 1000; // Receive for 5 mins by default
|
||||
protected String recvType = TIME_BASED_RECEIVING;
|
||||
protected long recvCount = 1000000; // Receive a million messages by default
|
||||
protected long recvDuration = 5 * 60 * 1000; // Receive for 5 mins by default
|
||||
protected String recvType = TIME_BASED_RECEIVING;
|
||||
|
||||
public void receiveMessages() throws JMSException {
|
||||
if (listener != null) {
|
||||
|
@ -157,7 +151,7 @@ public class JmsConsumerClient extends JmsPerformanceSupport {
|
|||
|
||||
public MessageConsumer createJmsConsumer(Destination dest) throws JMSException {
|
||||
if (isDurable()) {
|
||||
jmsConsumer = getSession().createDurableSubscriber((Topic)dest, getConsumerName());
|
||||
jmsConsumer = getSession().createDurableSubscriber((Topic) dest, getConsumerName());
|
||||
} else {
|
||||
jmsConsumer = getSession().createConsumer(dest);
|
||||
}
|
||||
|
@ -166,7 +160,7 @@ public class JmsConsumerClient extends JmsPerformanceSupport {
|
|||
|
||||
public MessageConsumer createJmsConsumer(Destination dest, String selector, boolean noLocal) throws JMSException {
|
||||
if (isDurable()) {
|
||||
jmsConsumer = getSession().createDurableSubscriber((Topic)dest, getConsumerName(), selector, noLocal);
|
||||
jmsConsumer = getSession().createDurableSubscriber((Topic) dest, getConsumerName(), selector, noLocal);
|
||||
} else {
|
||||
jmsConsumer = getSession().createConsumer(dest, selector, noLocal);
|
||||
}
|
||||
|
@ -254,50 +248,21 @@ public class JmsConsumerClient extends JmsPerformanceSupport {
|
|||
}
|
||||
|
||||
public static void main(String[] args) throws JMSException {
|
||||
/*String[] options = new String[21];
|
||||
options[0] = "-Dsampler.duration=60000"; // 1 min
|
||||
options[1] = "-Dsampler.interval=5000"; // 5 secs
|
||||
options[2] = "-Dsampler.rampUpTime=10000"; // 10 secs
|
||||
options[3] = "-Dsampler.rampDownTime=10000"; // 10 secs
|
||||
|
||||
options[4] = "-Dclient.spiClass=org.apache.activemq.tool.spi.ActiveMQPojoSPI";
|
||||
options[5] = "-Dclient.sessTransacted=false";
|
||||
options[6] = "-Dclient.sessAckMode=autoAck";
|
||||
options[7] = "-Dclient.destName=topic://FOO.BAR.TEST";
|
||||
options[8] = "-Dclient.destCount=1";
|
||||
options[9] = "-Dclient.destComposite=false";
|
||||
|
||||
options[10] = "-Dconsumer.durable=false";
|
||||
options[11] = "-Dconsumer.asyncRecv=true";
|
||||
options[12] = "-Dconsumer.recvCount=1000"; // 1000 messages
|
||||
options[13] = "-Dconsumer.recvDuration=60000"; // 1 min
|
||||
options[14] = "-Dconsumer.recvType=time";
|
||||
|
||||
options[15] = "-Dfactory.brokerUrl=tcp://localhost:61616";
|
||||
options[16] = "-Dfactory.optimAck=true";
|
||||
options[17] = "-Dfactory.optimDispatch=true";
|
||||
options[18] = "-Dfactory.prefetchQueue=100";
|
||||
options[19] = "-Dfactory.prefetchTopic=32767";
|
||||
options[20] = "-Dfactory.useRetroactive=false";
|
||||
|
||||
args = options; */
|
||||
|
||||
Properties samplerSettings = new Properties();
|
||||
Properties samplerSettings = new Properties();
|
||||
Properties consumerSettings = new Properties();
|
||||
|
||||
for (int i=0; i<args.length; i++) {
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
// Get property define options only
|
||||
if (args[i].startsWith("-D")) {
|
||||
String propDefine = args[i].substring("-D".length());
|
||||
int index = propDefine.indexOf("=");
|
||||
String key = propDefine.substring(0, index);
|
||||
String val = propDefine.substring(index+1);
|
||||
if (key.startsWith("sampler.")) {
|
||||
samplerSettings.setProperty(key, val);
|
||||
} else {
|
||||
consumerSettings.setProperty(key, val);
|
||||
}
|
||||
int index = args[i].indexOf("=");
|
||||
String key = args[i].substring(0, index);
|
||||
String val = args[i].substring(index + 1);
|
||||
if (key.startsWith("sampler.")) {
|
||||
samplerSettings.setProperty(key, val);
|
||||
} else {
|
||||
consumerSettings.setProperty(key, val);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
JmsConsumerClient client = new JmsConsumerClient();
|
||||
|
|
|
@ -31,7 +31,7 @@ public class JmsConsumerSystem extends JmsClientSystemSupport {
|
|||
sampler.registerClient(consumer);
|
||||
consumer.setPerfEventListener(sampler);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
consumer.receiveMessages();
|
||||
} catch (JMSException e) {
|
||||
|
@ -52,49 +52,13 @@ public class JmsConsumerSystem extends JmsClientSystemSupport {
|
|||
}
|
||||
|
||||
public static void main(String[] args) throws JMSException {
|
||||
/*String[] options = new String[25];
|
||||
options[0] = "-Dsampler.duration=60000"; // 1 min
|
||||
options[1] = "-Dsampler.interval=5000"; // 5 secs
|
||||
options[2] = "-Dsampler.rampUpTime=10000"; // 10 secs
|
||||
options[3] = "-Dsampler.rampDownTime=10000"; // 10 secs
|
||||
|
||||
options[4] = "-Dclient.spiClass=org.apache.activemq.tool.spi.ActiveMQPojoSPI";
|
||||
options[5] = "-Dclient.sessTransacted=false";
|
||||
options[6] = "-Dclient.sessAckMode=autoAck";
|
||||
options[7] = "-Dclient.destName=topic://FOO.BAR.TEST";
|
||||
options[8] = "-Dclient.destCount=1";
|
||||
options[9] = "-Dclient.destComposite=false";
|
||||
|
||||
options[10] = "-Dconsumer.durable=false";
|
||||
options[11] = "-Dconsumer.asyncRecv=true";
|
||||
options[12] = "-Dconsumer.recvCount=1000"; // 1000 messages
|
||||
options[13] = "-Dconsumer.recvDuration=60000"; // 1 min
|
||||
options[14] = "-Dconsumer.recvType=time";
|
||||
|
||||
options[15] = "-Dfactory.brokerUrl=tcp://localhost:61616";
|
||||
options[16] = "-Dfactory.optimAck=true";
|
||||
options[17] = "-Dfactory.optimDispatch=true";
|
||||
options[18] = "-Dfactory.prefetchQueue=10";
|
||||
options[19] = "-Dfactory.prefetchTopic=10";
|
||||
options[20] = "-Dfactory.useRetroactive=false";
|
||||
|
||||
options[21] = "-DsysTest.numClients=5";
|
||||
options[22] = "-DsysTest.totalDests=5";
|
||||
options[23] = "-DsysTest.destDistro=all";
|
||||
options[24] = "-DsysTest.reportDirectory=./target/test-perf";
|
||||
|
||||
args = options;*/
|
||||
|
||||
Properties sysSettings = new Properties();
|
||||
for (int i=0; i<args.length; i++) {
|
||||
Properties sysSettings = new Properties();
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
// Get property define options only
|
||||
if (args[i].startsWith("-D")) {
|
||||
String propDefine = args[i].substring("-D".length());
|
||||
int index = propDefine.indexOf("=");
|
||||
String key = propDefine.substring(0, index);
|
||||
String val = propDefine.substring(index+1);
|
||||
sysSettings.setProperty(key, val);
|
||||
}
|
||||
int index = args[i].indexOf("=");
|
||||
String key = args[i].substring(0, index);
|
||||
String val = args[i].substring(index + 1);
|
||||
sysSettings.setProperty(key, val);
|
||||
}
|
||||
|
||||
JmsConsumerSystem sysTest = new JmsConsumerSystem();
|
||||
|
|
|
@ -19,28 +19,28 @@ package org.apache.activemq.tool;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import javax.jms.MessageProducer;
|
||||
import javax.jms.Destination;
|
||||
import javax.jms.TextMessage;
|
||||
import javax.jms.JMSException;
|
||||
import java.util.Properties;
|
||||
import javax.jms.MessageProducer;
|
||||
import javax.jms.TextMessage;
|
||||
import java.util.Arrays;
|
||||
import java.util.Properties;
|
||||
|
||||
public class JmsProducerClient extends JmsPerformanceSupport {
|
||||
private static final Log log = LogFactory.getLog(JmsProducerClient.class);
|
||||
|
||||
private static final String PREFIX_CONFIG_PRODUCER = "producer.";
|
||||
public static final String TIME_BASED_SENDING = "time";
|
||||
public static final String COUNT_BASED_SENDING = "count";
|
||||
public static final String TIME_BASED_SENDING = "time";
|
||||
public static final String COUNT_BASED_SENDING = "count";
|
||||
|
||||
protected Properties jmsProducerSettings = new Properties();
|
||||
protected Properties jmsProducerSettings = new Properties();
|
||||
protected MessageProducer jmsProducer;
|
||||
protected TextMessage jmsTextMessage;
|
||||
protected TextMessage jmsTextMessage;
|
||||
|
||||
protected int messageSize = 1024; // Send 1kb messages by default
|
||||
protected long sendCount = 1000000; // Send a million messages by default
|
||||
protected long sendDuration = 5 * 60 * 1000; // Send for 5 mins by default
|
||||
protected String sendType = TIME_BASED_SENDING;
|
||||
protected int messageSize = 1024; // Send 1kb messages by default
|
||||
protected long sendCount = 1000000; // Send a million messages by default
|
||||
protected long sendDuration = 5 * 60 * 1000; // Send for 5 mins by default
|
||||
protected String sendType = TIME_BASED_SENDING;
|
||||
|
||||
public void sendMessages() throws JMSException {
|
||||
if (listener != null) {
|
||||
|
@ -50,7 +50,7 @@ public class JmsProducerClient extends JmsPerformanceSupport {
|
|||
if (sendType.equalsIgnoreCase(COUNT_BASED_SENDING)) {
|
||||
sendCountBasedMessages(getSendCount());
|
||||
|
||||
// Send messages for a specific duration
|
||||
// Send messages for a specific duration
|
||||
} else {
|
||||
sendTimeBasedMessages(getSendDuration());
|
||||
}
|
||||
|
@ -78,36 +78,36 @@ public class JmsProducerClient extends JmsPerformanceSupport {
|
|||
if (getJmsTextMessage() != null) {
|
||||
// Send to more than one actual destination
|
||||
if (dest.length > 1) {
|
||||
for (int i=0; i<messageCount; i++) {
|
||||
for (int j=0; j<dest.length; j++) {
|
||||
for (int i = 0; i < messageCount; i++) {
|
||||
for (int j = 0; j < dest.length; j++) {
|
||||
getJmsProducer().send(dest[j], getJmsTextMessage());
|
||||
incThroughput();
|
||||
}
|
||||
}
|
||||
// Send to only one actual destination
|
||||
// Send to only one actual destination
|
||||
} else {
|
||||
for (int i=0; i<messageCount; i++) {
|
||||
for (int i = 0; i < messageCount; i++) {
|
||||
getJmsProducer().send(getJmsTextMessage());
|
||||
incThroughput();
|
||||
}
|
||||
}
|
||||
|
||||
// Send different type of messages using indexing to identify each one.
|
||||
// Message size will vary. Definitely slower, since messages properties
|
||||
// will be set individually each send.
|
||||
// Send different type of messages using indexing to identify each one.
|
||||
// Message size will vary. Definitely slower, since messages properties
|
||||
// will be set individually each send.
|
||||
} else {
|
||||
// Send to more than one actual destination
|
||||
if (dest.length > 1) {
|
||||
for (int i=0; i<messageCount; i++) {
|
||||
for (int j=0; j<dest.length; j++) {
|
||||
for (int i = 0; i < messageCount; i++) {
|
||||
for (int j = 0; j < dest.length; j++) {
|
||||
getJmsProducer().send(dest[j], createJmsTextMessage("Text Message [" + i + "]"));
|
||||
incThroughput();
|
||||
}
|
||||
}
|
||||
|
||||
// Send to only one actual destination
|
||||
// Send to only one actual destination
|
||||
} else {
|
||||
for (int i=0; i<messageCount; i++) {
|
||||
for (int i = 0; i < messageCount; i++) {
|
||||
getJmsProducer().send(createJmsTextMessage("Text Message [" + i + "]"));
|
||||
incThroughput();
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ public class JmsProducerClient extends JmsPerformanceSupport {
|
|||
}
|
||||
|
||||
public void sendTimeBasedMessages(long duration) throws JMSException {
|
||||
long endTime = System.currentTimeMillis() + duration;
|
||||
long endTime = System.currentTimeMillis() + duration;
|
||||
// Parse through different ways to send messages
|
||||
// Avoided putting the condition inside the loop to prevent effect on performance
|
||||
|
||||
|
@ -148,12 +148,12 @@ public class JmsProducerClient extends JmsPerformanceSupport {
|
|||
// Send to more than one actual destination
|
||||
if (dest.length > 1) {
|
||||
while (System.currentTimeMillis() < endTime) {
|
||||
for (int j=0; j<dest.length; j++) {
|
||||
for (int j = 0; j < dest.length; j++) {
|
||||
getJmsProducer().send(dest[j], getJmsTextMessage());
|
||||
incThroughput();
|
||||
}
|
||||
}
|
||||
// Send to only one actual destination
|
||||
// Send to only one actual destination
|
||||
} else {
|
||||
while (System.currentTimeMillis() < endTime) {
|
||||
getJmsProducer().send(getJmsTextMessage());
|
||||
|
@ -161,21 +161,21 @@ public class JmsProducerClient extends JmsPerformanceSupport {
|
|||
}
|
||||
}
|
||||
|
||||
// Send different type of messages using indexing to identify each one.
|
||||
// Message size will vary. Definitely slower, since messages properties
|
||||
// will be set individually each send.
|
||||
// Send different type of messages using indexing to identify each one.
|
||||
// Message size will vary. Definitely slower, since messages properties
|
||||
// will be set individually each send.
|
||||
} else {
|
||||
// Send to more than one actual destination
|
||||
long count = 1;
|
||||
if (dest.length > 1) {
|
||||
while (System.currentTimeMillis() < endTime) {
|
||||
for (int j=0; j<dest.length; j++) {
|
||||
for (int j = 0; j < dest.length; j++) {
|
||||
getJmsProducer().send(dest[j], createJmsTextMessage("Text Message [" + count++ + "]"));
|
||||
incThroughput();
|
||||
}
|
||||
}
|
||||
|
||||
// Send to only one actual destination
|
||||
// Send to only one actual destination
|
||||
} else {
|
||||
while (System.currentTimeMillis() < endTime) {
|
||||
|
||||
|
@ -235,7 +235,7 @@ public class JmsProducerClient extends JmsPerformanceSupport {
|
|||
|
||||
protected String buildText(String text, int size) {
|
||||
byte[] data = new byte[size - text.length()];
|
||||
Arrays.fill(data, (byte)0);
|
||||
Arrays.fill(data, (byte) 0);
|
||||
return text + new String(data);
|
||||
}
|
||||
|
||||
|
@ -291,45 +291,20 @@ public class JmsProducerClient extends JmsPerformanceSupport {
|
|||
}
|
||||
|
||||
public static void main(String[] args) throws JMSException {
|
||||
/*String[] options = new String[16];
|
||||
options[0] = "-Dsampler.duration=60000"; // 1 min
|
||||
options[1] = "-Dsampler.interval=5000"; // 5 secs
|
||||
options[2] = "-Dsampler.rampUpTime=10000"; // 10 secs
|
||||
options[3] = "-Dsampler.rampDownTime=10000"; // 10 secs
|
||||
|
||||
options[4] = "-Dclient.spiClass=org.apache.activemq.tool.spi.ActiveMQPojoSPI";
|
||||
options[5] = "-Dclient.sessTransacted=false";
|
||||
options[6] = "-Dclient.sessAckMode=autoAck";
|
||||
options[7] = "-Dclient.destName=topic://FOO.BAR.TEST";
|
||||
options[8] = "-Dclient.destCount=1";
|
||||
options[9] = "-Dclient.destComposite=false";
|
||||
|
||||
options[10] = "-Dproducer.messageSize=1024";
|
||||
options[11] = "-Dproducer.sendCount=1000"; // 1000 messages
|
||||
options[12] = "-Dproducer.sendDuration=60000"; // 1 min
|
||||
options[13] = "-Dproducer.sendType=time";
|
||||
|
||||
options[14] = "-Dfactory.brokerUrl=tcp://localhost:61616";
|
||||
options[15] = "-Dfactory.asyncSend=true";
|
||||
|
||||
args = options;*/
|
||||
|
||||
Properties samplerSettings = new Properties();
|
||||
Properties samplerSettings = new Properties();
|
||||
Properties producerSettings = new Properties();
|
||||
|
||||
for (int i=0; i<args.length; i++) {
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
// Get property define options only
|
||||
if (args[i].startsWith("-D")) {
|
||||
String propDefine = args[i].substring("-D".length());
|
||||
int index = propDefine.indexOf("=");
|
||||
String key = propDefine.substring(0, index);
|
||||
String val = propDefine.substring(index+1);
|
||||
if (key.startsWith("sampler.")) {
|
||||
samplerSettings.setProperty(key, val);
|
||||
} else {
|
||||
producerSettings.setProperty(key, val);
|
||||
}
|
||||
int index = args[i].indexOf("=");
|
||||
String key = args[i].substring(0, index);
|
||||
String val = args[i].substring(index + 1);
|
||||
if (key.startsWith("sampler.")) {
|
||||
samplerSettings.setProperty(key, val);
|
||||
} else {
|
||||
producerSettings.setProperty(key, val);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
JmsProducerClient client = new JmsProducerClient();
|
||||
|
|
|
@ -52,45 +52,14 @@ public class JmsProducerSystem extends JmsClientSystemSupport {
|
|||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
/*String[] options = new String[20];
|
||||
options[0] = "-Dsampler.duration=60000"; // 1 min
|
||||
options[1] = "-Dsampler.interval=5000"; // 5 secs
|
||||
options[2] = "-Dsampler.rampUpTime=10000"; // 10 secs
|
||||
options[3] = "-Dsampler.rampDownTime=10000"; // 10 secs
|
||||
Properties sysSettings = new Properties();
|
||||
|
||||
options[4] = "-Dclient.spiClass=org.apache.activemq.tool.spi.ActiveMQPojoSPI";
|
||||
options[5] = "-Dclient.sessTransacted=false";
|
||||
options[6] = "-Dclient.sessAckMode=autoAck";
|
||||
options[7] = "-Dclient.destName=topic://FOO.BAR.TEST";
|
||||
options[8] = "-Dclient.destCount=1";
|
||||
options[9] = "-Dclient.destComposite=false";
|
||||
|
||||
options[10] = "-Dproducer.messageSize=1024";
|
||||
options[11] = "-Dproducer.sendCount=1000"; // 1000 messages
|
||||
options[12] = "-Dproducer.sendDuration=60000"; // 1 min
|
||||
options[13] = "-Dproducer.sendType=time";
|
||||
|
||||
options[14] = "-Dfactory.brokerUrl=tcp://localhost:61616";
|
||||
options[15] = "-Dfactory.asyncSend=true";
|
||||
|
||||
options[16] = "-DsysTest.numClients=5";
|
||||
options[17] = "-DsysTest.totalDests=5";
|
||||
options[18] = "-DsysTest.destDistro=all";
|
||||
options[19] = "-DsysTest.reportDirectory=./target/test-perf";
|
||||
|
||||
args = options; */
|
||||
|
||||
Properties sysSettings = new Properties();
|
||||
|
||||
for (int i=0; i<args.length; i++) {
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
// Get property define options only
|
||||
if (args[i].startsWith("-D")) {
|
||||
String propDefine = args[i].substring("-D".length());
|
||||
int index = propDefine.indexOf("=");
|
||||
String key = propDefine.substring(0, index);
|
||||
String val = propDefine.substring(index+1);
|
||||
sysSettings.setProperty(key, val);
|
||||
}
|
||||
int index = args[i].indexOf("=");
|
||||
String key = args[i].substring(0, index);
|
||||
String val = args[i].substring(index + 1);
|
||||
sysSettings.setProperty(key, val);
|
||||
}
|
||||
|
||||
JmsProducerSystem sysTest = new JmsProducerSystem();
|
||||
|
|
Loading…
Reference in New Issue