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:
Frederick G. Oconer 2006-06-07 04:09:19 +00:00
parent 99b088dcd4
commit 4fb36fe50c
8 changed files with 131 additions and 266 deletions

View File

@ -19,7 +19,6 @@
<plugin> <plugin>
<groupId>incubator-activemq</groupId> <groupId>incubator-activemq</groupId>
<artifactId>maven-activemq-perf-plugin</artifactId> <artifactId>maven-activemq-perf-plugin</artifactId>
<version>4.1-SNAPSHOT</version>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -25,42 +25,34 @@
<dependency> <dependency>
<groupId>incubator-activemq</groupId> <groupId>incubator-activemq</groupId>
<artifactId>activemq-core</artifactId> <artifactId>activemq-core</artifactId>
<version>4.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>incubator-activemq</groupId> <groupId>incubator-activemq</groupId>
<artifactId>activemq-console</artifactId> <artifactId>activemq-console</artifactId>
<version>4.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>incubator-activemq</groupId> <groupId>incubator-activemq</groupId>
<artifactId>activeio-core</artifactId> <artifactId>activeio-core</artifactId>
<version>3.0-beta2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.derby</groupId> <groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId> <artifactId>derby</artifactId>
<version>10.1.1.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.derby</groupId> <groupId>org.apache.derby</groupId>
<artifactId>derbynet</artifactId> <artifactId>derbynet</artifactId>
<version>10.1.1.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>backport-util-concurrent</groupId> <groupId>backport-util-concurrent</groupId>
<artifactId>backport-util-concurrent</artifactId> <artifactId>backport-util-concurrent</artifactId>
<version>2.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.geronimo.specs</groupId> <groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_1.1_spec</artifactId> <artifactId>geronimo-jms_1.1_spec</artifactId>
<version>1.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.geronimo.specs</groupId> <groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-j2ee-management_1.0_spec</artifactId> <artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
<version>1.0</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -110,11 +110,12 @@ public class ConsumerMojo
*/ */
private String recvCount; private String recvCount;
/** /*
* @parameter expression="${consumer.recvDuration}" default-value="60000" * @parameter expression="${consumer.recvDuration}" default-value="60000"
* @required * @required
*/
private String recvDuration; private String recvDuration;
*/
/** /**
* @parameter expression="${consumer.recvType}" default-value="time" * @parameter expression="${consumer.recvType}" default-value="time"
@ -196,36 +197,35 @@ public class ConsumerMojo
public String[] createArgument() { public String[] createArgument() {
String[] options = new String[25]; String[] options = new String[25];
System.out.println("--- " + duration + " ----"); options[0] = "sampler.duration=" + duration; // 1 min
options[0] = "-Dsampler.duration=" + duration; // 1 min options[1] = "sampler.interval=" + interval; // 5 secs
options[1] = "-Dsampler.interval=" + interval; // 5 secs options[2] = "sampler.rampUpTime=" + rampUpTime; // 10 secs
options[2] = "-Dsampler.rampUpTime=" + rampUpTime; // 10 secs options[3] = "sampler.rampDownTime=" + rampDownTime; // 10 secs
options[3] = "-Dsampler.rampDownTime=" + rampDownTime; // 10 secs
options[4] = "-Dclient.spiClass=" + spiClass; options[4] = "client.spiClass=" + spiClass;
options[5] = "-Dclient.sessTransacted=" + sessTransacted; options[5] = "client.sessTransacted=" + sessTransacted;
options[6] = "-Dclient.sessAckMode=" + sessAckMode; options[6] = "client.sessAckMode=" + sessAckMode;
options[7] = "-Dclient.destName=" + destName; options[7] = "client.destName=" + destName;
options[8] = "-Dclient.destCount=" + destCount; options[8] = "client.destCount=" + destCount;
options[9] = "-Dclient.destComposite=" + destComposite; options[9] = "client.destComposite=" + destComposite;
options[10] = "-Dconsumer.durable=" + durable; options[10] = "consumer.durable=" + durable;
options[11] = "-Dconsumer.asyncRecv=" + asyncRecv; options[11] = "consumer.asyncRecv=" + asyncRecv;
options[12] = "-Dconsumer.recvCount=" + recvCount; // 1000 messages options[12] = "consumer.recvCount=" + recvCount; // 1000 messages
options[13] = "-Dconsumer.recvDuration=" + recvDuration; // 1 min options[13] = "consumer.recvDuration=" + duration; // use sampler.duration.
options[14] = "-Dconsumer.recvType=" + recvType; options[14] = "consumer.recvType=" + recvType;
options[15] = "-Dfactory.brokerUrl=" + brokerUrl; options[15] = "factory.brokerUrl=" + brokerUrl;
options[16] = "-Dfactory.optimAck=" + optimAck; options[16] = "factory.optimAck=" + optimAck;
options[17] = "-Dfactory.optimDispatch=" + optimDispatch; options[17] = "factory.optimDispatch=" + optimDispatch;
options[18] = "-Dfactory.prefetchQueue=" + prefetchQueue; options[18] = "factory.prefetchQueue=" + prefetchQueue;
options[19] = "-Dfactory.prefetchTopic=" + prefetchTopic; options[19] = "factory.prefetchTopic=" + prefetchTopic;
options[20] = "-Dfactory.useRetroactive=" + useRetroactive; options[20] = "factory.useRetroactive=" + useRetroactive;
options[21] = "-DsysTest.numClients=" + numClients; options[21] = "sysTest.numClients=" + numClients;
options[22] = "-DsysTest.totalDests=" + totalDests; options[22] = "sysTest.totalDests=" + totalDests;
options[23] = "-DsysTest.destDistro=" + destDistro; options[23] = "sysTest.destDistro=" + destDistro;
options[24] = "-DsysTest.reportDirectory=" + reportDirectory; options[24] = "sysTest.reportDirectory=" + reportDirectory;
return options; return options;
} }

View File

@ -102,11 +102,12 @@ public class ProducerMojo
*/ */
private String sendCount; private String sendCount;
/** /*
* @parameter expression="${producer.sendDuration}" default-value="60000" * @parameter expression="${producer.sendDuration}" default-value="60000"
* @required * @required
*/
private String sendDuration; private String sendDuration;
*/
/** /**
* @parameter expression="${producer.sendType}" default-value="time" * @parameter expression="${producer.sendType}" default-value="time"
@ -160,30 +161,30 @@ public class ProducerMojo
public String[] createArgument() { public String[] createArgument() {
String[] options = new String[20]; String[] options = new String[20];
options[0] = "-Dsampler.duration=" + duration; // 1 min options[0] = "sampler.duration=" + duration; // 1 min
options[1] = "-Dsampler.interval=" + interval; // 5 secs options[1] = "sampler.interval=" + interval; // 5 secs
options[2] = "-Dsampler.rampUpTime=" + rampUpTime; // 10 secs options[2] = "sampler.rampUpTime=" + rampUpTime; // 10 secs
options[3] = "-Dsampler.rampDownTime=" + rampDownTime; // 10 secs options[3] = "sampler.rampDownTime=" + rampDownTime; // 10 secs
options[4] = "-Dclient.spiClass=" + spiClass; options[4] = "client.spiClass=" + spiClass;
options[5] = "-Dclient.sessTransacted=" + sessTransacted; options[5] = "client.sessTransacted=" + sessTransacted;
options[6] = "-Dclient.sessAckMode=" + sessAckMode; options[6] = "client.sessAckMode=" + sessAckMode;
options[7] = "-Dclient.destName=" + destName; options[7] = "client.destName=" + destName;
options[8] = "-Dclient.destCount=" + destCount; options[8] = "client.destCount=" + destCount;
options[9] = "-Dclient.destComposite=" + destComposite; options[9] = "client.destComposite=" + destComposite;
options[10] = "-Dproducer.messageSize="+messageSize; options[10] = "producer.messageSize="+messageSize;
options[11] = "-Dproducer.sendCount="+sendCount; // 1000 messages options[11] = "producer.sendCount="+sendCount; // 1000 messages
options[12] = "-Dproducer.sendDuration="+sendDuration; // 1 min options[12] = "producer.sendDuration="+duration; // use sampler.duration.
options[13] = "-Dproducer.sendType="+sendType; options[13] = "producer.sendType="+sendType;
options[14] = "-Dfactory.brokerUrl="+brokerUrl; options[14] = "factory.brokerUrl="+brokerUrl;
options[15] = "-Dfactory.asyncSend="+asyncSend; options[15] = "factory.asyncSend="+asyncSend;
options[16] = "-DsysTest.numClients=" + numClients; options[16] = "sysTest.numClients=" + numClients;
options[17] = "-DsysTest.totalDests=" + totalDests; options[17] = "sysTest.totalDests=" + totalDests;
options[18] = "-DsysTest.destDistro=" + destDistro; options[18] = "sysTest.destDistro=" + destDistro;
options[19] = "-DsysTest.reportDirectory=" + reportDirectory; options[19] = "sysTest.reportDirectory=" + reportDirectory;
return options; return options;
} }

View File

@ -17,36 +17,30 @@
package org.apache.activemq.tool; 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 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 { public class JmsConsumerClient extends JmsPerformanceSupport {
private static final Log log = LogFactory.getLog(JmsConsumerClient.class); private static final Log log = LogFactory.getLog(JmsConsumerClient.class);
private static final String PREFIX_CONFIG_CONSUMER = "consumer."; private static final String PREFIX_CONFIG_CONSUMER = "consumer.";
public static final String TIME_BASED_RECEIVING = "time"; public static final String TIME_BASED_RECEIVING = "time";
public static final String COUNT_BASED_RECEIVING = "count"; public static final String COUNT_BASED_RECEIVING = "count";
protected Properties jmsConsumerSettings = new Properties(); protected Properties jmsConsumerSettings = new Properties();
protected MessageConsumer jmsConsumer; protected MessageConsumer jmsConsumer;
protected boolean durable = false; protected boolean durable = false;
protected boolean asyncRecv = true; protected boolean asyncRecv = true;
protected String consumerName = "TestConsumerClient"; protected String consumerName = "TestConsumerClient";
protected long recvCount = 1000000; // Receive a million messages by default protected long recvCount = 1000000; // Receive a million messages by default
protected long recvDuration = 5 * 60 * 1000; // Receive for 5 mins by default protected long recvDuration = 5 * 60 * 1000; // Receive for 5 mins by default
protected String recvType = TIME_BASED_RECEIVING; protected String recvType = TIME_BASED_RECEIVING;
public void receiveMessages() throws JMSException { public void receiveMessages() throws JMSException {
if (listener != null) { if (listener != null) {
@ -157,7 +151,7 @@ public class JmsConsumerClient extends JmsPerformanceSupport {
public MessageConsumer createJmsConsumer(Destination dest) throws JMSException { public MessageConsumer createJmsConsumer(Destination dest) throws JMSException {
if (isDurable()) { if (isDurable()) {
jmsConsumer = getSession().createDurableSubscriber((Topic)dest, getConsumerName()); jmsConsumer = getSession().createDurableSubscriber((Topic) dest, getConsumerName());
} else { } else {
jmsConsumer = getSession().createConsumer(dest); jmsConsumer = getSession().createConsumer(dest);
} }
@ -166,7 +160,7 @@ public class JmsConsumerClient extends JmsPerformanceSupport {
public MessageConsumer createJmsConsumer(Destination dest, String selector, boolean noLocal) throws JMSException { public MessageConsumer createJmsConsumer(Destination dest, String selector, boolean noLocal) throws JMSException {
if (isDurable()) { if (isDurable()) {
jmsConsumer = getSession().createDurableSubscriber((Topic)dest, getConsumerName(), selector, noLocal); jmsConsumer = getSession().createDurableSubscriber((Topic) dest, getConsumerName(), selector, noLocal);
} else { } else {
jmsConsumer = getSession().createConsumer(dest, selector, noLocal); jmsConsumer = getSession().createConsumer(dest, selector, noLocal);
} }
@ -254,50 +248,21 @@ public class JmsConsumerClient extends JmsPerformanceSupport {
} }
public static void main(String[] args) throws JMSException { 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"; Properties samplerSettings = new Properties();
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 consumerSettings = 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 // Get property define options only
if (args[i].startsWith("-D")) { int index = args[i].indexOf("=");
String propDefine = args[i].substring("-D".length()); String key = args[i].substring(0, index);
int index = propDefine.indexOf("="); String val = args[i].substring(index + 1);
String key = propDefine.substring(0, index); if (key.startsWith("sampler.")) {
String val = propDefine.substring(index+1); samplerSettings.setProperty(key, val);
if (key.startsWith("sampler.")) { } else {
samplerSettings.setProperty(key, val); consumerSettings.setProperty(key, val);
} else {
consumerSettings.setProperty(key, val);
}
} }
} }
JmsConsumerClient client = new JmsConsumerClient(); JmsConsumerClient client = new JmsConsumerClient();

View File

@ -31,7 +31,7 @@ public class JmsConsumerSystem extends JmsClientSystemSupport {
sampler.registerClient(consumer); sampler.registerClient(consumer);
consumer.setPerfEventListener(sampler); consumer.setPerfEventListener(sampler);
} }
try { try {
consumer.receiveMessages(); consumer.receiveMessages();
} catch (JMSException e) { } catch (JMSException e) {
@ -52,49 +52,13 @@ public class JmsConsumerSystem extends JmsClientSystemSupport {
} }
public static void main(String[] args) throws JMSException { public static void main(String[] args) throws JMSException {
/*String[] options = new String[25]; Properties sysSettings = new Properties();
options[0] = "-Dsampler.duration=60000"; // 1 min for (int i = 0; i < args.length; i++) {
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++) {
// Get property define options only // Get property define options only
if (args[i].startsWith("-D")) { int index = args[i].indexOf("=");
String propDefine = args[i].substring("-D".length()); String key = args[i].substring(0, index);
int index = propDefine.indexOf("="); String val = args[i].substring(index + 1);
String key = propDefine.substring(0, index); sysSettings.setProperty(key, val);
String val = propDefine.substring(index+1);
sysSettings.setProperty(key, val);
}
} }
JmsConsumerSystem sysTest = new JmsConsumerSystem(); JmsConsumerSystem sysTest = new JmsConsumerSystem();

View File

@ -19,28 +19,28 @@ package org.apache.activemq.tool;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import javax.jms.MessageProducer;
import javax.jms.Destination; import javax.jms.Destination;
import javax.jms.TextMessage;
import javax.jms.JMSException; import javax.jms.JMSException;
import java.util.Properties; import javax.jms.MessageProducer;
import javax.jms.TextMessage;
import java.util.Arrays; import java.util.Arrays;
import java.util.Properties;
public class JmsProducerClient extends JmsPerformanceSupport { public class JmsProducerClient extends JmsPerformanceSupport {
private static final Log log = LogFactory.getLog(JmsProducerClient.class); private static final Log log = LogFactory.getLog(JmsProducerClient.class);
private static final String PREFIX_CONFIG_PRODUCER = "producer."; private static final String PREFIX_CONFIG_PRODUCER = "producer.";
public static final String TIME_BASED_SENDING = "time"; public static final String TIME_BASED_SENDING = "time";
public static final String COUNT_BASED_SENDING = "count"; public static final String COUNT_BASED_SENDING = "count";
protected Properties jmsProducerSettings = new Properties(); protected Properties jmsProducerSettings = new Properties();
protected MessageProducer jmsProducer; protected MessageProducer jmsProducer;
protected TextMessage jmsTextMessage; protected TextMessage jmsTextMessage;
protected int messageSize = 1024; // Send 1kb messages by default protected int messageSize = 1024; // Send 1kb messages by default
protected long sendCount = 1000000; // Send a million 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 long sendDuration = 5 * 60 * 1000; // Send for 5 mins by default
protected String sendType = TIME_BASED_SENDING; protected String sendType = TIME_BASED_SENDING;
public void sendMessages() throws JMSException { public void sendMessages() throws JMSException {
if (listener != null) { if (listener != null) {
@ -50,7 +50,7 @@ public class JmsProducerClient extends JmsPerformanceSupport {
if (sendType.equalsIgnoreCase(COUNT_BASED_SENDING)) { if (sendType.equalsIgnoreCase(COUNT_BASED_SENDING)) {
sendCountBasedMessages(getSendCount()); sendCountBasedMessages(getSendCount());
// Send messages for a specific duration // Send messages for a specific duration
} else { } else {
sendTimeBasedMessages(getSendDuration()); sendTimeBasedMessages(getSendDuration());
} }
@ -78,36 +78,36 @@ public class JmsProducerClient extends JmsPerformanceSupport {
if (getJmsTextMessage() != null) { if (getJmsTextMessage() != null) {
// Send to more than one actual destination // Send to more than one actual destination
if (dest.length > 1) { if (dest.length > 1) {
for (int i=0; i<messageCount; i++) { for (int i = 0; i < messageCount; i++) {
for (int j=0; j<dest.length; j++) { for (int j = 0; j < dest.length; j++) {
getJmsProducer().send(dest[j], getJmsTextMessage()); getJmsProducer().send(dest[j], getJmsTextMessage());
incThroughput(); incThroughput();
} }
} }
// Send to only one actual destination // Send to only one actual destination
} else { } else {
for (int i=0; i<messageCount; i++) { for (int i = 0; i < messageCount; i++) {
getJmsProducer().send(getJmsTextMessage()); getJmsProducer().send(getJmsTextMessage());
incThroughput(); incThroughput();
} }
} }
// Send different type of messages using indexing to identify each one. // Send different type of messages using indexing to identify each one.
// Message size will vary. Definitely slower, since messages properties // Message size will vary. Definitely slower, since messages properties
// will be set individually each send. // will be set individually each send.
} else { } else {
// Send to more than one actual destination // Send to more than one actual destination
if (dest.length > 1) { if (dest.length > 1) {
for (int i=0; i<messageCount; i++) { for (int i = 0; i < messageCount; i++) {
for (int j=0; j<dest.length; j++) { for (int j = 0; j < dest.length; j++) {
getJmsProducer().send(dest[j], createJmsTextMessage("Text Message [" + i + "]")); getJmsProducer().send(dest[j], createJmsTextMessage("Text Message [" + i + "]"));
incThroughput(); incThroughput();
} }
} }
// Send to only one actual destination // Send to only one actual destination
} else { } else {
for (int i=0; i<messageCount; i++) { for (int i = 0; i < messageCount; i++) {
getJmsProducer().send(createJmsTextMessage("Text Message [" + i + "]")); getJmsProducer().send(createJmsTextMessage("Text Message [" + i + "]"));
incThroughput(); incThroughput();
} }
@ -122,7 +122,7 @@ public class JmsProducerClient extends JmsPerformanceSupport {
} }
public void sendTimeBasedMessages(long duration) throws JMSException { public void sendTimeBasedMessages(long duration) throws JMSException {
long endTime = System.currentTimeMillis() + duration; long endTime = System.currentTimeMillis() + duration;
// Parse through different ways to send messages // Parse through different ways to send messages
// Avoided putting the condition inside the loop to prevent effect on performance // 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 // Send to more than one actual destination
if (dest.length > 1) { if (dest.length > 1) {
while (System.currentTimeMillis() < endTime) { 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()); getJmsProducer().send(dest[j], getJmsTextMessage());
incThroughput(); incThroughput();
} }
} }
// Send to only one actual destination // Send to only one actual destination
} else { } else {
while (System.currentTimeMillis() < endTime) { while (System.currentTimeMillis() < endTime) {
getJmsProducer().send(getJmsTextMessage()); getJmsProducer().send(getJmsTextMessage());
@ -161,21 +161,21 @@ public class JmsProducerClient extends JmsPerformanceSupport {
} }
} }
// Send different type of messages using indexing to identify each one. // Send different type of messages using indexing to identify each one.
// Message size will vary. Definitely slower, since messages properties // Message size will vary. Definitely slower, since messages properties
// will be set individually each send. // will be set individually each send.
} else { } else {
// Send to more than one actual destination // Send to more than one actual destination
long count = 1; long count = 1;
if (dest.length > 1) { if (dest.length > 1) {
while (System.currentTimeMillis() < endTime) { 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++ + "]")); getJmsProducer().send(dest[j], createJmsTextMessage("Text Message [" + count++ + "]"));
incThroughput(); incThroughput();
} }
} }
// Send to only one actual destination // Send to only one actual destination
} else { } else {
while (System.currentTimeMillis() < endTime) { while (System.currentTimeMillis() < endTime) {
@ -235,7 +235,7 @@ public class JmsProducerClient extends JmsPerformanceSupport {
protected String buildText(String text, int size) { protected String buildText(String text, int size) {
byte[] data = new byte[size - text.length()]; byte[] data = new byte[size - text.length()];
Arrays.fill(data, (byte)0); Arrays.fill(data, (byte) 0);
return text + new String(data); return text + new String(data);
} }
@ -291,45 +291,20 @@ public class JmsProducerClient extends JmsPerformanceSupport {
} }
public static void main(String[] args) throws JMSException { public static void main(String[] args) throws JMSException {
/*String[] options = new String[16]; Properties samplerSettings = new Properties();
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 producerSettings = 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 // Get property define options only
if (args[i].startsWith("-D")) { int index = args[i].indexOf("=");
String propDefine = args[i].substring("-D".length()); String key = args[i].substring(0, index);
int index = propDefine.indexOf("="); String val = args[i].substring(index + 1);
String key = propDefine.substring(0, index); if (key.startsWith("sampler.")) {
String val = propDefine.substring(index+1); samplerSettings.setProperty(key, val);
if (key.startsWith("sampler.")) { } else {
samplerSettings.setProperty(key, val); producerSettings.setProperty(key, val);
} else {
producerSettings.setProperty(key, val);
}
} }
} }
JmsProducerClient client = new JmsProducerClient(); JmsProducerClient client = new JmsProducerClient();

View File

@ -52,45 +52,14 @@ public class JmsProducerSystem extends JmsClientSystemSupport {
} }
public static void main(String[] args) { public static void main(String[] args) {
/*String[] options = new String[20]; Properties sysSettings = new Properties();
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"; for (int i = 0; i < args.length; i++) {
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++) {
// Get property define options only // Get property define options only
if (args[i].startsWith("-D")) { int index = args[i].indexOf("=");
String propDefine = args[i].substring("-D".length()); String key = args[i].substring(0, index);
int index = propDefine.indexOf("="); String val = args[i].substring(index + 1);
String key = propDefine.substring(0, index); sysSettings.setProperty(key, val);
String val = propDefine.substring(index+1);
sysSettings.setProperty(key, val);
}
} }
JmsProducerSystem sysTest = new JmsProducerSystem(); JmsProducerSystem sysTest = new JmsProducerSystem();