Reputation: 1877
In ActiveMQ, Can I anyway detect how much time a message took to deliver to subscriber from a publisher? Or Can I see separate timings that message took go from Publisher to topic(JMS service) And from (JMS service)Topic to Subsriber?
Upvotes: 1
Views: 1298
Reputation: 785058
When JMS message arrives at the consumer, you can look into the JMSTimestamp
header property. According to the Javadoc:
The JMSTimestamp header field contains the time a message was handed off to be sent.
Then you can simply subtract JMSTimestamp from current system time and calculate the time taken
in flight by that JMS message.
Upvotes: 3
Reputation: 22279
There is a Maven plugin for AMQ performance testing, it might be what you are searching for.
Otherwise, you could come very far by doing some measurements with some load testing tool such as Apache jMeter and just see how many messages you can read/write / sec.
Notice that you will have rather big differences if you go persistent and/or transactional or not.
Update:
You could maybe do something with the log by configuring conf/log4j.properties and setting:
log4j.rootLogger=TRACE, logfile, console
Then in data/activemq.log you can get some information for a put message. It's not really obvious what the numbers represent, so you should make sure to define a test scenario. The following time stamps was from a message put to a queue (myqueue) by HermesJMS to ActiveMQ:
2012-06-06 16:31:19,979 | DEBUG | localhost adding consumer: ID:GOTL19946-53234-
1338993070006-0:2:3:1 for destination: queue://myqueue |org.apache.activemq.broker.region.AbstractRegion | ActiveMQ Transport: tcp:///127.0.0.1:53236
2012-06-06 16:31:19,989 | DEBUG | queue://myqueue add sub: QueueBrowserSubscription: consumer=ID:GOTL19946-53234-1338993070006-0:2:3:1, destinations=0, dispatched=0, delivered=0, pending=0, dequeues: 0, dispatched: 0, inflight: 0 | org.apache.activemq.broker.region.Queue | ActiveMQ Transport: tcp:///127.0.0.1:53236
2012-06-06 16:31:19,989 | DEBUG | myqueue toPageIn: 1, Inflight: 0, pagedInMessages.size 0, enqueueCount: 1, dequeueCount: 0 | org.apache.activemq.broker.region.Queue | Queue:myqueue
2012-06-06 16:31:19,989 | TRACE | QueueStorePrefetch513024249 - fillBatch | org.apache.activemq.broker.region.cursors.AbstractStoreCursor | Queue:myqueue
2012-06-06 16:31:19,989 | DEBUG | dispatch to browser: QueueBrowserSubscription: consumer=ID:GOTL19946-53234-1338993070006-0:2:3:1, destinations=1, dispatched=0, delivered=0, pending=0, already dispatched/paged count: 1 | org.apache.activemq.broker.region.Queue | Queue:myqueue
2012-06-06 16:31:19,999 | TRACE | ID:GOTL19946-53234-1338993070006-0:2:3:1 dispatched: ID:GOTL19946-53234-1338993070006-0:2:2:1:1 - queue://myqueue, dispatched: 1, inflight: 1 | org.apache.activemq.broker.region.PrefetchSubscription | ActiveMQ Connection Dispatcher: /127.0.0.1:53236
2012-06-06 16:31:19,999 | TRACE | ack:MessageAck {commandId = 13, responseRequired = false, ackType = 2, consumerId = ID:GOTL19946-53234-1338993070006-0:2:3:1, firstMessageId = ID:GOTL19946-53234-1338993070006-0:2:2:1:1, lastMessageId = ID:GOTL19946-53234- 1338993070006-0:2:2:1:1, destination = queue://myqueue, transactionId = TX:ID:GOTL19946- 53234-1338993070006-0:2:2, messageCount = 1, poisonCause = null} | org.apache.activemq.broker.region.PrefetchSubscription | ActiveMQ Transport: tcp:///127.0.0.1:53236
2012-06-06 16:31:19,999 | DEBUG | commit: TX:ID:GOTL19946-53234-1338993070006-0:2:2 syncCount: 1 | org.apache.activemq.transaction.LocalTransaction | ActiveMQ Transport: tcp:///127.0.0.1:53236
2012-06-06 16:31:19,999 | DEBUG | myqueue toPageIn: 0, Inflight: 1, pagedInMessages.size 1, enqueueCount: 1, dequeueCount: 0 | org.apache.activemq.broker.region.Queue | Queue:myqueue
2012-06-06 16:31:20,049 | DEBUG | localhost removing consumer: ID:GOTL19946-53234-1338993070006-0:2:3:1 for destination: queue://myqueue | org.apache.activemq.broker.region.AbstractRegion | ActiveMQ Transport: tcp:///127.0.0.1:53236
2012-06-06 16:31:20,049 | DEBUG | queue://myqueue remove sub: QueueBrowserSubscription: consumer=ID:GOTL19946-53234-1338993070006-0:2:3:1, destinations=1, dispatched=0, delivered=1, pending=0, lastDeliveredSeqId: 67, dequeues: 0, dispatched: 1, inflight: 0 | org.apache.activemq.broker.region.Queue | ActiveMQ Transport: tcp:///127.0.0.1:53236
2012-06-06 16:31:20,049 | DEBUG | myqueue toPageIn: 0, Inflight: 0, pagedInMessages.size 1, enqueueCount: 1, dequeueCount: 0 | org.apache.activemq.broker.region.Queue | Queue:myqueue
Upvotes: 0