activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1376934 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/store/jdbc/adapter/ test/java/org/apache/activemq/usecases/
Date Fri, 24 Aug 2012 14:21:23 GMT
Author: gtully
Date: Fri Aug 24 14:21:22 2012
New Revision: 1376934

URL: http://svn.apache.org/viewvc?rev=1376934&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3557 - Performance of consumption with JDBC persistance
and Microsoft SQL Server. Fix up default value for maxRows to allign with default page size.
Use a large maxPageSize via destination policy for durable subs that have sparse selectors.
Same as queues with sparse selectors

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ConcurrentProducerDurableConsumerTest.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionSelectorTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java?rev=1376934&r1=1376933&r2=1376934&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java
Fri Aug 24 14:21:22 2012
@@ -28,6 +28,7 @@ import java.util.Set;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
+import org.apache.activemq.broker.region.BaseDestination;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.MessageId;
 import org.apache.activemq.command.ProducerId;
@@ -59,7 +60,7 @@ import org.slf4j.LoggerFactory;
  */
 public class DefaultJDBCAdapter implements JDBCAdapter {
     private static final Logger LOG = LoggerFactory.getLogger(DefaultJDBCAdapter.class);
-    public static final int MAX_ROWS = 10000;
+    public static final int MAX_ROWS = BaseDestination.MAX_PAGE_SIZE;
     protected Statements statements;
     protected boolean batchStatments = true;
     protected boolean prioritizedMessages;

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ConcurrentProducerDurableConsumerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ConcurrentProducerDurableConsumerTest.java?rev=1376934&r1=1376933&r2=1376934&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ConcurrentProducerDurableConsumerTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ConcurrentProducerDurableConsumerTest.java
Fri Aug 24 14:21:22 2012
@@ -414,7 +414,9 @@ public class ConcurrentProducerDurableCo
                 priority = message.getJMSPriority();
             } catch (JMSException ignored) {}
             if (!messageLists.containsKey(priority)) {
-                messageLists.put(priority, new MessageIdList());
+                MessageIdList perPriorityList =  new MessageIdList();
+                perPriorityList.setParent(allMessagesList);
+                messageLists.put(priority, perPriorityList);
             }
             messageLists.get(priority).onMessage(message);
             if (count.incrementAndGet() == 1) {

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionSelectorTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionSelectorTest.java?rev=1376934&r1=1376933&r2=1376934&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionSelectorTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionSelectorTest.java
Fri Aug 24 14:21:22 2012
@@ -31,6 +31,8 @@ import junit.framework.Test;
 import org.apache.activemq.ActiveMQConnection;
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.region.policy.PolicyEntry;
+import org.apache.activemq.broker.region.policy.PolicyMap;
 import org.apache.activemq.command.ActiveMQTopic;
 import org.apache.activemq.store.PersistenceAdapter;
 import org.apache.activemq.store.jdbc.JDBCPersistenceAdapter;
@@ -144,9 +146,17 @@ public class DurableSubscriptionSelector
         }
         setDefaultPersistenceAdapter(broker);
 
+        /* use maxPageSize policy in place of always pulling from the broker in maxRows chunks
         if (broker.getPersistenceAdapter() instanceof JDBCPersistenceAdapter) {
-            ((JDBCPersistenceAdapter)broker.getPersistenceAdapter()).setMaxRows(5000);  
 
-        }
+            ((JDBCPersistenceAdapter)broker.getPersistenceAdapter()).setMaxRows(5000);
+        }*/
+
+        PolicyMap policyMap = new PolicyMap();
+        PolicyEntry defaultEntry = new PolicyEntry();
+        defaultEntry.setMaxPageSize(5000);
+        policyMap.setDefaultEntry(defaultEntry);
+        broker.setDestinationPolicy(policyMap);
+
         broker.start();
     }
 



Mime
View raw message