Tuning Message Bus performance in Servicemix

Posted by dave
on May 21, 2008 @ 10:21 PM

How fast you can send messages through ServiceMix is highly dependent on how the embedded ActiveMQ broker within ServiceMix is configured. This is because the ServiceMix NMR uses ActiveMQ as its messaging engine, so choosing the correct connection factories and persistenceAdapter can give you easy gains in performance.

AMQ Message Store

In ActiveMQ 5.0, a new high performance journaling persistence adapter was introduced called the AMQ Message Store.

To enable it, edit /conf/activemq.xml and modify the xbean config, adding the amq:persistenceAdapter element.
1
2
3
4
5
6
7
8
 <amq:persistenceAdapter>
         <!-- Goodbye journaledJDBC --> 
         <!--amq:journaledJDBC journalLogFiles="5" dataDirectory="./data/amq"/ -->

         <!-- Hello AMQ Message Store -->
         <amq:amqPersistenceAdapter directory="file://./data/amq"/>

 </amq:persistenceAdapter>

And by the numbers ..

Example Flow: Jms consumer -> JMS provider(w/Marshaller) -> EIP pipeline -> Bean -> JMS Provider MessageCount: 10000

   With JournaledJDBC:

   [java] Overall time: 137701 ms
   [java] Messages per sec: 7.262111386264443
   [java] 
   [java] Time: 139.603
   [java]
   [java] OK (1 test)
   With AMQ Message Store:

   [java] Overall time: 20511 ms
   [java] Messages per sec: 48.75432694651651
   [java]
   [java] Time: 23.556
   [java]
   [java] OK (1 test)

Two additional steps:

1) The current version of Servicemix trunk is using 4.1.1 of ActiveMQ, so if you want to build a ServiceMix distribution that contains ActiveMQ 5, you need to edit /trunk/pom.xml:

1
2
3
/trunk/pom.xml
-        <activemq-version>4.1.1</activemq-version>
+        <activemq-version>5.1.0</activemq-version>

2) Once the activemq-version is updated, the ra namespace in jndi.xml needs to be updated too - as this changed between AMQ versions.

/distributions/apache-servicemix/src/main/release/conf/jndi.xml
-       xmlns:amqra="http://activemq.org/ra/1.0"
+       xmlns:amqra="http://activemq.apache.org/schema/ra"

If your using Fuse ESB, it has a 5.x version of the Fuse Message Broker included, so the XML configuration change should be all thats required.

Comments

Leave a response

  1. Torsten MielkeMay 22, 2008 @ 05:19 AM

    Hi Dave,

    Yes, I have seen very similar performance boosts when testing with a particular Camel route. With the JDBC persistence adapter I got a throughput of about 3 requests/sec. After changing to AMQ Store I got around 45 request/sec processed. That is a huge improvement.

    I have heard the old JDBC adapter is only used for historical reasons. Perhaps it is time to now change the default adapter to AMQ Message Store?

  2. DaveMay 27, 2008 @ 11:27 AM

    test

  3. DaveMay 27, 2008 @ 11:32 AM

    Hey Torsten, Apologies for the delay in replying back – I was tweaking Mephisto and the blog commenting wasn’t working correctly!

    I’ve logged http://issues.apache.org/activemq/browse/SM-1363, so hopefull it will make it in soon.

    Cheer’s /Dave