camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Camel Transaction performance - use of batches?
Date Sun, 21 Aug 2011 12:57:58 GMT
You can enable caching the consumer and the TX should go faster.

 <bean id="jmsconfig"
 class="org.apache.camel.component.jms.JmsConfiguration">
        <property name="connectionFactory" ref="connFactory" />
        <property name="transactionManager" ref="jmsTxnManager" />
        <property name="transacted" value="true" />
        <property name="cacheLevelName" value="CACHE_CONSUMER" />
 </bean>



On Sun, Aug 21, 2011 at 2:47 PM, Viju <vvbiju2005@gmail.com> wrote:
> Im using a camel route which is transacted. I have set the transacted
> property to be true in the JMSComponent via JMSConfig. In the route which
> listens to a message on a queue (Consumer) , I have provided <transacted />
> tag which makes the route transacted.
>
> The DSL snippet is -
> <bean id="jmsconfig"
> class="org.apache.camel.component.jms.JmsConfiguration">
>        <property name="connectionFactory" ref="connFactory" />
>        <property name="transactionManager" ref="jmsTxnManager" />
>        <property name="transacted" value="true" />
> </bean>
>
> <camel:route id="processor">
>                        <camel:from uri="myqueue" />
>                         <camel:transacted/>
> ...............
>
>
> The other properties of the message and consumers are
> a. Messages are persistent
> b. There are 80 concurrent consumers listening to the same queue.
> c. The route, after receiving the message, passes the message to a bean that
> process the message.
>
> I made two test runs . one with transaction and the other without a
> transaction. The observation is as follows
> with transaction : route can consume 13 messages / second
> without transaction: route can consume 60 messages / second.  This is like 5
> times faster than with transaction.
>
> Im searching for options which will make the route faster with transactions.
>
> I read a post which states that, once we put transaction, the read and write
> from the queue is made synchronous. Is it also synchronized i.e. if I have
> 80 concurrent consumers, only one will commit at a time? So more consumers,
> more slow due to locking.
>
> I read another post which states that we can use batches. i.e. each message
> should not be just one transaction. We need to batch a set of messages into
> one transaction , say 100.
> I could not figure out how to enable this in my DSL? Any pointers?
>
> Also, if I use batching for messages with transaction and my beans processed
> 80 messages of the 100 in a batch and then JVM crashed, the 100
> messages(including the 80 that is processed by the business logic) will be
> recorded as not delivered in AMQ and hence will be redelivered next time.
> This means that, the 80 messages will be reprocessed (Putting an idempotent
> consumer fixes it but this is a workaround only in my opinion) . Is the
> understanding correct?
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Transaction-performance-use-of-batches-tp4720389p4720389.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message