NMT Overhead: Summary vs. Detail Performance Impact
Native Memory Tracking (NMT) has different performance implications based on its mode: `off` has no overhead, `summary` offers low overhead by tracking bytes per category, while `detail` provides call site information but can introduce a 5-10% JVM performance drop and add 16 bytes per malloc.
The top 3
- NMT's Performance Hit: Summary vs. Detail Percentages: Enabling Native Memory Tracking (NMT) can cause a 5-10% JVM performance drop, with this range more accurately reflecting the higher overhead of 'detail' mode due to call stack capture. 'Summary' mode generally incurs a smaller overhead, primarily adding 16 bytes (two machine words) to each `malloc` operation for basic tracking.
- Production Use: When to Deploy NMT Summary vs. Detail: For continuous monitoring in production, NMT's 'summary' mode is generally considered safe if no significant performance degradation is observed, providing a high-level overview of native memory usage. The more intrusive 'detail' mode, with its higher 5-10% performance impact due to capturing full call stacks, is typically recommended only for short-term, targeted diagnostics of specific memory leak issues.
- Mechanism of Overhead: Atomic Counters vs. Call Stacks: NMT's 'summary' mode overhead primarily comes from atomically incrementing/decrementing counters for memory categories and adding a 16-byte header to each `malloc` request. 'Detail' mode significantly increases CPU and memory consumption by additionally capturing and processing full call stacks for every native allocation, which involves hash map lookups and storage.
Open the full topic