[jboss-cvs] JBoss Messaging SVN: r7712 - in trunk/examples/soak/reconnect: server0 and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 12 05:59:16 EDT 2009
Author: jmesnil
Date: 2009-08-12 05:59:15 -0400 (Wed, 12 Aug 2009)
New Revision: 7712
Added:
trunk/examples/soak/reconnect/soak.properties
Removed:
trunk/examples/soak/reconnect/perf.properties
Modified:
trunk/examples/soak/reconnect/build.xml
trunk/examples/soak/reconnect/server0/jbm-configuration.xml
trunk/examples/soak/reconnect/server0/jbm-jms.xml
trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/ServerDump.java
trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakBase.java
trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakParams.java
trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakReconnectableReceiver.java
trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakReconnectableSender.java
Log:
JBMESSAGING-1589: Soak tests
* added parameter to restrain the duration of execution of sender & receivers
Modified: trunk/examples/soak/reconnect/build.xml
===================================================================
--- trunk/examples/soak/reconnect/build.xml 2009-08-12 07:20:09 UTC (rev 7711)
+++ trunk/examples/soak/reconnect/build.xml 2009-08-12 09:59:15 UTC (rev 7712)
@@ -39,8 +39,6 @@
</fileset>
</path>
- <property name="perf.properties.file.name" value="perf.properties" />
-
<path id="the.classpath">
<path refid="client.classpath" />
<path location="." />
@@ -58,7 +56,6 @@
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/>
-->
<jvmarg value="-Djava.util.logging.config.file=${config.dir}/logging.properties" />
- <arg line="${perf.properties.file.name}" />
<classpath refid="the.classpath" />
</java>
</target>
@@ -75,7 +72,6 @@
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/>
-->
<jvmarg value="-Djava.util.logging.config.file=${config.dir}/logging.properties" />
- <arg line="${perf.properties.file.name}" />
<classpath refid="the.classpath" />
</java>
</target>
Deleted: trunk/examples/soak/reconnect/perf.properties
===================================================================
--- trunk/examples/soak/reconnect/perf.properties 2009-08-12 07:20:09 UTC (rev 7711)
+++ trunk/examples/soak/reconnect/perf.properties 2009-08-12 09:59:15 UTC (rev 7712)
@@ -1,13 +0,0 @@
-num-messages=200
-num-warmup-messages=100
-message-size=1024
-durable=true
-transacted=false
-batch-size=1000
-drain-queue=false
-destination-lookup=perfQueue
-connection-factory-lookup=/ConnectionFactory
-throttle-rate=-1
-dups-ok-acknowledge=false
-disable-message-id=true
-disable-message-timestamp=true
Modified: trunk/examples/soak/reconnect/server0/jbm-configuration.xml
===================================================================
--- trunk/examples/soak/reconnect/server0/jbm-configuration.xml 2009-08-12 07:20:09 UTC (rev 7711)
+++ trunk/examples/soak/reconnect/server0/jbm-configuration.xml 2009-08-12 09:59:15 UTC (rev 7712)
@@ -28,8 +28,8 @@
<persistence-enabled>true</persistence-enabled>
<queues>
- <queue name="perfQueue">
- <address>perfAddress</address>
+ <queue name="soakQueue">
+ <address>soakAddress</address>
</queue>
</queues>
Modified: trunk/examples/soak/reconnect/server0/jbm-jms.xml
===================================================================
--- trunk/examples/soak/reconnect/server0/jbm-jms.xml 2009-08-12 07:20:09 UTC (rev 7711)
+++ trunk/examples/soak/reconnect/server0/jbm-jms.xml 2009-08-12 09:59:15 UTC (rev 7712)
@@ -16,8 +16,8 @@
<block-on-persistent-send>true</block-on-persistent-send>
</connection-factory>
- <queue name="perfQueue">
- <entry name="perfQueue"/>
+ <queue name="soakQueue">
+ <entry name="soakQueue"/>
</queue>
</configuration>
Copied: trunk/examples/soak/reconnect/soak.properties (from rev 7707, trunk/examples/soak/reconnect/perf.properties)
===================================================================
--- trunk/examples/soak/reconnect/soak.properties (rev 0)
+++ trunk/examples/soak/reconnect/soak.properties 2009-08-12 09:59:15 UTC (rev 7712)
@@ -0,0 +1,13 @@
+duration-in-minutes=2
+num-warmup-messages=100
+message-size=1024
+durable=true
+transacted=false
+batch-size=1000
+drain-queue=false
+destination-lookup=soakQueue
+connection-factory-lookup=/ConnectionFactory
+throttle-rate=-1
+dups-ok-acknowledge=false
+disable-message-id=true
+disable-message-timestamp=true
Modified: trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/ServerDump.java
===================================================================
--- trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/ServerDump.java 2009-08-12 07:20:09 UTC (rev 7711)
+++ trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/ServerDump.java 2009-08-12 09:59:15 UTC (rev 7712)
@@ -61,9 +61,9 @@
// Constructors --------------------------------------------------
- public ServerDump(int dumpIntervalInHours)
+ public ServerDump(int dumpIntervalInMinutes)
{
- this.dumpIntervalInMinutes = dumpIntervalInHours;
+ this.dumpIntervalInMinutes = dumpIntervalInMinutes;
timer = new Timer(true);
task = new TimerTask()
{
Modified: trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakBase.java
===================================================================
--- trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakBase.java 2009-08-12 07:20:09 UTC (rev 7711)
+++ trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakBase.java 2009-08-12 09:59:15 UTC (rev 7712)
@@ -40,8 +40,10 @@
{
private static final Logger log = Logger.getLogger(SoakBase.class.getName());
- private static final String DEFAULT_PERF_PROPERTIES_FILE_NAME = "perf.properties";
+ private static final String DEFAULT_SOAK_PROPERTIES_FILE_NAME = "soak.properties";
+ public static final int TO_MILLIS = 60 * 1000; // from minute to milliseconds
+
public static byte[] randomByteArray(final int length)
{
byte[] bytes = new byte[length];
@@ -66,7 +68,7 @@
}
else
{
- fileName = DEFAULT_PERF_PROPERTIES_FILE_NAME;
+ fileName = DEFAULT_SOAK_PROPERTIES_FILE_NAME;
}
return fileName;
@@ -94,7 +96,7 @@
}
}
- int noOfMessages = Integer.valueOf(props.getProperty("num-messages"));
+ int durationInMinutes = Integer.valueOf(props.getProperty("duration-in-minutes"));
int noOfWarmupMessages = Integer.valueOf(props.getProperty("num-warmup-messages"));
int messageSize = Integer.valueOf(props.getProperty("message-size"));
boolean durable = Boolean.valueOf(props.getProperty("durable"));
@@ -108,7 +110,7 @@
boolean disableMessageID = Boolean.valueOf(props.getProperty("disable-message-id"));
boolean disableTimestamp = Boolean.valueOf(props.getProperty("disable-message-timestamp"));
- log.info("num-messages: " + noOfMessages);
+ log.info("duration-in-minutes: " + durationInMinutes);
log.info("num-warmup-messages: " + noOfWarmupMessages);
log.info("message-size: " + messageSize);
log.info("durable: " + durable);
@@ -122,21 +124,21 @@
log.info("disable-message-timestamp: " + disableTimestamp);
log.info("dups-ok-acknowledge: " + dupsOK);
- SoakParams perfParams = new SoakParams();
- perfParams.setNoOfMessagesToSend(noOfMessages);
- perfParams.setNoOfWarmupMessages(noOfWarmupMessages);
- perfParams.setMessageSize(messageSize);
- perfParams.setDurable(durable);
- perfParams.setSessionTransacted(transacted);
- perfParams.setBatchSize(batchSize);
- perfParams.setDrainQueue(drainQueue);
- perfParams.setConnectionFactoryLookup(connectionFactoryLookup);
- perfParams.setDestinationLookup(destinationLookup);
- perfParams.setThrottleRate(throttleRate);
- perfParams.setDisableMessageID(disableMessageID);
- perfParams.setDisableTimestamp(disableTimestamp);
- perfParams.setDupsOK(dupsOK);
+ SoakParams soakParams = new SoakParams();
+ soakParams.setDurationInMinutes(durationInMinutes);
+ soakParams.setNoOfWarmupMessages(noOfWarmupMessages);
+ soakParams.setMessageSize(messageSize);
+ soakParams.setDurable(durable);
+ soakParams.setSessionTransacted(transacted);
+ soakParams.setBatchSize(batchSize);
+ soakParams.setDrainQueue(drainQueue);
+ soakParams.setConnectionFactoryLookup(connectionFactoryLookup);
+ soakParams.setDestinationLookup(destinationLookup);
+ soakParams.setThrottleRate(throttleRate);
+ soakParams.setDisableMessageID(disableMessageID);
+ soakParams.setDisableTimestamp(disableTimestamp);
+ soakParams.setDupsOK(dupsOK);
- return perfParams;
+ return soakParams;
}
}
Modified: trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakParams.java
===================================================================
--- trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakParams.java 2009-08-12 07:20:09 UTC (rev 7711)
+++ trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakParams.java 2009-08-12 09:59:15 UTC (rev 7712)
@@ -33,7 +33,7 @@
{
private static final long serialVersionUID = -4336539641012356002L;
- private int noOfMessagesToSend = 1000;
+ private int durationInMinutes = 60;
private int noOfWarmupMessages;
private int messageSize = 1024; // in bytes
private boolean durable = false;
@@ -47,13 +47,13 @@
private boolean disableTimestamp;
private boolean dupsOK;
- public synchronized int getNoOfMessagesToSend()
+ public synchronized int getDurationInMinutes()
{
- return noOfMessagesToSend;
+ return durationInMinutes;
}
- public synchronized void setNoOfMessagesToSend(int noOfMessagesToSend)
+ public synchronized void setDurationInMinutes(int durationInMinutes)
{
- this.noOfMessagesToSend = noOfMessagesToSend;
+ this.durationInMinutes = durationInMinutes;
}
public synchronized int getNoOfWarmupMessages()
{
Modified: trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakReconnectableReceiver.java
===================================================================
--- trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakReconnectableReceiver.java 2009-08-12 07:20:09 UTC (rev 7711)
+++ trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakReconnectableReceiver.java 2009-08-12 09:59:15 UTC (rev 7712)
@@ -21,6 +21,7 @@
*/
package org.jboss.jms.soak.example.reconnect;
+import java.util.UUID;
import java.util.concurrent.atomic.AtomicLong;
import java.util.logging.Logger;
@@ -40,6 +41,8 @@
{
private static final Logger log = Logger.getLogger(SoakReconnectableReceiver.class.getName());
+ private static final String EOF = UUID.randomUUID().toString();
+
public static void main(String[] args)
{
try
@@ -89,18 +92,37 @@
private final AtomicLong count = new AtomicLong(0);
private long start = System.currentTimeMillis();
+ long moduloStart = start;
public void onMessage(Message msg)
{
+ long totalDuration = System.currentTimeMillis() - start;
+
+ try
+ {
+ if (EOF.equals(msg.getStringProperty("eof")))
+ {
+ log.info(String.format("Received %s messages in %.2f minutes", count, (1.0 * totalDuration) / SoakBase.TO_MILLIS));
+ log.info("END OF RUN");
+
+ return;
+ }
+ }
+ catch (JMSException e1)
+ {
+ e1.printStackTrace();
+ }
if (count.incrementAndGet() % modulo == 0)
{
- double duration = (1.0 * System.currentTimeMillis() - start) / 1000;
- start = System.currentTimeMillis();
- log.info(String.format("received %s messages in %2.2fs", modulo, duration));
+ double duration = (1.0 * System.currentTimeMillis() - moduloStart) / 1000;
+ moduloStart = System.currentTimeMillis();
+ log.info(String.format("received %s messages in %2.2fs (total: %.0fs)", modulo, duration, totalDuration / 1000.0));
}
}
};
+ private Session session;
+
private SoakReconnectableReceiver(final SoakParams perfParams)
{
this.perfParams = perfParams;
@@ -110,9 +132,28 @@
{
connect();
- while (true)
+ boolean runInfinitely = (perfParams.getDurationInMinutes() == -1);
+
+ if (!runInfinitely)
{
- Thread.sleep(500);
+ Thread.sleep(perfParams.getDurationInMinutes() * SoakBase.TO_MILLIS);
+
+ // send EOF message
+ Message eof = session.createMessage();
+ eof.setStringProperty("eof", EOF);
+ listener.onMessage(eof);
+
+ if (connection != null)
+ {
+ connection.close();
+ connection = null;
+ }
+ } else
+ {
+ while (true)
+ {
+ Thread.sleep(500);
+ }
}
}
@@ -150,7 +191,7 @@
connection = factory.createConnection();
connection.setExceptionListener(exceptionListener);
- Session session = connection.createSession(perfParams.isSessionTransacted(),
+ session = connection.createSession(perfParams.isSessionTransacted(),
perfParams.isDupsOK() ? Session.DUPS_OK_ACKNOWLEDGE
: Session.AUTO_ACKNOWLEDGE);
Modified: trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakReconnectableSender.java
===================================================================
--- trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakReconnectableSender.java 2009-08-12 07:20:09 UTC (rev 7711)
+++ trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/SoakReconnectableSender.java 2009-08-12 09:59:15 UTC (rev 7712)
@@ -43,6 +43,7 @@
{
private static final Logger log = Logger.getLogger(SoakReconnectableSender.class.getName());
+
public static void main(String[] args)
{
try
@@ -98,9 +99,10 @@
public void run() throws Exception
{
- System.out.println("SoakReconnectableSender.run()");
connect();
+ boolean runInfinitely = (perfParams.getDurationInMinutes() == -1);
+
BytesMessage message = session.createBytesMessage();
byte[] payload = SoakBase.randomByteArray(perfParams.getMessageSize());
@@ -118,42 +120,57 @@
boolean display = true;
long start = System.currentTimeMillis();
+ long moduleStart = start;
AtomicLong count = new AtomicLong(0);
while (true)
{
try
{
- while (true)
+ producer.send(message);
+ count.incrementAndGet();
+
+ if (transacted)
{
- producer.send(message);
- count.incrementAndGet();
-
- if (transacted)
+ if (count.longValue() % txBatchSize == 0)
{
- if (count.longValue() % txBatchSize == 0)
- {
- session.commit();
- }
+ session.commit();
}
+ }
- if (display && (count.longValue() % modulo == 0))
- {
- double duration = (1.0 * System.currentTimeMillis() - start) / 1000;
- start = System.currentTimeMillis();
- log.info(String.format("sent %s messages in %2.2fs", modulo, duration));
- }
+ long totalDuration = System.currentTimeMillis() - start;
- if (tbl != null)
- {
- tbl.limit();
- }
+ if (display && (count.longValue() % modulo == 0))
+ {
+ double duration = (1.0 * System.currentTimeMillis() - moduleStart) / 1000;
+ moduleStart = System.currentTimeMillis();
+ log.info(String.format("sent %s messages in %2.2fs (time: %.0fs)", modulo, duration, totalDuration / 1000.0));
}
+
+ if (tbl != null)
+ {
+ tbl.limit();
+ }
+
+ if (!runInfinitely && totalDuration > perfParams.getDurationInMinutes() * SoakBase.TO_MILLIS)
+ {
+ break;
+ }
}
catch (Exception e)
{
e.printStackTrace();
}
}
+
+ log.info(String.format("Sent %s messages in %s minutes", count, perfParams.getDurationInMinutes()));
+ log.info("END OF RUN");
+
+
+ if (connection != null)
+ {
+ connection.close();
+ connection = null;
+ }
}
private synchronized void disconnect()
More information about the jboss-cvs-commits
mailing list