RFR: 8322043: HeapDumper should use parallel dump by default [v6]

Alex Menkov amenkov at openjdk.org
Thu May 2 21:24:58 UTC 2024


On Tue, 30 Apr 2024 18:54:09 GMT, Alex Menkov <amenkov at openjdk.org> wrote:

>> The fix makes VM heap dumping parallel by default.
>> `jcmd GC.heap_dump` and `jmap -dump` had parallel dumping by default, the fix affects `HotSpotDiagnosticMXBean.dumpHeap()`, `-XX:+HeapDumpBeforeFullGC`, `-XX:+HeapDumpAfterFullGC` and `-XX:+HeapDumpOnOutOfMemoryError`.
>> 
>> Testing:
>>   - manually tested different heap dump scenarios with `-Xlog:heapdump`;
>>   - tier1,tier2,hs-tier5-svc;
>>   - all reg.tests that use heap dump.
>
> Alex Menkov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   removed space-only change in diagnosticCommand.cpp

Currently heap dump is always performed in 2 phases (even if single threaded heap dump is requested or SerialGC is used). This is required to correctly handle unmounted virtual threads.
This was implemented in jdk22, so your testing shows regression comparing with jdk21u (which does not dump unmounted vthreads and references from them).
Note also that you use `-XX:+HeapDumpAfterFullGC` in your testing and look at total heap dump time.
Main advantage of the 2 phase dumping is decreasing STW time (merge phase is performed on the current thread outside of safepoint). I.e. the idea is not  to decrease total heap dump time, but to minimize JVM freeze during dumping.
But this does not work in case of -XX:+HeapDumpBeforeFullGC and -XX:+HeapDumpAfterFullGC because heap dumping is requested inside safepoint, so merge stage is also performed in safepoint too (I think it's possible to fix it so merge is performed on some other thread, but I'm not sure it worth it).

-------------

PR Comment: https://git.openjdk.org/jdk/pull/18748#issuecomment-2091683903


More information about the serviceability-dev mailing list