camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ashwin Karpe <aka...@fusesource.com>
Subject Re: How to speed up JMS production?
Date Tue, 25 Oct 2011 21:09:40 GMT
Hi,

Interesting, need a faster Producer, eh!!!... Usually not a good idea since
it creates pileups on the broker queues (which should ideally be clean).
Especially since in JMS a fast producer/slow consumer is not usually a good
recipe for enterprise messaging.

Having put forth my obligatory cautions, you could speed things up in the
following way. 
    1> Create a pooled dispatcher/producer i.e "activemq" should use pooled
connection factories that do not incur the cost of recycling connections,
sessions etc. Spring tends to recycle connections, sessions etc and Camel
can inherit these qualities. Pooling and setting JMS cache levels can be a
way to overcome that.
    2> Create multiple instances of such pooled dispatchers/producers and
load balance messages using round robin
    3> Give enough threads directly to the load balancer so that it is not
the route bottleneck.
    4> Ensure that the source Uri is a "direct:..." so you are using an in
memory dispatch to the route from your client application. Of course, all of
this assumes that you client application is extremely fast and that the
Camel route is slow on the pickup.
    5> If this still does not cut it, create multiple such routes involving
steps 1 thru 4.

Scary and just in time for Halloween :)...

An example of what I have stated is given below. I believe it works...

===============================================           
    	    from(sourceUri)
    	       .routeId("CBR-Route")                 
.threads(25).maxPoolSize(50).threadName("MyAMQDispatchPool").keepAliveTime(25).timeUnit(TimeUnit.SECONDS).rejectedPolicy(ThreadPoolRejectedPolicy.DiscardOldest)
               .loadBalance()
               .roundRobin()
                   .to(dispatcherUri, dispatcher2Uri, dispatcher3Uri);

===============================================

Cheers,

Ashwin...

-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com 
---------------------------------------------------------
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-speed-up-JMS-production-tp4936275p4937750.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message