RabbitMQ: Troubleshooting high cpu usage in active and idle clusters.
search cancel

RabbitMQ: Troubleshooting high cpu usage in active and idle clusters.

book

Article ID: 406748

calendar_today

Updated On:

Products

Services Suite RabbitMQ

Issue/Introduction

This article describes common causes for high cpu usage and best practices to avoid them in both idle and active clusters.

Resolution

In an idle cluster:

 
An idle cluster, in this context, refers to one that is not actively serving client traffic.
 
Steps to troubleshoot this scenario have been described throughly in the cpu-idle-usage  and runtime thread-stats
sections of the documentation.
 
In addition, note that cpu usage will be impacted by queue and stream replicas, HTTP API requests, and host shovels and federation links even in idle clusters. 
 

In an active cluster:

Server:
 
Ensure that you are on a supported and recent version of RabbitMQ which has been optimized for cpu. 
 
Clients:  
 
Clients should be well-written, so as to avoid channel and/or connection churn. This can viewed be under Churn statistics in the overview dashboard. Also ensure that clients are not using basic.get which is a polling mechanism that has been recommended against and use basic.consume instead.
 
Queues:
 
A high queue churn caused by temporary queues can drive high cpu usage.  Do not use temporary queues, when a long-lived queue can better serve the use case. If you are still on Classic queues, switch to classic queue version 2.
 
Monitoring:
 
Follow best practices for monitoring frequency and avoid the use of excessive http api calls. 
 
Message size:
 
Size of the message should ideally be smaller.