gpt4 book ai didi

rabbitmq - RabbitMQ实际上如何物理存储消息?

转载 作者:行者123 更新时间:2023-12-03 10:42:47 26 4
gpt4 key购买 nike

我想知道RabbitMQ如何将消息物理存储在其RAM和磁盘中?

我知道RabbitMQ尝试将消息保留在内存中(但是我不知道消息如何放入Ram中)。但是,当消息处于持久模式或代理具有内存压力时,消息可能会溢出到磁盘中。 (但是我不知道消息是如何存储在磁盘中的。)

我想知道这些的内部。不幸的是,其主页上的官方文档没有公开内部细节。

我应该阅读哪个文件?

最佳答案

RabbitMQ使用自定义数据库存储消息,该数据库通常位于以下位置:

/var/lib/rabbitmq/mnesia/rabbit@hostname/queues

从3.5.5版本开始,RabbitMQ引入了新的New Credit Flow
https://www.rabbitmq.com/blog/2015/10/06/new-credit-flow-settings-on-rabbitmq-3-5-5/

Let’s take a look at how RabbitMQ queues store messages. When a message enters the queue, the queue needs to determine if the message should be persisted or not. If the message has to be persisted, then RabbitMQ will do so right away[3]. Now even if a message was persisted to disk, this doesn’t mean the message got removed from RAM, since RabbitMQ keeps a cache of messages in RAM for fast access when delivering messages to consumers. Whenever we are talking about paging messages out to disk, we are talking about what RabbitMQ does when it has to send messages from this cache to the file system.



这个帖子博客足够详细。

我还建议阅读有关延迟队列的信息:
https://www.rabbitmq.com/lazy-queues.html

https://www.rabbitmq.com/blog/2015/12/28/whats-new-in-rabbitmq-3-6-0/

Lazy Queues This new type of queues work by sending every message that is delivered to them straight to the file system, and only loading messages in RAM when consumers arrive to the queues. To optimize disk reads messages are loaded in batches.

关于rabbitmq - RabbitMQ实际上如何物理存储消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38444425/

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