Reputation: 38
In case when RabbitMQ broker has a fanout exchange with many queues bound to it, where the queues are durable and messages delivered to the exchange are durable/persisted, will each queue store a separate copy for the message or broker may figure out and optimize queued message persistence and not store payload multiple times for each queue in the fan out, but store something like message links/references?
Upvotes: 0
Views: 1009
Reputation: 121
It depends on the size of the message. With persistence, each durable queue that receives a message will have a queue index that references that message. Larger messages (>= 4K by default) will be written to the message store and referenced by the queue index. Thus, each queue bound to your fanout exchange will have a queue index for the message, but only one copy of the message payload is sitting in the message store.
Smaller messages will be stored entirely within the queue index, with no entry in the message store. If your fanout exchange receives a small message, then each bound queue will have its own copy of the entire message.
A good explanation of RabbitMQ message persistence can be found at https://www.rabbitmq.com/persistence-conf.html.
Upvotes: 1