RabbitMQ Memory Usage
Asked Answered
M

3

8

I'm currently using the RabbitMQ (3.6.2-1) on Ubuntu(16.04) in production. Producers publish messages and consumers consume messages and everything works correctly but sometimes RabbitMQ doesn't release memory and it touchs max memory and producers can not publish message into empty queues so I have to restart the service.

It's a bug or something else?

enter image description here

Update :

It is from the management plugin, so you can solve this issue by one of these solutions :

1.Update your RabbitMQ version (3.6.15 is stable)

2.Restarting statistics database periodically (in crontab hourly) https://www.rabbitmq.com/management.html#stats-db

3.set rates_mode to none in your rabbitmq.config file (it's not a good idea because in this case you can not see message rates)

Monaural answered 26/10, 2018 at 11:17 Comment(2)
How many queues, consumers, connections in your RabbitMQ server?Loafer
I have 10 queues , 60 connections and 20 channelsMonaural
L
2

You should check the number of the messages you have inside you queues.

RabbitMQ by default keeps the messages in memory to be fast.

if you have to handle lot of messages you can use the lazy queue: https://www.rabbitmq.com/lazy-queues.html With lazy queue you can handle milions of messages wihtout impact too much the node memory.

Or it could be a mamagement memory problem, see: http://rabbitmq.com/management.html#stats-db in your canse you can run:

rabbitmqctl eval 'supervisor2:terminate_child(rabbit_mgmt_sup_sup, rabbit_mgmt_sup), rabbit_mgmt_sup_sup:start_child().' to reset the stats and free the memory. You could call it periodically

Note:

There are different ways to reset the stats, it depends from the rabbitmq version, here all the detail

Lolly answered 26/10, 2018 at 16:7 Comment(4)
Try to reset the stats DB rabbitmqctl eval 'supervisor2:terminate_child(rabbit_mgmt_sup_sup, rabbit_mgmt_sup), rabbit_mgmt_sup_sup:start_child().'Lolly
here for more detail: rabbitmq.com/management.html#stats-dbLolly
yes it work in runtime! , it might be from the management plugin. I should change rates_mode to none.Monaural
@Milad updated the answer for future readers. you don't need to change the rates_mode, just call the reset periodically. BTW I suggest to update the version, you are using a bit old versionLolly
A
0

This answer is definitely won't help with an original problem, but could be useful for those who, like me, face the memory consumption issue nowadays (Rabbit MQ version 3.9.16). Logging to a file using info level in rabbitmq.conf:

log.file.level = info

Without re-using this log file (i.e. limiting it's size), also leads to ever-growing memory consumption (that's apart from disk usage and to a greater scale). This is solved by limiting the size of this file to ~10 Mb for instance. The more you decrease the file size, the greater the effect should be. Also in rabbitmq.conf:

log.file.rotation.size = 10485760
Apeldoorn answered 4/3 at 12:52 Comment(0)
H
0

Resolve this by flowing approach:

  1. Stop and Remove that specific node from cluster
  2. Check if all other cluster nodes are stabilized
  3. Start RabbitMQ and join node to cluster
  4. Commands came be found using ranbitmqctl help command in terminal
Haematinic answered 24/7 at 2:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.