Friday, November 9, 2012

ActiveMQ 5.3 vs. 5.7

I have been reviewing the latest features of ActiveMQ 5.7.  There are features in 5.7 that are not in the 5.3 version that I'm most familiar with.
Features like:
  • Message Priority
  • Web Sockets
  • Delay and Schedule Message Delivery
  • Cluster and Failover 
  • more
 I did some comparisons of ActiveMQ version 5.3 vs. 5.7 on the following local machine:
Intel Core i7 Q720 @ 1.6GHz with 8gb ram on 64 bit Windows 7 Ultimate.

Scenario 1: Producing and Consuming small 'hi' test messages of the amount of 10K on 5.7 ActiveMQ versions locally using ONE consumer with transacted messages (activemq-all-5.7.0.jar).
Scenario 2: Producing and Consuming small 'hi' test messages of the amount of 10K on 5.3 ActiveMQ versions locally using ONE consumer with transacted messages. (activemq-all-5.3.0.jar)
Scenario 3: Producing and Consuming small 'hi' test messages of the amount of 10K on 5.7 ActiveMQ versions locally using ONE consumer with NON transacted messages. (activemq-all-5.7.0.jar)Results:
Scenario 4: Producing and Consuming small 'hi' test messages of the amount of 10K on 5.3 ActiveMQ versions locally using ONE consumer with NON transacted messages. (activemq-all-5.3.0.jar)Results:

TransactedProducing 10,000 MessagesConsuming 10,000 MessagesActive MQ Version
Scenario 1 1.8 Seconds (avg)113 Seconds (avg)5.7
Scenario 2 2.8 Seconds (avg)110 Seconds (avg)5.3
Non-Transacted   
Scenario 3 2.8 Seconds (avg)12.3 Seconds (avg)5.7
Scenario 4 2.0 Seconds (avg)9.3 Seconds (avg)5.3


Conclusion: Speed isn't sufficient enough to warrant an upgrade in this case as they both are basically running at the same pace, however the most interesting part I saw here was the speed differences between Transacted messages (slower) and Non-Transacted Messages.  By a multiplier of about 10X, transacted message consumption through the ColdFusion Gateway slows down.  Its worth asking yourself "Can I handle a loss of messages?" at this speed difference.

The stability of the two of them should be similar but we will have a chance to put 5.7 to the test soon enough.  If you're seeing some strange issues in production like we are where ActiveMQ gets into a 'stalled' state where its neither producing, nor allowing consumption of messages in it's queues, you are not alone.  I've seen graphs that have shown ActiveMQ in this state and a restart is the only thing that brought it back to life (5.3).  After churning through millions of messages a day, I'd guess something might hit a breaking point, but hopefully 5.7 will give us a bit more stability over the long haul.  Better monitoring of the queue counts need to be in place for us to reliably use 5.3 now, however I like it for it's features, ease of use and integration with ColdFusion (thanks Sean Corfield for the Gateway and Documentation!).

Hung Threads using ActiveMQ and ColdFusion

I have been working with the ActiveMQ gateway for years now, and I just had to dig deeper as we encounter odd states with ActiveMQ over time in production.  After starting and stopping a cfGateway in the cfadmin 2x, I do a thread dump on the server and see that there are 4 threads that have been generated as a result.  The more times you start/stop, the more threads seem to stick around indefinitely (forever from what I see).  Is it possible there's some leak here or close not being properly called through cfadmin to Gateway?  I'm using cf9 local dev and activemq 5.7 but 5.3 also suffers from the same thing (threads pile up on start/stop).  At times I've also seen the Consumer Count not match the number of consumers that should be listed using ActiveMQ 5.3 and cf8 i.e. if there are 16 consumers, I've seen 32.  I shut the 16 off, and 16 still remain as 'registered' consumers (which may tell me that these background threads are alive, yet dead, as they typically never take any messages.

Thread Dump:



Anyone else have this problem or can confirm that this is a similar behavior to what you're seeing?