activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r687033 - in /activemq/trunk/activemq-camel-loadtest/src/test: java/org/apache/activemq/soaktest/localBroker/ resources/org/apache/activemq/soaktest/localBroker/
Date Tue, 19 Aug 2008 12:05:46 GMT
Author: jstrachan
Date: Tue Aug 19 05:05:45 2008
New Revision: 687033

URL: http://svn.apache.org/viewvc?rev=687033&view=rev
Log:
added a local broker load test

Added:
    activemq/trunk/activemq-camel-loadtest/src/test/java/org/apache/activemq/soaktest/localBroker/CounterBean.java
  (with props)
    activemq/trunk/activemq-camel-loadtest/src/test/java/org/apache/activemq/soaktest/localBroker/LocalBrokerConsumeTest.java
      - copied, changed from r644706, activemq/trunk/activemq-camel-loadtest/src/test/java/org/apache/activemq/soaktest/localBroker/LocalBrokerParallelProducerLoadTest.java
    activemq/trunk/activemq-camel-loadtest/src/test/resources/org/apache/activemq/soaktest/localBroker/LocalBrokerConsumeTest-context.xml
      - copied, changed from r644706, activemq/trunk/activemq-camel-loadtest/src/test/resources/org/apache/activemq/soaktest/localBroker/LocalBrokerParallelProducerLoadTest-context.xml
Modified:
    activemq/trunk/activemq-camel-loadtest/src/test/resources/org/apache/activemq/soaktest/localBroker/LocalBrokerParallelProducerLoadTest-context.xml

Added: activemq/trunk/activemq-camel-loadtest/src/test/java/org/apache/activemq/soaktest/localBroker/CounterBean.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-camel-loadtest/src/test/java/org/apache/activemq/soaktest/localBroker/CounterBean.java?rev=687033&view=auto
==============================================================================
--- activemq/trunk/activemq-camel-loadtest/src/test/java/org/apache/activemq/soaktest/localBroker/CounterBean.java
(added)
+++ activemq/trunk/activemq-camel-loadtest/src/test/java/org/apache/activemq/soaktest/localBroker/CounterBean.java
Tue Aug 19 05:05:45 2008
@@ -0,0 +1,63 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.soaktest.localBroker;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.factory.InitializingBean;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class CounterBean implements InitializingBean, Processor {
+    private static final transient Log LOG = LogFactory.getLog(CounterBean.class);
+    protected static final long SAMPLES = Integer.parseInt(System.getProperty("SAMPLES",
"" + 10000));
+    protected static final long SAMPLE_DURATION = Integer.parseInt(System.getProperty("SAMPLES_DURATION",
"" + 1000 * 5));
+    final AtomicLong counter = new AtomicLong();
+
+    public void process(Exchange exchange) throws Exception {
+        counter.incrementAndGet();
+    }
+
+    public void afterPropertiesSet() throws Exception {
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                LOG.info("Starting to monitor consumption");
+
+                for (int i = 0; i < SAMPLES; i++) {
+                    try {
+                        Thread.sleep(SAMPLE_DURATION);
+                    }
+                    catch (InterruptedException e) {
+                        LOG.warn("Caught: " + e, e);
+                    }
+
+                    long count = counter.getAndSet(0);
+                    LOG.info("   Total: " + (1000.0 * count / SAMPLE_DURATION) + " messages
per second.");
+                }
+            }
+        };
+        thread.setDaemon(false);
+        thread.start();
+    }
+}

Propchange: activemq/trunk/activemq-camel-loadtest/src/test/java/org/apache/activemq/soaktest/localBroker/CounterBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: activemq/trunk/activemq-camel-loadtest/src/test/java/org/apache/activemq/soaktest/localBroker/LocalBrokerConsumeTest.java
(from r644706, activemq/trunk/activemq-camel-loadtest/src/test/java/org/apache/activemq/soaktest/localBroker/LocalBrokerParallelProducerLoadTest.java)
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-camel-loadtest/src/test/java/org/apache/activemq/soaktest/localBroker/LocalBrokerConsumeTest.java?p2=activemq/trunk/activemq-camel-loadtest/src/test/java/org/apache/activemq/soaktest/localBroker/LocalBrokerConsumeTest.java&p1=activemq/trunk/activemq-camel-loadtest/src/test/java/org/apache/activemq/soaktest/localBroker/LocalBrokerParallelProducerLoadTest.java&r1=644706&r2=687033&rev=687033&view=diff
==============================================================================
--- activemq/trunk/activemq-camel-loadtest/src/test/java/org/apache/activemq/soaktest/localBroker/LocalBrokerParallelProducerLoadTest.java
(original)
+++ activemq/trunk/activemq-camel-loadtest/src/test/java/org/apache/activemq/soaktest/localBroker/LocalBrokerConsumeTest.java
Tue Aug 19 05:05:45 2008
@@ -29,11 +29,12 @@
  * @version $Revision: 1.1 $
  */
 @ContextConfiguration
-public class LocalBrokerParallelProducerLoadTest extends AbstractJUnit38SpringContextTests
{
+public class LocalBrokerConsumeTest extends AbstractJUnit38SpringContextTests {
     @Autowired
     protected CamelContext camelContext;
 
     public void testRun() throws Exception {
-        MockEndpoint.assertIsSatisfied(camelContext);
+        Thread.sleep(100000);
+        //MockEndpoint.assertIsSatisfied(camelContext);
     }
 }
\ No newline at end of file

Copied: activemq/trunk/activemq-camel-loadtest/src/test/resources/org/apache/activemq/soaktest/localBroker/LocalBrokerConsumeTest-context.xml
(from r644706, activemq/trunk/activemq-camel-loadtest/src/test/resources/org/apache/activemq/soaktest/localBroker/LocalBrokerParallelProducerLoadTest-context.xml)
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-camel-loadtest/src/test/resources/org/apache/activemq/soaktest/localBroker/LocalBrokerConsumeTest-context.xml?p2=activemq/trunk/activemq-camel-loadtest/src/test/resources/org/apache/activemq/soaktest/localBroker/LocalBrokerConsumeTest-context.xml&p1=activemq/trunk/activemq-camel-loadtest/src/test/resources/org/apache/activemq/soaktest/localBroker/LocalBrokerParallelProducerLoadTest-context.xml&r1=644706&r2=687033&rev=687033&view=diff
==============================================================================
--- activemq/trunk/activemq-camel-loadtest/src/test/resources/org/apache/activemq/soaktest/localBroker/LocalBrokerParallelProducerLoadTest-context.xml
(original)
+++ activemq/trunk/activemq-camel-loadtest/src/test/resources/org/apache/activemq/soaktest/localBroker/LocalBrokerConsumeTest-context.xml
Tue Aug 19 05:05:45 2008
@@ -27,30 +27,21 @@
   <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
 
     <route>
-      <from uri="dataset:myDataSet?preloadSize=50000"/>
-
-      <to uri="activemq:foo.example.A"/>
-
-      <!-- lets use concurrency -->
-<!--
-      <thread coreSize="10" maxSize="20">
-      </thread>
--->
-    </route>
-
-    <route>
-      <from uri="activemq:foo.example.A?concurrentConsumers=5"/>
-      <to uri="mock:results?expectedMessageCount=100000&amp;reportGroup=5000&amp;resultWaitTime=400000"/>
+      <from uri="activemq:TEST?concurrentConsumers=1"/>
+      <process ref="counter"/>
+      <!--<to uri="mock:results?expectedMessageCount=100000&amp;reportGroup=5000&amp;resultWaitTime=400000"/>-->
     </route>
 
   </camelContext>
 
-  <bean id="myDataSet" class="org.apache.camel.component.dataset.SimpleDataSet">
-    <property name="size" value="100000"/>
-    <property name="reportCount" value="5000"/>
-  </bean>
-
+  <bean id="counter" class="org.apache.activemq.soaktest.localBroker.CounterBean"/>
+  
   <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
+    <property name="brokerURL" value="tcp://localhost:61616"/>
+    <property name="usePooledConnection" value="false"/>
+    <property name="useSingleConnection" value="false"/>
+    <property name="acknowledgementModeName" value="AUTO_ACKNOWLEDGE"/>
+    <property name="transacted" value="false"/>
   </bean>
 </beans>
 <!-- END SNIPPET: example -->

Modified: activemq/trunk/activemq-camel-loadtest/src/test/resources/org/apache/activemq/soaktest/localBroker/LocalBrokerParallelProducerLoadTest-context.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-camel-loadtest/src/test/resources/org/apache/activemq/soaktest/localBroker/LocalBrokerParallelProducerLoadTest-context.xml?rev=687033&r1=687032&r2=687033&view=diff
==============================================================================
--- activemq/trunk/activemq-camel-loadtest/src/test/resources/org/apache/activemq/soaktest/localBroker/LocalBrokerParallelProducerLoadTest-context.xml
(original)
+++ activemq/trunk/activemq-camel-loadtest/src/test/resources/org/apache/activemq/soaktest/localBroker/LocalBrokerParallelProducerLoadTest-context.xml
Tue Aug 19 05:05:45 2008
@@ -30,16 +30,17 @@
       <from uri="dataset:myDataSet?preloadSize=50000"/>
 
       <to uri="activemq:foo.example.A"/>
-
       <!-- lets use concurrency -->
 <!--
+      <to uri="activemq:foo.example.A"/>
       <thread coreSize="10" maxSize="20">
       </thread>
 -->
+
     </route>
 
     <route>
-      <from uri="activemq:foo.example.A?concurrentConsumers=5"/>
+      <from uri="activemq:foo.example.A?concurrentConsumers=20"/>
       <to uri="mock:results?expectedMessageCount=100000&amp;reportGroup=5000&amp;resultWaitTime=400000"/>
     </route>
 
@@ -51,6 +52,14 @@
   </bean>
 
   <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
+    <!--<property name="brokerURL" value="tcp://localhost:61616?wireFormat.tightEncodingEnabled=false"/>-->
+    <property name="brokerURL" value="tcp://localhost:61616?wireFormat.tightEncodingEnabled=false&amp;jms.dispatchAsync=true"/>
+    <property name="deliveryPersistent" value="false"/>
+    <property name="acknowledgementModeName" value="DUPS_OK_ACKNOWLEDGE"/>
+    <!--<property name="transacted" value="true"/>-->
+    <property name="transacted" value="true"/>
+<!--
+-->
   </bean>
 </beans>
 <!-- END SNIPPET: example -->



Mime
View raw message