camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Travis Klotz <travis.kl...@gmail.com>
Subject Re: Camel Transaction performance - use of batches?
Date Mon, 22 Aug 2011 16:12:12 GMT
I haven't worked with batches, but I did just spend a bunch of time
working with setting up Local JMS Transactions with ActiveMQ and
Camel.  The big things I found were:

* Make sure you turn the prefetch policy down to zero if you are
consuming messages across different machines.  You can do this with
your connection string, so something like:
tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=0

* Make sure you are using a pooledConnectionFactory wrapped around the
normal AMQ connection factory  (and make sure the pooled connection
factory is stopped on shutdown)  So something like this if you are
using spring:

<bean id="pooledConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory"
destroy-method="stop">
  <property name="connectionFactory" ref="activemqConnectionFactory" />
</bean>

* Set the cache level on the Jms/ActiveMQ Component properly.  I found
things worked best when set to CACHE_CONNECTION when working with
consumers on multiple servers and Master/Slave failover on the AMQ
server.

<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
  <property name="transacted" value="true"/>
  <property name="connectionFactory" ref="pooledConnectionFactory"/>
  <property name="transactionManager" ref="transactionManager"/>
  <property name="cacheLevelName" value="CACHE_CONNECTION"/>
</bean>

Even with these settings, things are going to be quite a bit slower
than in a non-transactional setup.  A lot of that is just the penalty
for using transactions.  If performance is really critical you may
need to look at something like CLIENT_ACKNOWLEGE and deal with any
duplicate messages that may get passed through.

Travis

On Mon, Aug 22, 2011 at 7:08 AM, Viju <vvbiju2005@gmail.com> wrote:
> Can someone please help or provide pointers ? The documentation indeed talks
> about batches  but cant see how is it feasible using camel batching?
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Transaction-performance-use-of-batches-tp4720389p4723156.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Mime
View raw message