RFR: 8319650: Improve heap dump performance with class metadata caching [v5]
Aleksey Shipilev
shade at openjdk.org
Fri Nov 10 11:05:00 UTC 2023
On Thu, 9 Nov 2023 15:34:21 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> See the rationale and some profiles in the bug.
>>
>> This PR implements simple caching for object instance dumping, which is overwhelmingly hottest path in heap dumping code. This allows to put the cache straight in `HeapObjectDumper`, which is effectively thread local. A simple hash table would then work to cache the class metadata.
>>
>> Given a simple workload from the bug, these are the motivational improvements and historical perspective:
>>
>>
>> $ for I in `seq 1 3`; do java -XX:+UseParallelGC -XX:+HeapDumpAfterFullGC -Xms8g -Xmx8g HeapDump.java 2>&1 | grep created; rm *.hprof; done
>>
>> # Baseline JDK 8u382
>> Heap dump file created [1440865228 bytes in 5.492 secs]
>> Heap dump file created [1440865228 bytes in 5.460 secs]
>> Heap dump file created [1440865228 bytes in 5.471 secs]
>>
>> # Baseline JDK 11.0.21
>> Heap dump file created [1446043070 bytes in 5.088 secs]
>> Heap dump file created [1446042039 bytes in 5.096 secs]
>> Heap dump file created [1446042835 bytes in 5.081 secs]
>>
>> # Baseline JDK 17.0.10
>> Heap dump file created [1446841531 bytes in 3.276 secs]
>> Heap dump file created [1446841673 bytes in 3.342 secs]
>> Heap dump file created [1446841590 bytes in 3.323 secs]
>>
>> # Baseline JDK 21.0.2 EA
>> Heap dump file created [1447828697 bytes in 5.516 secs]
>> Heap dump file created [1447829756 bytes in 5.461 secs]
>> Heap dump file created [1447829539 bytes in 5.435 secs]
>>
>> # Baseline JDK 22
>> Heap dump file created [1447285149 bytes in 5.232 secs]
>> Heap dump file created [1447285149 bytes in 5.211 secs]
>> Heap dump file created [1447284813 bytes in 5.222 secs]
>>
>> # Patched JDK 22
>> Heap dump file created [1447285087 bytes in 1.071 secs]
>> Heap dump file created [1447285149 bytes in 1.073 secs]
>> Heap dump file created [1447285073 bytes in 1.058 secs]
>>
>>
>> This amounts to 5x improvement, 1.2 GB/sec dump rate (somewhat I/O limited), and the best heap dump performance across all JDK releases. I am planning to backport this patch where possible: at least to JDK 21u, but hopefully to JDK 17u as well.
>>
>> There are other simple improvements, but this one is the top bottleneck.
>
> Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:
>
> Drop StackObj
If there are no other comments, I would like to integrate it soon. Thank you all!
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16545#issuecomment-1805517631
More information about the hotspot-runtime-dev
mailing list