RFR: 8374045: Add support to run benchmarking with fragmented CodeCache [v2]

Chad Rakoczy duke at openjdk.org
Tue Feb 17 23:01:12 UTC 2026


On Tue, 17 Feb 2026 22:43:47 GMT, Chad Rakoczy <duke at openjdk.org> wrote:

>> [JDK-8374045](https://bugs.openjdk.org/browse/JDK-8374045)
>> 
>> This PR adds a new utility tool CodeCacheFragmenter to help with testing HotSpot code cache fragmentation scenarios. The tool is a Java agent that uses the WhiteBox API to create and randomly free dummy code blobs in the NonProfiled code heap to achieve a specified fill percentage. It includes configurable parameters for blob sizes, target fill percentage (0-100%), and random seeding to enable reproducible fragmentation patterns. The utility is built via a standard Makefile and produces `codecachefragmenter.jar` which can be used as a Java agent with `-javaagent` flag. This tool is intended for performance testing and experimentation with code cache behavior under various fragmentation conditions. The distribution of blob sizes aims to represent real world nmethod sizes which are based on sizes from running Renaissance benchmarks.
>> 
>> This is useful to show the performance benefits of [JDK-8326205](https://bugs.openjdk.org/browse/JDK-8326205)
>> 
>> Distribution of nmethod size from Renaissance benchmarks:
>> <img width="3570" height="1766" alt="renaissance_dis" src="https://github.com/user-attachments/assets/cde9645a-38d3-4506-811f-646ced78715a" />
>> 
>> Distribution of dummy blob size from CodeCacheFragmenter:
>> <img width="3570" height="1766" alt="frag_new_dis" src="https://github.com/user-attachments/assets/2c61cc0d-20a8-4ae0-af42-8cfc98271217" />
>
> Chad Rakoczy has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update rng

Update random number generation for blob size to be more representative of real world workloads.

Renaissance benchmarks:
<img width="3570" height="1766" alt="renaissance_dis" src="https://github.com/user-attachments/assets/92530794-725a-4b4a-b3cc-0c7c7d282bfb" />

Old:
<img width="3570" height="1766" alt="frag_old_dis" src="https://github.com/user-attachments/assets/fcc2b776-9364-4ed7-b6c5-3c5331a2689a" />

New:
<img width="3570" height="1766" alt="frag_new_dis" src="https://github.com/user-attachments/assets/a4a35cd2-22e7-4897-96b1-5fb15020fa01" />

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

PR Comment: https://git.openjdk.org/jdk/pull/28934#issuecomment-3917507712


More information about the compiler-dev mailing list