Opening a connection per message repeats TCP and authentication work while consuming CPU, memory, file descriptors, Erlang processes, and ephemeral ports.
Resource exhaustion first slows connection setup and then causes connection failures.
Reuse bounded long-lived publisher and consumer connections, keeping producer throttling separate from consumer acknowledgements.
Channels
Leaked channels consume broker processes and memory; exceeding negotiated channel_max closes the connection and all its channels.
Default is 2,047; the configuration below sets an explicit limit of 128 per connection.
channel_max = 128
Heartbeats
Use a negotiated 5–20 second timeout on stable networks; the example below uses 15 seconds.