[ACCEPTED]-Reduce RabbitMQ memory usage-rabbitmq

Accepted answer
Score: 10

The appropriate way to limit memory usage 18 in RabbitMQ is using the vm_memory_high_watermark. You said:

I've 17 also tried setting the vm_memory_high_watermark 16 to a few different values below the default 15 (of 40%), even as low as 5%.

This should work, but 14 it might not be behaving the way you expect. In 13 the logs, you'll find a line that tells 12 you what the absolute memory limit is, something 11 like this:

=INFO REPORT==== 29-Oct-2009::15:43:27 ===
Memory limit set to 2048MB.

You need to tweak the memory limit 10 as needed - Rabbit might be seeing your 9 system as having a lot more RAM than you 8 think it has if you're running on a VPS 7 environment.

Sometimes, Rabbit can't tell 6 what system you're on and uses 1GB as the 5 base point (so you get a limit of 410MB 4 by default).

Also, make sure you are running 3 on a version of RabbitMQ that supports the 2 vm_memory_high_watermark setting - ideally you should run with the 1 latest stable release.

Score: 1

Make sure to set an appropriate QoS prefetch 18 value. By default, if there's a client, the 17 Rabbit server will send any messages it 16 has for that client's queue to the client. This 15 results in extensive memory usage both on 14 the client & the server.

Drop the prefetch 13 limit down to something reasonable, like 12 say 100, and Rabbit will keep the remaining 11 messages on disk on the server until the 10 client is really ready to process them, and 9 your memory usage will go way way down on 8 both the client & the server.

Note that 7 the suggestion of 100 is just a reasonable 6 place to start - it sure beats infinity. To 5 really optimize that number, you'll want 4 to take into consideration the messages/sec 3 your client is able to process, the latency 2 of your network, and also how large each 1 of your messages is on average.

More Related questions