'Insufficient Memory' errors when running Confluence in a virtualized environment
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
When running Confluence, we can see some (or all) of the following symptoms:
- Confluence fails to start sometimes
- Slow performance
- Memory is allocated at a fast rate
- Long Garbage Collection times
Environment
The issue described on article only applies to Confluence when running on a virtual machine such as VMWare.
Diagnosis
When checking the Confluence logs, an error similar to the following can be found:
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x000000079e000000, 4194304, 0) failed; error='Not enough space' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 4194304 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /app/atlassian/confluence/bin/hs_err_pid11193.log
This error may also be displayed on the terminal, when stopping Confluence manually.
Cause
Memory Reservation is not enabled for the VM, which may prevent Confluence from getting sufficient memory allocated to it in a timely manner.
Solution
Memory Reservation
Enable Memory Reservation for the VM.
Increase Max Map
If unable to work with memory reservation, see if the OS is configured to allow sufficient memory for the JVM to work.
On some Linux distros, this is:
cat /proc/sys/vm/max_map_count
Increase it to the amount of Heap + threshold. Some customers go to 1.5 the Heap size configured to the JVM (Xmx Java opt).
On some distros, this is achieved through (replace 99999 by the amount of memory, like 1.5 the Xmx):
sysctl -w vm.max_map_count=99999
Workaround
Setting Confluence's base and maximum heap size (eg. Xmx and Xms) to the same memory value can also help with this issue: