RabbitMQ & AMQP (50 Qs)•Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)
Connection and Channel Management at Scale: Diagnosing Channel Leaks and Churn.
senior LevelSystem DesignGolang
In Simple Words:
- Channel Leak Anti-Pattern: An application creates a new channel for every single incoming HTTP request and forgets to call
channel.close(). Within hours, RabbitMQ hits Erlang process limits (max_processes = 1048576) and crashes! - Mitigation:
- Enforce channel limits per connection (
channel_max = 2047). - Use a Channel Pool or maintain one dedicated channel per thread.
- Monitor channel churn in Prometheus:
rabbitmq_channels_opened_totalvsrabbitmq_channels_closed_total.
- Enforce channel limits per connection (