gpt4 book ai didi

activemq - 使用 zookeeper 在 activemq cms MessageProducer.send 中等待五秒钟

转载 作者:行者123 更新时间:2023-12-02 03:38:18 24 4
gpt4 key购买 nike

我正在测试 ActiveMQ 5.9.0 with Replicated LevelDB .

针对具有本地 LevelDB 存储的独立 ActiveMQ 运行,每个 producer.send(message)调用大约需要 1 毫秒。使用我的 3 个动物园管理员和 3 个 activemq 代理的复制设置,producer.send(message)返回需要略多于 5 秒!即使使用 sync="local_mem" 也会发生这种情况在<replicatedLevelDB ... > .它总是略高于 5 秒,因此似乎涉及到一些奇怪的等待/超时。

这响铃了吗?

如果我将 brokerurl 设置为 failover:(<all three brokers>) 并不重要或者只是 tcp://brokerX ,其中 brokerX 在复制的 LevelDB 设置中。在 brokerX web ui (hawtio) 中发送消息没有明显的延迟。如果我改成 tcp://brokerY ,其中 broker 是与 <persistenceAdapter ...> 在其他方面相同的经纪人设置为 <levelDB...>而不是 <replicatedLevelDB...> ,每次发送减少 1 毫秒。

更改 zookeeper tickTime 等没有任何区别。

调试日志如下。如您所见,“发送到队列”之间有 5 秒,但 zookeeper ping 很快。

2014-02-19 10:45:34,719 | DEBUG | Handling request for path /jolokia | io.hawt.web.AuthenticationFilter | qtp1217711018-227
2014-02-19 10:45:34,724 | DEBUG | localhost Message ID:<hostname>-57776-1392803129562-0:0:1:1:2 sent to queue://IO_stab_test_Q | org.apache.activemq.broker.region.Queue | ActiveMQ Transport: tcp:///<ip address>:54727@61616
2014-02-19 10:45:34,725 | DEBUG | IO_stab_test_Q toPageIn: 1, Inflight: 1, pagedInMessages.size 1, enqueueCount: 27, dequeueCount: 25 | org.apache.activemq.broker.region.Queue | ActiveMQ BrokerService[localhost] Task-20
2014-02-19 10:45:34,731 | DEBUG | Handling request for path /jolokia | io.hawt.web.AuthenticationFilter | qtp1217711018-222
2014-02-19 10:45:34,735 | DEBUG | Got ping response for sessionid: 0x244457fceb80003 after 0ms | org.apache.zookeeper.ClientCnxn | main-SendThread(<hostname>:2181)
2014-02-19 10:45:34,867 | DEBUG | Handling request for path /jolokia | io.hawt.web.AuthenticationFilter | qtp1217711018-222
2014-02-19 10:45:35,403 | DEBUG | Got ping response for sessionid: 0x244457fceb80003 after 0ms | org.apache.zookeeper.ClientCnxn | main-SendThread(<hostname>:2181)
2014-02-19 10:45:35,634 | DEBUG | Handling request for path /jolokia | io.hawt.web.AuthenticationFilter | qtp1217711018-227
2014-02-19 10:45:36,071 | DEBUG | Got ping response for sessionid: 0x244457fceb80003 after 0ms | org.apache.zookeeper.ClientCnxn | main-SendThread(<hostname>:2181)
2014-02-19 10:45:36,740 | DEBUG | Got ping response for sessionid: 0x244457fceb80003 after 0ms | org.apache.zookeeper.ClientCnxn | main-SendThread(<hostname>:2181)
2014-02-19 10:45:37,410 | DEBUG | Got ping response for sessionid: 0x244457fceb80003 after 0ms | org.apache.zookeeper.ClientCnxn | main-SendThread(<hostname>:2181)
2014-02-19 10:45:38,088 | DEBUG | Got ping response for sessionid: 0x244457fceb80003 after 8ms | org.apache.zookeeper.ClientCnxn | main-SendThread(<hostname>:2181)
2014-02-19 10:45:38,623 | DEBUG | Handling request for path /jolokia | io.hawt.web.AuthenticationFilter | qtp1217711018-222
2014-02-19 10:45:38,750 | DEBUG | Got ping response for sessionid: 0x244457fceb80003 after 0ms | org.apache.zookeeper.ClientCnxn | main-SendThread(<hostname>:2181)
2014-02-19 10:45:39,420 | DEBUG | Got ping response for sessionid: 0x244457fceb80003 after 0ms | org.apache.zookeeper.ClientCnxn | main-SendThread(<hostname>:2181)
2014-02-19 10:45:39,735 | DEBUG | localhost Message ID:<hostname>-57776-1392803129562-0:0:1:1:3 sent to queue://IO_stab_test_Q | org.apache.activemq.broker.region.Queue | ActiveMQ Transport: tcp:///<ip address>:54727@61616
2014-02-19 10:45:39,737 | DEBUG | IO_stab_test_Q toPageIn: 1, Inflight: 2, pagedInMessages.size 2, enqueueCount: 28, dequeueCount: 25 | org.apache.activemq.broker.region.Queue | ActiveMQ BrokerService[localhost] Task-24
2014-02-19 10:45:40,090 | DEBUG | Got ping response for sessionid: 0x244457fceb80003 after 0ms | org.apache.zookeeper.ClientCnxn | main-SendThread(<hostname>:2181)

最佳答案

设置queuePrefetch=0。

关于我们情况的一些背景......

我们的消息大小相当小(<1kb xml),但我们的消费者从快(<1 秒)到慢(10 小时以上)不等。之前我们已经设置了 prefetch=1,但即使这样也会在处理一条慢速消息并且在它后面预取另一条消息时给我们带来问题。

我们注意到我们的快速消息通常会在生产者收到确认之前完成处理!我们发现 producer.send() 方法比我们预期的要花费 +5 秒(准确)。这就是让我找到这个问题的原因。

无论如何,我们的解决方案是设置 prefetch=0。这为我们完全消除了 5 秒的延迟,并为我们解决了另一个问题。

关于activemq - 使用 zookeeper 在 activemq cms MessageProducer.send 中等待五秒钟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21877092/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com