Thanks for the great reply.
I tested what you suggested:
1. separating the connections between producer and consumer increased the performance greatly (300k on 2 directions~ 600k took 45 seconds instead of about 75 seconds)
2. updating to caching in the consumer instead of single & update the cacheLevel to 3- had no impact on performance - i tried the transaction manager but for some reason
my computer got stuck every time i ran it and i had to restart the machine - i am not sure how this relates, maybe many connections are created.
3. I updated the deliveryMode in jmsTemplate to be not persistence - but i didn't see any impact on performance which is weird.
This is the new spring xml file:
Code:
<!-- ********************** Consumer ********************************* -->
<bean id="clientListener" class="example.ClientReceive">
<property name="receiveQueue" ref="receiveQueue" />
<property name="sinkQueue" ref="sinkQueue" />
<property name="clientSender" ref="clientSender"/>
</bean>
<bean id="containerClient"
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="concurrentConsumers" value="20"/><!-- if it is not 1 - it is difficult to see distribution to other services!!!change to 50,20 -->
<property name="maxConcurrentConsumers" value="50"/><!-- if it is not 1 - it is difficult to see distribution to other services!!!change to 50-->
<property name="idleTaskExecutionLimit" value="10"/>
<property name="connectionFactory" ref="cachingConnectionFactoryConsumer" />
<property name="destination" ref="receiveQueue" />
<property name="messageListener" ref="clientListener" />
<property name="cacheLevel" value="3"/> <!-- CACHE_CONSUMER: cache a shared JMS Connection, a JMS Session, and a JMS MessageConsumer for each listener thread. -->
<property name="sessionAcknowledgeMode" value="1"/>
</bean>
<bean id="receiveQueue" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="queueA"/>
</bean>
<bean id="sinkQueue" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="sinkQueue"/>
</bean>
<bean id="connectionFactoryConsumer"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="failover:(tcp://localhost:61616)?randomize=false" /> <!-- Single broker-->
</bean>
<bean id="singleConnectionFactoryConsumer" class="org.springframework.jms.connection.SingleConnectionFactory">
<property name="targetConnectionFactory"
ref="connectionFactoryConsumer" />
<property name="reconnectOnException" value="true"/>
</bean>
<bean id="cachingConnectionFactoryConsumer"
class="org.springframework.jms.connection.CachingConnectionFactory">
<!-- <constructor-arg ref="singleConnectionFactoryConsumer"/> -->
<constructor-arg ref="connectionFactoryConsumer"/>
<property name="sessionCacheSize" value="100" />
</bean>
<!--<bean id="jmsTransactionManagerConsumer" class="org.springframework.jms.connection.JmsTransactionManager">
<property name="connectionFactory" ref="connectionFactoryConsumer" />
</bean>-->
<!-- ********************** END-Consumer ***************************** -->
<!-- ********************** Producer ********************************* -->
<bean id="clientSender" class="example.ClientSend">
<property name="sendQueue" ref="sendQueue" />
<property name="jmsTemplate" ref="jmsTemplate"/>
</bean>
<bean id="sendQueue" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="queueB"/>
</bean>
<!-- for send response on temp q-->
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate" lazy-init="true">
<property name="connectionFactory" ref="cachingConnectionFactoryProducer"/>
<property name="deliveryMode" value="1"/>
</bean>
<bean id="connectionFactoryProducer"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="failover:(tcp://localhost:61616)?randomize=false" /> <!-- Single broker-->
</bean>
<bean id="cachingConnectionFactoryProducer"
class="org.springframework.jms.connection.CachingConnectionFactory">
<constructor-arg ref="connectionFactoryProducer"/>
<property name="sessionCacheSize" value="100" />
</bean>
<!-- ********************** END Producer ********************************* -->