The configurations available are:
- prometheus.return_per_object_metrics
- heartbeat
- channel_max
- consumer_timeout
- vm_memory_high_watermark
- queue_index_embed_msgs_below
What do the configurations do and why change them?
Prometheus return per object metrics
The built-in plugin for Prometheus was introduced in RabbitMQ version 3.8.0 and is used for metrics collection.
When the plugin is enabled it exposes RabbitMQ metrics via the /metrics endpoint, for example,
https://[HOST]/metrics
The metrics exposed can be aggregated or per object:
Heartbeat
The heartbeat value defines the time a connection should be considered unreachable if no heartbeat is received. This value is defined in seconds with a default value of 120 and can be configured in clients and by RabbitMQ. The value is negotiated between the client and RabbitMQ server when connecting. All CloudAMQP servers implement sensible TCP keepalive, which is on the TCP/kernel level instead of on the protocol level, therefore we recommend turning heartbeat off by setting this value to 0. You also have to set it to 0 in the client for it to be disabled.
Channel max
The channel max value is the maximum number of channels that can be open on a connection simultaneously.
It is negotiated by client and server upon connection, with the lower value of the two used.
However, the client cannot allow for more channels than the server configuration.
In general, you should establish one connection per process with a dedicated channel given to each new thread.
Setting
channel_max
to 0 means unlimited channels, but be aware that this could be a dangerous move since applications sometimes have channel leaks.
Consumer timeout
The consumer timeout configuration was introduced in RabbitMQ version 3.8.15 to help detect consumers that are stuck and never acknowledge deliveries. Having a stuck consumer can affect the performance and impact the server resources, such as the disk. If a consumer is unable to send an acknowledgment within the timeout value, its channel will be closed. This value is set in milliseconds and can be set from 10,000 to 25000000.
Memory high watermark
The memory high watermark configuration defines the threshold for when a memory alarm will be raised by RabbitMQ. When a memory alarm is triggered, RabbitMQ will block all connections that are publishing messages. When the memory alarm is resolved, publishing resumes. The default value is set to 0.81 which means that 81% of the available memory can be used before a memory alarm is triggered. This value can be set to a minimum of 0.4 (40%) and a maximum of 0.9 (90%).
Queue index embed msgs below
Very small messages can be kept in the queue index as an optimization instead of being written to the message store.
The config
queue_index_embed_msgs_below
controls the message size for keeping messages in the queue index. The default value is 4096 bytes including properties and headers. Increase this value with caution as it can lead to more memory usage.
We hope you liked this blog post. Please comment below if you have any questions or if you wish us to change other configurations, send us an email to support@cloudamqp.com
All the best, The CloudAMQP team