Guide · RabbitMQ

The RabbitMQ Clustering and Sizing Guide

A RabbitMQ cluster that stays up is a set of decisions made in the right order: how many nodes and where, which queue type each workload gets, how much memory and disk each node needs at peak, and what happens when the network misbehaves. This guide takes them in that order.

Tyler Eastridge

By Tyler Eastridge, Head of Operations

LinkedIn · Updated

3 min read7 sections
On this page
Clustering in one paragraph

Clustering in one paragraph

Three nodes, or five for estates that must survive two failures, on separate hosts in separate failure domains, with pause_minority partition handling. Quorum queues for anything durable, streams for replay and fan-out, classic queues only for transient traffic, and no classic mirroring. Size memory and disk to peak backlog rather than average throughput, leave scheduler headroom, and set the watermark and disk-free limits to the real host. Then tune heartbeats and net_ticktime to the actual network, and write every policy down.

Node count and placement

Quorum queues need a majority, so the node count is odd: three survives one failure, five survives two. Nodes go on separate physical hosts, in separate availability zones where the cloud offers them, on a network with low and stable latency between them. Two-node clusters cannot form a majority and are worse than one node; even counts waste a node. Do not stretch a cluster across regions.

One queue type per workload, chosen deliberately

Quorum queues for anything that must survive a node loss; they replicate with Raft, elect leaders on failure, and support delivery limits and dead-lettering. Streams for high-throughput fan-out and replay. Classic queues for transient, non-replicated traffic only. Classic mirrored queues are deprecated and should be migrated, not tuned.

Size memory, disk and CPU to peak, not average

Memory is set by backlog: a queue that normally holds nothing can hold millions of messages during a consumer outage, and that is the case the node must survive. Disk is set by the same backlog plus quorum-queue segments and the write-ahead log. CPU is set by Erlang scheduler headroom under peak publish and consume rates, with dedicated cores on virtualised hosts. Set vm_memory_high_watermark and disk_free_limit to the real host so alarms fire before the node does, and alert on the alarm.

Decide what happens in a partition before one happens

cluster_partition_handling is pause_minority in production: the minority side pauses, the majority keeps serving, and there is nothing to reconcile on heal. autoheal lets both sides accept writes and then discards one side, which is data loss by design. ignore is for a lab. Combine with quorum queues and an odd node count and most partition incidents become a paused node and a page rather than a data-loss investigation.

Tune the cluster to the network it runs on

Defaults assume a LAN. On cloud and WAN links set heartbeats longer, tune tcp_listen_options for keepalive and buffers, and raise the Erlang net_ticktime so transient latency does not register as a node failure. Keep clocks on NTP. Validate under real conditions; a cluster that passes in a lab and partitions weekly in production usually has a net_ticktime problem.

Policies, not per-queue arguments

Queue type, delivery limits, dead-letter exchanges, TTL, max-length and overflow behaviour belong in policies matched by pattern, so a topology change does not require a client redeploy and an auditor can read the intent in one place. Targeted policies, not blanket ones; a policy that matches every queue is how mirroring got out of hand in the first place. Keep the policies in version control alongside the definitions export.

The cluster is only as stable as its clients

Long-lived connections with pooled channels, bounded prefetch, prompt acknowledgements, publisher confirms for anything that must not be lost, and automatic connection recovery. Most cluster symptoms — climbing unacked counts, file-descriptor exhaustion, memory that looks like a leak — start in client code. Review the clients as part of the cluster design, not after the first incident.

Frequently asked questions

How many nodes should a RabbitMQ cluster have?

Three for most production estates, five where two simultaneous failures must be survived. Always odd, because quorum queues need a majority; two nodes is worse than one. Nodes go on separate hosts and, in the cloud, separate availability zones.

Should I use quorum queues or classic queues?

Quorum queues for anything that must survive a node loss, streams for replay and high-throughput fan-out, classic queues only for transient traffic that can be lost. Classic mirrored queues are deprecated and should be migrated.

How do I size a RabbitMQ node?

To peak backlog, not average throughput. Memory and disk must hold the largest backlog a consumer outage can produce, plus quorum-queue segments and the write-ahead log. CPU needs Erlang scheduler headroom under peak rates, on dedicated cores if virtualised.

Can a RabbitMQ cluster run across availability zones?

Yes, and it should, within one region. Across regions, no: inter-node distribution assumes low latency, and WAN jitter becomes partitions. Use one cluster per region with federation or shovel between them.

RabbitMQ services

Where this gets done

More resources

Other RabbitMQ guides, comparisons and research

From the blog

Recent RabbitMQ articles

Next step

Need this done on your cluster?

AceMQ's senior RabbitMQ engineers support 130+ enterprise clients in 26+ countries under a 15-minute emergency SLA, with direct escalation to the RabbitMQ core team.