广告
返回顶部
首页 > 资讯 > 数据库 >MQ队列堆积太长,消费不过来怎么办
  • 190
分享到

MQ队列堆积太长,消费不过来怎么办

MQ队列堆积太长,消费不过来怎么办 2017-09-26 03:09:22 190人浏览 才女
摘要

转自:Http://windwrite.com/arcHives/603 我们现有的业务就面临此问题,消息生产太快,消费不过来,导致队列堆积很长,把服务器内存耗尽,这时RabbitMQ的处理能力很低下。 我在RabbitMQ社区发邮件问

转自:Http://windwrite.com/arcHives/603

我们现有的业务就面临此问题,消息生产太快,消费不过来,导致队列堆积很长,把服务器内存耗尽,这时RabbitMQ的处理能力很低下。

我在RabbitMQ社区发邮件问了下:

 

We have the queue publisher and subscriber, the subscriber is Going with multi-threads.

The problem is the queue has been increasing too quickly, the consumers can not follow the increment speed, as you see:

root@ubuntu:~# for i in `seq 1 10`;do rabbitmqctl list_queues -p /actionlog;sleep 1;done
Listing queues …
queue_stORM_actionlog 12665787
…done.
Listing queues …
queue_storm_actionlog 12670873
…done.
Listing queues …
queue_storm_actionlog 12667975
…done.
Listing queues …
queue_storm_actionlog 12672645
…done.
After one day or about, the queue size can be more than 20 millions, thus RabbitMQ becomes high load and the consuming process is very slow.

收到的答复邮件内容如下:

Increase # of throughput of consumers or reduce publishing rate. If consumers cannot
catch up, hardware upgrades will only offset the moment when systems starts running
low on resources.

If messages can be lost, 3.1 introduces a new feature, queue length limit:
http://www.rabbitmq.com/maxlength.html

Further to the suggestion of imposing a maximum queue length, you could
also consider imposing a maximum message age and instruct the broker to
discard messages that become stale: http://www.rabbitmq.com/ttl.html

总结起来解决方案大体包括:

    • 增加消费者的处理能力,或减少发布频率
    • 单纯升级硬件不是办法,只能起到一时的作用
    • 考虑使用队列最大长度限制,RabbitMQ 3.1支持
    • 给消息设置年龄,超时就丢弃
您可能感兴趣的文档:

--结束END--

本文标题: MQ队列堆积太长,消费不过来怎么办

本文链接: https://www.lsjlt.com/news/1770.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作