Lesson 8 of 9 · 24m
Backpressure, Alarms, Flow Control, and Observability
Operate RabbitMQ with memory and disk alarms, connection flow control, queue metrics, consumer lag, and alerts that map to action.
RabbitMQ rarely fails all at once. It degrades in layers: consumers slow down, unacknowledged messages grow, memory use climbs, publishers block, disk alarms trigger, and then everyone notices the queue at the same time. Good operations mean watching the pressure gradients before the broker has to protect itself. The broker's job is to survive; your job is to notice why survival mode was needed.
Know the broker's defensive controls
RabbitMQ uses memory and disk alarms to protect nodes. When memory pressure crosses the high-watermark, publishers can be blocked through flow control. Connections may enter a blocked state. This is not arbitrary punishment; it is backpressure. The alternative is the node falling over and making everything worse.
Check the basics:
rabbitmqctl status
rabbitmqctl list_connections name state host peer_host channels
rabbitmqctl list_queues name messages messages_ready messages_unacknowledged consumers memory disk_reads disk_writesThe important interpretation is whether pressure is caused by publishing, consuming, replication, or long-lived queue state.
Queue metrics must be read together
messages_ready means waiting for delivery. messages_unacknowledged means delivered but not completed. A queue can look almost empty while workers hold thousands of unacknowledged messages because prefetch is too high or processing is stuck.
Use a small mental table:
ready high, unacked low consumers absent or too slow
ready low, unacked high consumers holding work, stuck or over-prefetched
ready and unacked high broad overload or downstream dependency failure
consumers zero application outage, credential failure, or deployment problem
memory high, messages low large messages, long index state, or many queues/connectionsNever alert on total messages alone. Ten thousand tiny telemetry messages may be fine; ten thousand large invoice rendering jobs may be a fire.
Watch consumers as first-class capacity
A consumer count is not enough. Measure processing latency, error rate, redelivery rate, and downstream dependency health. RabbitMQ knows deliveries; only the application knows business latency. The shortest useful dashboard has broker metrics and worker metrics side by side:
queue ready depth
unacknowledged depth
publish rate
confirm latency
consumer processing duration
consumer error and redelivery rate
dead-letter queue depth
node memory/disk alarm stateRabbitMQ's Prometheus endpoint commonly listens on port 15692 when the plugin is enabled:
rabbitmq-plugins enable rabbitmq_prometheus
curl -s http://127.0.0.1:15692/metrics | grep rabbitmq_queue_messages_readyConnection churn is a hidden tax
Applications should reuse connections and channels according to client-library threading rules. Opening a connection per message creates TCP/TLS churn, authentication load, channel churn, and noisy failure modes. During incidents, connection storms can look like broker instability when the actual issue is application retry behavior.
Alerts should tell operators what to do
A good alert says orders.invoice DLQ depth > 0 for 10 minutes or orders.invoice consumers = 0, not messages != 0. Include runbook ownership. If an alert cannot produce an action, it is a chart wearing a pager.
Field notes
- Large messages distort memory and network assumptions; store large payloads elsewhere and send references when possible.
- Disk alarms can be caused by other tenants or processes on the same volume, not only RabbitMQ data.
- Management UI depth graphs are useful, but Prometheus series are what you want during retrospective analysis.
- Backpressure is often the system working correctly. Treat it as a signal to fix capacity or consumption, not a switch to disable.
Was this lesson helpful?