Get the latest tech news

JVM statistics cause garbage collection pauses (2015)


TL;DR: The JVM by default exports statistics by mmap-ing a file in /tmp (hsperfdata). On Linux, modifying a memory mapped file can block until disk I/O completes, which can be hundreds of milliseconds.

On Linux, modifying a memory mapped file can block until disk I/O completes, which can be hundreds of milliseconds. Since the JVM modifies these statistics during garbage collection and safepoints, this causes pauses that are hundreds of milliseconds long. The only workaround I've found is to place the mmap-ed file in tmpfs (a RAM disk), or disable it completely.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of garbage collection

garbage collection

Photo of JVM statistics

JVM statistics

Photo of pauses

pauses

Related news:

News photo

Crafting Interpreters with Rust: On Garbage Collection

News photo

Tracing garbage collection for arenas