1
0
Files
zgc-jdk25-benchmarks/results/05-pages-zgc.txt
Ankur e189da79ba Generational ZGC vs G1 on JDK 25: benchmarks, internals and captured results
Complete companion suite for the ankurm.com guide. Everything was compiled and
executed on java 25.0.3+9-LTS-195 (AMD Ryzen 5 5600U, Windows 11); every file
under results/ is unedited program output.

Code
  latency/    open-loop latency harness that measures from intended arrival, so
              coordinated omission is accounted for rather than hidden. Reports
              response time and service time side by side; the gap reached 2910x
              on G1.
  jmh/        four microbenchmarks isolating one mechanism each: TLAB allocation,
              the ZGC load barrier (with a primitive-load control), the write
              barrier (with null / old-to-old / primitive controls), and promotion
              pressure.
  tuning/     provokes ZGC allocation stalls and reads its own JFR recording back,
              grouped by page class. jdk.ZAllocationStall is enabled without a
              threshold, because the 10 ms default hides most stalls.
  internals/  ZGC page classes vs G1 humongous, read from the live VM via
              HotSpotDiagnosticMXBean and jdk.ZPageAllocation events.
  analysis/   unified GC log parser that keeps stop-the-world pauses and
              concurrent phases in separate buckets.
  env/        environment capture; proves generational mode from JMX bean names.

Docs
  Eight chapters covering the JEP 439/474/490 timeline, colored pointers and both
  barriers, allocation stalls, a full flag reference, logging and JFR, benchmark
  methodology, corner cases, and a decision procedure.

Headline result (60 s, 20k req/s, 2 GB heap, ~585 MB live)
  p50               ZGC 0.006 ms   G1 0.005 ms
  p99.9             ZGC 1.437 ms   G1 95.169 ms
  total STW time    ZGC 1.503 ms   G1 1,139.624 ms
2026-07-31 08:47:16 +05:30

34 lines
1.6 KiB
Plaintext

==========================================================================
Page / region geometry as reported by THIS JVM
==========================================================================
max heap : 2,048 MB
UseG1GC / UseZGC : false / true
G1HeapRegionSize : 0 (ergonomic / not applicable)
=> ZGC small pages are 2 MB; objects up to 1/8 of a page (256 KB) use them.
Larger objects use a medium page, and anything bigger gets a Large page
of its own -- which ZGC frees rather than relocates.
ZGC internals flags visible in this JVM
ZFragmentationLimit = 5.0
ZCollectionIntervalMinor = -1.0
ZCollectionIntervalMajor = -1.0
ZAllocationSpikeTolerance = 2.0
ZUncommit = false
ZUncommitDelay = 300
SoftMaxHeapSize = 2,147,483,648 bytes (2048 MB)
ZGC pages actually allocated while creating the objects above
page type count total bytes
Large 2 25,165,824
Medium 1 33,554,432
Objects allocated in this run
65,536 bytes (64 KB) expect ZGC Small page (2 MB, shared with other objects)
262,144 bytes (256 KB) expect ZGC Medium page (shared; size is a range in JDK 25)
524,288 bytes (512 KB) expect ZGC Medium page (shared; size is a range in JDK 25)
2,097,152 bytes (2 MB) expect ZGC Medium page (shared; size is a range in JDK 25)
4,194,304 bytes (4 MB) expect ZGC Large page -- one page for this object, freed not relocated
16,777,216 bytes (16 MB) expect ZGC Large page -- one page for this object, freed not relocated
checksum: 6