在 ActiveMQ 中,我是否可以检测到消息从发布者传递给订阅者需要多长时间?或者我可以看到消息从发布者到主题(JMS 服务)和从(JMS 服务)主题到订阅者的单独时间吗?
问问题
1004 次
2 回答
3
当 JMS 消息到达消费者时,您可以查看JMSTimestamp
header 属性。根据Javadoc:
JMSTimestamp 标头字段包含传递消息以发送的时间。
然后,您可以简单地从当前系统时间中减去 JMSTimestamp 并time taken
通过该 JMS 消息计算运行中。
于 2012-06-06T16:40:09.027 回答
0
有一个用于 AMQ 性能测试的 Maven 插件,它可能是您正在寻找的。
否则,您可以通过使用诸如Apache jMeter之类的负载测试工具进行一些测量,然后查看每秒可以读取/写入多少条消息。
请注意,如果您坚持和/或交易与否,您将有相当大的差异。
更新:
您可以通过配置 conf/log4j.properties 和设置来对日志做一些事情:
log4j.rootLogger=TRACE, logfile, console
然后在 data/activemq.log 中,您可以获得一些关于 put 消息的信息。这些数字代表什么并不是很明显,因此您应该确保定义一个测试场景。以下时间戳来自 HermesJMS 放入队列 (myqueue) 到 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
于 2012-06-06T11:26:13.957 回答