JVM statistics cause garbage collection pauses (2015)

TL;DR: The JVM exports statistics in a memory-mapped file in /tmp, causing long pauses during garbage collection on Linux due to blocking disk writes. Adding -XX:+PerfDisableSharedMem JVM flag can reduce pause latency, although it breaks tools like jstat. The root cause is rare blocking of memory writes due to Linux kernel behavior. A workaround is to use a RAM disk or disable the feature. This discovery has led to reduced JVM pause latency at Twitter. Symptoms include longer real time than CPU time during garbage collection. Reproducing pauses involves measuring write times to an mmaped file under heavy disk writes. Related issues include buffered writes causing stalls and optimizing Linux memory management.

https://www.evanjones.ca/jvm-mmap-pause.html

To top