Skip to content

Commit 40b8122

Browse files
authored
Merge pull request #879 from infosiftr/rabbitmq-memory
Add a section about RABBITMQ_VM_MEMORY_HIGH_WATERMARK
2 parents 98e13cb + 844ae89 commit 40b8122

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

rabbitmq/content.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,21 @@ If you give that a minute, then do `docker logs some-rabbit`, you'll see in the
2929

3030
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.
3131

32+
### Memory Limits
33+
34+
RabbitMQ contains functionality which explicitly tracks and manages memory usage, and thus needs to be made aware of cgroup-imposed limits.
35+
36+
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.
37+
38+
In this image, this value is set via `RABBITMQ_VM_MEMORY_HIGH_WATERMARK`. The value of this environment variable is interpreted as follows:
39+
40+
- `0.49` is treated as `49%`, just like upstream (`{ vm_memory_high_watermark, 0.49 }`)
41+
- `56%` is treated as `56%` (`0.56`; `{ vm_memory_high_watermark, 0.56 }`)
42+
- `1073741824` is treated as an absolute number of bytes (`{ vm_memory_high_watermark, { absolute, 1073741824 } }`)
43+
- `1024MiB` is treated as an absolute number of bytes with a unit (`{ vm_memory_high_watermark, { absolute, "1024MiB" } }`)
44+
45+
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`).
46+
3247
### Erlang Cookie
3348

3449
See the [RabbitMQ "Clustering Guide"](https://www.rabbitmq.com/clustering.html#erlang-cookie) for more information about cookies and why they're necessary.

0 commit comments

Comments
 (0)