RabbitMQ Checklist For Production Environments - A Complete Guide - CloudAMQP
RabbitMQ Checklist For Production Environments - A Complete Guide - CloudAMQP
Try LavinMQ ×
Learn how to avoid the most common setup errors and enjoy a more stable RabbitMQ
environment.
This is the checklist you should look at before (and refer to often) when you set up your RabbitMQ production environment. We have
included a rundown of the most common errors, tips and tricks to create the most stable environment possible.
Single node plans are the fastest, and all data written to disk is safe as long as you send persistent messages to durable queues. The
data on a single node setup is always consistent since no data needs to be written to another RabbitMQ server. More nodes in the
cluster give higher availability.
Keeping your cluster updated with the latest RabbitMQ and Erlang versions should be a high priority, in order to get access to all the
latest features. Not only do newer versions include bug fixes, give better performance, and improve the security of your data, you will
find that troubleshooting gets easier if you are using the most current and stable version.
CloudAMQP´s default version is the latest recommended version by CloudAMQP.
By using environment variables you only need to change credentials in one place in case you need to change the server. It also prevents
you from adding sensitive data to your source code, so you don’t run the risk of commiting the connection string to a repository that
may be public.
On CloudAMQP: Use the cluster hostname when connecting your clients. Do not use the IP address of the server when connecting, as
that might change.
9. Secure connections
TLS encrypts connection traffic and also provides a way to verify (authenticate) peers. These tasks are accomplished using a set of
policies and procedures based on digital identities. RabbitMQ nodes with TLS enabled must have a set of certificates it trusts in a file
and a private key file. For security, it is a best practice to use TLS for all connections made over the public internet. For most AMQP
clients it is as simple as replacing amqp:// with amqps://.
10. Separate connections for publishers and consumers
If you use the same connection for publishers and consumers you won't be able to consume if the connection is in flow control, which
will worsen the flow problem. RabbitMQ can apply back pressure on the TCP connection when the publisher is sending too many
messages for the server to handle. If you consume on the same TCP connection, the server might not receive the message
acknowledgments from the client, thus affecting the consume performance. With a lower consumer speed, the server will be
overwhelmed.
Set a TTL policy in the queue; e.g. a TTL policy of 28 days deletes queues that haven't been consumed from for 28 days.
An auto-delete queue is deleted when its last consumer has canceled or when the channel/connection is closed (or when it has
lost the TCP connection with the server).
An exclusive queue can only be used (consumed from, purged, deleted, etc.) by its declaring connection. Exclusive queues are
deleted when their declaring connection is closed or gone (e.g., due to underlying TCP connection loss).
Limits are a broad topic, so we are right now creating an entire blog dedicated to it, coming soon!
15. Don’t open and close connections or channels repeatedly.
Just like opening and closing the refrigerator door repeatedly, opening and closing connections and channels in RabbitMQ wastes
energy! Avoid opening and closing connections, as it requires more TCP packages to be sent and received, giving higher latency rates.
A consuming application that receives important messages should not acknowledge messages until it has finished with them so that
unprocessed messages (worker crashes, exceptions, etc.) don't go missing. Publish confirm is the same concept for publishing. The
server acks when it has received a message from a publisher. Publish confirm also has a performance impact, however, keep in mind that
it’s required if the publisher needs at-least-once processing of messages.
Queue alarms: Queue alarms can be triggered to send notifications when a number of messages in a queue reaches a certain threshold
for a given amount of time.
Metric alarms: It is possible to receive accurate alerts based on performance anomalies in your application by activating different metric
alarms. Make sure that you activate alarms for CPU, disk space, and memory.
Connection and channel alarms: Connection leaks can cause RabbitMQ to run out of memory. Make sure your clients are not leaking
connections. If you have more than 10 connections from the same host, you may have a connection leak. This is normal if you deploy
many clients on the same IP.
Consumer alarms: Consumer alarms can be triggered to send notifications when the number of consumers for a queue is less than or
equal to a given number of consumers, for a given amount of time.
20. CloudAMQP Specific: Export metrics and logs
You can export your CloudAMQP messages to other monitoring tools like CloudWatch, Datadog, Newrelic, Stackdriver, Librato,
Papertrail, Loggly and Splunk.
0 Comments
1 Login
Name
LOVISA JOHANSSON
CloudAMQP team
FREE EBOOK
"The Optimal
RabbitMQ Guide"
Download