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
This commit is contained in:
41
results/04-stalls-zgc-softmax.txt
Normal file
41
results/04-stalls-zgc-softmax.txt
Normal file
@@ -0,0 +1,41 @@
|
||||
max heap : 512 MB
|
||||
target live set : 281 MB (55% of heap)
|
||||
threads : 12, duration: 20 s
|
||||
|
||||
filling live set ...
|
||||
live set filled: 4,505 chunks x 64 KB
|
||||
now allocating hard for 20 s -- expect stalls
|
||||
|
||||
allocation phase done
|
||||
|
||||
========================================================================
|
||||
JFR summary (C:\Users\Ankur\allocation-stalls.jfr)
|
||||
========================================================================
|
||||
young collections : 1,778
|
||||
old collections : 217
|
||||
page allocations : 39,685
|
||||
ALLOCATION STALLS : 31,967
|
||||
|
||||
total time threads spent stalled : 138,521 ms
|
||||
mean stall : 4.33 ms
|
||||
longest stall : 51.41 ms
|
||||
|
||||
stalls by ZGC page type
|
||||
Small count=31,967 total=138,521 ms mean=4.33 ms
|
||||
|
||||
ten longest stalls
|
||||
duration page size thread
|
||||
51.41 ms Small 2097152 allocator-10
|
||||
50.18 ms Small 2097152 allocator-0
|
||||
48.12 ms Small 2097152 allocator-5
|
||||
47.93 ms Small 2097152 allocator-1
|
||||
46.90 ms Small 2097152 allocator-1
|
||||
46.14 ms Small 2097152 allocator-11
|
||||
46.14 ms Small 2097152 allocator-11
|
||||
46.08 ms Small 2097152 allocator-6
|
||||
46.02 ms Small 2097152 allocator-4
|
||||
45.68 ms Small 2097152 allocator-9
|
||||
|
||||
Compare against your pause-time chart: none of the above is a pause.
|
||||
Inspect the raw events, including the stack that was stalled, with:
|
||||
jfr print --events ZAllocationStall allocation-stalls.jfr
|
||||
Reference in New Issue
Block a user