Rabbitmq集群在创建队列时崩溃

问题描述 投票:0回答:1

你好,我有一个问题,约有两天无法解决,所以我会在这里写得尽可能清楚,这样也可能对其他人有帮助。

方案是:

  1. 我们有一个应用程序,使用Rabbitmq集群可以处理大约20万个使用amqp协议的设备。
  2. 我们考虑使用1个Exchange,其中200,000个队列,每个设备大约有6个“路由键”。
  3. 这些队列必须持久且懒惰,因为我们不想丢失任何消息。
  4. 我们需要HA时正在使用镜像节点。

测试:

  1. 我创建了一个具有5个节点的群集,并且复制2个
    "definition": {
            "ha-mode": "exactly",
            "ha-params": 2,
            "ha-sync-mode": "automatic",
            "ha-sync-batch-size": 1
          }
  1. 我还使用路由键创建了50k持久,懒惰的队列。
def create_one_queue(queue_name, threadName, channel):
    channel.queue_declare(queue=queue_name, durable=True, arguments={'x-queue-mode': 'lazy'})
    for bind in BINDINGS:
        channel.queue_bind(exchange=EXCHANGE, queue=queue_name, routing_key=bind.format(queue_name))
    print("[{}]Created Queue {}".format(threadName, queue_name))

def create_queues(threadName, base):
    channel = get_channel()
    for i in range(0, 1000):
        try:
            queue_name = str(i + base)
            create_one_queue(queue_name, threadName, channel)
        except Exception as e:
            print(e)

enter image description here3.当我试图保持增长并到达20万个节点时,开始崩溃而又没有资源用尽。

链接

我已经看过以下帖子:

https://www.rabbitmq.com/ha.html#ways-to-configure

https://www.cloudamqp.com/blog/2018-01-09-part3-rabbitmq-best-practice-for-high-availability.html

RabbitMQ - How many queues RabbitMQ can handle on a single server?

https://serverfault.com/questions/378165/rabbitmq-reasonable-performance-scale-expectations

http://rabbitmq.1065348.n5.nabble.com/How-many-queues-can-one-broker-support-td21539.html

https://www.quora.com/RabbitMQ/Can-rabbitMQ-or-zeroMQ-handle-1mil-queues

但是我看到矛盾(cloudamqp建议使用较少的队列,但在其他地方说您可能会到达1M队列)

问题

  1. 如果我没有足够的资源,群集怎么可能开始崩溃?
  2. 我的方法错误吗?
  3. 是否有任何改善我的群集配置的建议?

非常感谢

rabbitmq amqp messagebroker rabbitmq-exchange
1个回答
0
投票

好吧,我将用到目前为止的发现结果回答我的问题:

1)当我使用Kubernetes和Helm部署集群时,我在Pod中承受了很大的内存压力,没有剩余空间供垃圾收集器使用。https://www.rabbitmq.com/memory-use.html#queue-memory-usage-gc

2)似乎还可以。

3)为了创建200k持久和懒惰队列,我不得不使用10个节点的群集,每个节点具有8个vCPU和30 GB RAM。

注意:当我调整群集时,我将保持最新答案。

© www.soinside.com 2019 - 2024. All rights reserved.