diff --git a/rabbitmq/content.md b/rabbitmq/content.md index 780b5350bc5a..f1d5702ee0e9 100644 --- a/rabbitmq/content.md +++ b/rabbitmq/content.md @@ -29,6 +29,21 @@ If you give that a minute, then do `docker logs some-rabbit`, you'll see in the Note the `database dir` there, especially that it has my "Node Name" appended to the end for the file storage. This image makes all of `/var/lib/rabbitmq` a volume by default. +### Memory Limits + +RabbitMQ contains functionality which explicitly tracks and manages memory usage, and thus needs to be made aware of cgroup-imposed limits. + +The upstream configuration setting for this is `vm_memory_high_watermark`, and it is described under ["Memory Alarms"](https://www.rabbitmq.com/memory.html) in the documentation. + +In this image, this value is set via `RABBITMQ_VM_MEMORY_HIGH_WATERMARK`. The value of this environment variable is interpreted as follows: + +- `0.49` is treated as `49%`, just like upstream (`{ vm_memory_high_watermark, 0.49 }`) +- `56%` is treated as `56%` (`0.56`; `{ vm_memory_high_watermark, 0.56 }`) +- `1073741824` is treated as an absolute number of bytes (`{ vm_memory_high_watermark, { absolute, 1073741824 } }`) +- `1024MiB` is treated as an absolute number of bytes with a unit (`{ vm_memory_high_watermark, { absolute, "1024MiB" } }`) + +The main behavioral difference is in how percentages are handled. If the current container has a memory limit (`--memory`/`-m`), a percentage value will be calculated to an absolute byte value based on the memory limit, rather than being passed to RabbitMQ as-is. For example, a container run with `--memory 2048m` (and the implied upstream-default `RABBITMQ_VM_MEMORY_HIGH_WATERMARK` of `40%`) will set the effective limit to `819MB` (which is `40%` of `2048MB`). + ### Erlang Cookie See the [RabbitMQ "Clustering Guide"](https://www.rabbitmq.com/clustering.html#erlang-cookie) for more information about cookies and why they're necessary.