JEP 522 performance regression with large pages

Brian S O'Neill bronee at gmail.com
Thu Aug 28 21:49:54 UTC 2025


Okay...

sysctl -w vm.nr_hugepages=2048

java -XX:+UseG1GC --enable-native-access=ALL-UNNAMED --add-exports 
java.base/jdk.internal.misc=ALL-UNNAMED 
--enable-native-access=ALL-UNNAMED --add-opens 
java.base/jdk.internal.misc=ALL-UNNAMED -Xms3g -Xmx3g -XX:+UseLargePages 
-XX:-UseTransparentHugePages <main class>

G1GC:         234.7 seconds
G1GC JEP 522: 230.7 seconds

So, it seems that regression is with THP.

On 2025-08-28 01:59 PM, Thomas Schatzl wrote:
> Hi Brian,
> 
> On 28.08.25 16:42, Brian S O'Neill wrote:
>  > I'm experimenting with the changes in PR 23739 (8342382: Implement JEP
>  > 522: G1 GC: Improve Throughput by Reducing Synchronization) and I'm
>  > seeing a small performance regression when large pages are configured.
>  >
> 
>    thanks for giving the change a spin.
> 
>  > The test is fairly complicated, and most of the memory it uses is off
>  > heap. The GC heap size is set to 3GB (min and max), which is much
>  > larger than is actually required. A bunch of objects are allocated up
>  > front and remain in the old gen for the duration of the test run.
>  > Between each GC cycle, almost all the old gen objects will have been
>  > updated to reference a young object. The young gen objects live for
>  > about 2 microseconds, and the references from the old gen objects are
>  > cleared.
>  >
>  > Here's the baseline results when running with "normal" pages:
>  >
>  > ParallelGC:   235.6 seconds
>  > G1GC JEP 522: 238.7 seconds
>  > G1GC:         241.5 seconds
>  > ZGC:          246.2 seconds
>  >
>  > With JEP 522, there's a small performance improvement, about 1%, which
>  > is nice to see. Here's the results when running with large pages (-XX:
>  > +UseLargePages -XX:+UseTransparentHugePages shmem_enabled is advise):
> 
> Just to make sure it's not THP: can you also try with pre-allocated 
> large pages?
> 
> E.g. via
> sysctl -w vm.nr_hugepages=<nr>
> 
> and
> 
> -XX:-UseTransparentHugePages?
> 
>  >
>  > ParallelGC:   228.9 seconds
>  > G1GC:         235.1 seconds
>  > ZGC:          239.3 seconds
>  > G1GC JEP 522: 239.7 seconds
>  >
>  > All of the GCs show a performance improvement when using large pages,
>  > but with JEP 522, G1 is slower than the current version (JDK 24).
>  >
>  > I don't know why there's a performance regression. Is this to be
>  > expected with large pages, or is there a missing configuration
>  > somewhere? I'm not configuring anything other than -Xms, -Xmx, and the
>  > large page settings. Also note that the test is run ten times (without
> 
> Can you give the full command line?
> 
>  > restarting the JVM) and the average time is reported.
>  >
> 
> No, we are not aware of such a regression. We do run benchmarks with 
> large pages regularly, although not so often with THP but pre-allocated 
> ones.
> 
> Thanks,
>    Thomas



More information about the hotspot-gc-dev mailing list