RabbitMQ & AMQP (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)
What is RabbitMQ Flow Control and Memory/Disk Alarms?
senior LevelSystem DesignRabbitMQMicroservices
In Simple Words: If producers publish messages faster than consumers can process them, or if consumers disconnect, broker RAM and disk usage will skyrocket. To prevent out-of-memory kernel crashes:
- Memory High Watermark Alarm (
vm_memory_high_watermark):- Defaults to 40% of available RAM.
- When exceeded, RabbitMQ blocks all incoming connections from publishing (puts them in a TCP freeze).
- Disk Free Space Alarm (
disk_free_limit):- When free disk space falls below the limit (default 50MB), publishing is blocked cluster-wide until disk space is freed.
- Once memory/disk levels normalize, publishers are automatically unblocked.