We have a java 17 application which run with theses options:
-Xmx100g
-XX:+UseZGC
When running it, these gc warnings appear:
[warning][gc]
***** WARNING! INCORRECT SYSTEM CONFIGURATION DETECTED! *****
The system limit on number of memory mappings per process might be too low for the given
max Java heap size (102400M). Please adjust /proc/sys/vm/max_map_count to allow for at
least 184320 mappings (current limit is 65530). Continuing execution with the current
limit could lead to a premature OutOfMemoryError being thrown, due to failure to map memory.
And after a few hours, by increasing heap usage (about ~ 60gb
), application encountered OOM and crashed.
Based on the above warning: 184320 = 1.8 * 102400
; Also i'v tried other Xmx
values, the formula is:
vm.max_map_count = 1.8 * xmx_in_mb
My questions:
- What is the relation of
ZGC
andvm.max_map_count
? I can't find any official documentation about it! - Is it safe to use the above formula?