One more thing to look at would be the connection pool size.  In the first 
case, you have 100 concurrent consumers fighting over 8 connections.  In the 
second case, you only have 30 concurrent consumers fighting over the same 8 
connections.

Also, look at the Javadoc for the PooledConnectionFactory ( 
http://activemq.apache.org/maven/apidocs/org/apache/activemq/jms/pool/PooledConnectionFactory.html
 
<http://activemq.apache.org/maven/apidocs/org/apache/activemq/jms/pool/PooledConnectionFactory.html>
 ) - I think it may be describing a little of what you’re seeing.

> On Feb 18, 2016, at 3:19 AM, Claus Ibsen <[email protected]> wrote:
> 
> Try setting a lower prefetch size as each consumer has a buffer of
> pre-fetched messages. If that buffer is lower then more consumers can
> get messages.
> 
> The default prefetch is 1000.
> 
> On Thu, Feb 18, 2016 at 11:05 AM, slew77 <[email protected]> wrote:
>> 
>> We are finding that under load that a single activemq endpoint with many
>> concurrent consumers can't keep up with the volume of traffic. However, if
>> we split the concurrent consumers between several identical routes it
>> performs much better.
>> 
>> E.g. if we configure this:
>> 
>>        <route>
>>            <from uri="activemq:queue:test?concurrentConsumers=100"/>
>>            <transacted/>
>>            <to uri="log:test?level=DEBUG"/>
>>        </route>
>> 
>> The test queue quickly backs up.
>> 
>> However, if we configure 10 identical routes:
>>        <route>
>>            <from uri="activemq:queue:test?concurrentConsumers=10"/>
>>            <transacted/>
>>            <to uri="log:test?level=DEBUG"/>
>>        </route>
>>        <route>
>>            <from uri="activemq:queue:test?concurrentConsumers=10"/>
>>            <transacted/>
>>            <to uri="log:test?level=DEBUG"/>
>>        </route>
>>        <route>
>>            <from uri="activemq:queue:test?concurrentConsumers=10"/>
>>            <transacted/>
>>            <to uri="log:test?level=DEBUG"/>
>>        </route>
>> etc
>> 
>> Then the same load is handled without backing up.
>> 
>> ---
>> 
>> This is the activemq configuration:
>> 
>> 
>>    <bean id="activemq"
>> class="org.apache.activemq.camel.component.ActiveMQComponent">
>>        <property name="connectionFactory" ref="poolConnectionFactory"/>
>> 
>>        <property name="transacted" value="true"/>
>> 
>>        <property name="transactionManager" ref="jmsTransactionManager"/>
>>        <property name="cacheLevelName" value="CACHE_CONSUMER" />
>>    </bean>
>> 
>> 
>>    <bean id="jmsTransactionManager"
>> class="org.springframework.jms.connection.JmsTransactionManager">
>>        <property name="connectionFactory" ref="poolConnectionFactory"/>
>>    </bean>
>> 
>> 
>>    <bean id="poolConnectionFactory"
>> class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start"
>> destroy-method="stop">
>>        <property name="maxConnections" value="8"/>
>>        <property name="connectionFactory" ref="jmsConnectionFactory"/>
>>        <property name="idleTimeout" value="0"/>
>>    </bean>
>> 
>>    <bean id="jmsConnectionFactory"
>> class="org.apache.activemq.ActiveMQConnectionFactory">
>>        <property name="brokerURL" value="tcp://localhost:61616"/>
>>    </bean>
>> 
>>    <bean id="required"
>> class="org.apache.camel.spring.spi.SpringTransactionPolicy">
>>        <property name="transactionManager" ref="jmsTransactionManager"/>
>>        <property name="propagationBehaviorName"
>> value="PROPAGATION_REQUIRED"/>
>>    </bean>
>> 
>> 
>> It's much less easy to configure the system when every queue connection must
>> be duplicated. Is there anything that can be tuned for the single route
>> option with more concurrentConsumers?
>> 
>> Thanks,
>> Steve.
>> 
>> 
>> 
>> --
>> View this message in context: 
>> http://camel.465427.n5.nabble.com/ActiveMQ-concurrentConsumers-vs-multiple-connections-tp5777831.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 
> -- 
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to