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 StoreIn ActiveMQ 5.0, a new high performance journaling persistence adapter was introduced called the AMQ Message Store.
To enable it, edit1 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.
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?
test
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