ActiveMQ 消息消费延迟大 [英] Large delays in message consumption of messages in ActiveMQ

查看:45
本文介绍了ActiveMQ 消息消费延迟大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个经纪人网络,由不同服务器上的三个经纪人组成.网络连接器配置如下:

We have a network of brokers consisting of three brokers on different servers. The network connectors are configured as follows:

    <networkConnectors>
      <networkConnector uri="static:(ssl://broker2:61616,ssl://broker3:61616)" networkTTL="5"/>
    </networkConnectors>

整体设置如下图所示.

在实践中,我们有时会看到特定客户端的消息消耗有很大的延迟.在这种情况下,消息在最终被消费之前会被多次转发到其他代理.到目前为止,我们一直无法找出导致这种情况的原因.

In practice we sometimes see large delays for the message consumption of a specific client. In that case, messages are forwarded multiple times to other brokers before finally being consumed. Until now, we have been unable to find out what might be the cause of this.

消费者不是很忙.它们是使用 Spring JMS 库实现的.每个代理的最小消费者数量是 3 个,但这可以根据需要自动扩展.

The consumers are not very busy. They are implemented using the Spring JMS library. The minimum number of consumers is 3 per broker, but this can automatically scale depending on the need.

我们怀疑只有特定客户端受到影响的原因可能与我们使用 JMSGroupId 对消息处理方式进行排序有关.但是,我们没有确切的证据证明这一点.它仍然没有解释它为什么会发生.

We suspect that the reason that only a specific client is impacted, might have something to do with the fact that we use the JMSGroupId to get some ordering in how the messages are handled. However, we have no sure proof of this. And it still doesn't explain why it happens at all.

我们还考虑向网络连接器添加以下参数,因为我们认为这可能会改善行为:

We are also considering to add the following parameters to the network connector as we think this might improve the behavior:

dynamicOnly="true"
decreaseNetworkConsumerPriority="true"
suppressDuplicateQueueSubscriptions="true"

然而,这样做也很可怕,因为我们觉得我们并不完全了解现在正在发生的事情,因此无法真正确定这些设置对行为的影响.

However, it is also scary to do as we feel we do not fully understand what is happening right now and so cannot really be sure of the effect these settings will have on the behavior.

推荐答案

我们怀疑只有特定客户受到影响的原因,可能与我们使用 JMSGroupId 的事实有关对消息的处理方式进行排序.

We suspect that the reason that only a specific client is impacted, might have something to do with the fact that we use the JMSGroupId to get some ordering in how the messages are handled.

宾果游戏.

如果您确保串行消息处理,扩展消费者是无用的.摆脱这种行为的最好方法是设置一个专用的 JMS 队列,每组一个消费者,否则当队列中的多个后续消息属于同一组时,您将尝试消费者争用.

Scaling consumer is useless if your ensure serial message processing. The best way to get rid of this behavior is to set up a dedicated JMS queue with a single consumer per group, otherwise you will experiment consumer contention when multiple following messages in the queue belong to the same group.

请参阅JMS 拓扑(具有多个消费者的队列)和消息组

这篇关于ActiveMQ 消息消费延迟大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆