Add gc-basics: Java garbage collection explained and measured on JDK 25, 27, 28 EA
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b44MquEzmd9QMkZCd7
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
f7b6c1efca
commit
876ae1bb5c
@@ -0,0 +1,4 @@
|
||||
src/Finalize.java:13: warning: [removal] finalize() in Object has been deprecated and marked for removal
|
||||
protected void finalize() { // deliberately not suppressed: javac prints a removal warning
|
||||
^
|
||||
1 warning
|
||||
@@ -0,0 +1 @@
|
||||
versions: OpenJDK Runtime Environment Temurin-25.0.5.1+2 (build 25.0.5.1+2-LTS) | OpenJDK Runtime Environment Temurin-27.0.1.1+4 (build 27.0.1.1+4) | OpenJDK Runtime Environment Temurin-28+25-202611191755 (build 28-beta+25-ea)
|
||||
@@ -0,0 +1,25 @@
|
||||
# Which collector does the JVM pick when you name none? (emulating a 1, 2 and 4 CPU machine with -XX:ActiveProcessorCount)
|
||||
|
||||
## JDK 25: OpenJDK Runtime Environment Temurin-25.0.5.1+2 (build 25.0.5.1+2-LTS)
|
||||
$ java -XX:ActiveProcessorCount=1 Which
|
||||
collector MXBeans : Copy | MarkSweepCompact
|
||||
$ java -XX:ActiveProcessorCount=2 Which
|
||||
collector MXBeans : G1 Young Generation | G1 Concurrent GC | G1 Old Generation
|
||||
$ java -XX:ActiveProcessorCount=4 Which
|
||||
collector MXBeans : G1 Young Generation | G1 Concurrent GC | G1 Old Generation
|
||||
|
||||
## JDK 27: OpenJDK Runtime Environment Temurin-27.0.1.1+4 (build 27.0.1.1+4)
|
||||
$ java -XX:ActiveProcessorCount=1 Which
|
||||
collector MXBeans : G1 Young Generation | G1 Concurrent GC | G1 Old Generation
|
||||
$ java -XX:ActiveProcessorCount=2 Which
|
||||
collector MXBeans : G1 Young Generation | G1 Concurrent GC | G1 Old Generation
|
||||
$ java -XX:ActiveProcessorCount=4 Which
|
||||
collector MXBeans : G1 Young Generation | G1 Concurrent GC | G1 Old Generation
|
||||
|
||||
## JDK 28: OpenJDK Runtime Environment Temurin-28+25-202611191755 (build 28-beta+25-ea)
|
||||
$ java -XX:ActiveProcessorCount=1 Which
|
||||
collector MXBeans : G1 Young Generation | G1 Concurrent GC | G1 Old Generation
|
||||
$ java -XX:ActiveProcessorCount=2 Which
|
||||
collector MXBeans : G1 Young Generation | G1 Concurrent GC | G1 Old Generation
|
||||
$ java -XX:ActiveProcessorCount=4 Which
|
||||
collector MXBeans : G1 Young Generation | G1 Concurrent GC | G1 Old Generation
|
||||
@@ -0,0 +1,14 @@
|
||||
# The memory half of the rule cannot be emulated with -XX:MaxRAM on 27 or later
|
||||
|
||||
## JDK 25
|
||||
$ java -XX:MaxRAM=1g -XX:+PrintFlagsFinal -version | grep MaxRAM
|
||||
uint64_t MaxRAM = 1073741824 {pd product} {command line}
|
||||
|
||||
## JDK 27
|
||||
$ java -XX:MaxRAM=1g -XX:+PrintFlagsFinal -version | grep MaxRAM
|
||||
OpenJDK 64-Bit Server VM warning: Ignoring option MaxRAM; support was removed in 27.0
|
||||
|
||||
## JDK 28
|
||||
$ java -XX:MaxRAM=1g -XX:+PrintFlagsFinal -version | grep MaxRAM
|
||||
Unrecognized VM option 'MaxRAM=1g'
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
@@ -0,0 +1,25 @@
|
||||
# Shenandoah: which mode is the default, and is the generational mode still experimental? (mode read from -Xlog:gc+init)
|
||||
|
||||
## JDK 25, no mode flag
|
||||
$ java -XX:+UseShenandoahGC -Xlog:gc+init -version | grep Mode
|
||||
[0.008s][info][gc,init] Mode: Snapshot-At-The-Beginning (SATB)
|
||||
|
||||
## JDK 27, no mode flag
|
||||
$ java -XX:+UseShenandoahGC -Xlog:gc+init -version | grep Mode
|
||||
[0.007s][info][gc,init] Mode: Snapshot-At-The-Beginning (SATB)
|
||||
|
||||
## JDK 28, no mode flag
|
||||
$ java -XX:+UseShenandoahGC -Xlog:gc+init -version | grep Mode
|
||||
[0.014s][info][gc,init] Mode: generational
|
||||
|
||||
## JDK 25: generational mode without -XX:+UnlockExperimentalVMOptions
|
||||
$ java -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational -Xlog:gc+init -version
|
||||
[0.011s][info][gc,init] Mode: Generational
|
||||
|
||||
## JDK 24-style spelling on 25 (the unlock flag is now unnecessary but harmless)
|
||||
[0.012s][info][gc,init] Mode: Generational
|
||||
|
||||
## JDK 28 early access: asking for the old mode explicitly
|
||||
$ java -XX:+UseShenandoahGC -XX:ShenandoahGCMode=satb -Xlog:gc+init -version
|
||||
[0.007s][info][gc,init] Mode: satb
|
||||
(no deprecation warning is printed by this early-access build)
|
||||
@@ -0,0 +1,20 @@
|
||||
# ZGC: the non-generational mode is gone, and what 28 adds
|
||||
|
||||
## JDK 25: ask for the old mode
|
||||
$ java -XX:+UseZGC -XX:-ZGenerational -version
|
||||
OpenJDK 64-Bit Server VM warning: Ignoring option ZGenerational; support was removed in 24.0
|
||||
openjdk version "25.0.5.1" 2026-11-17 LTS
|
||||
|
||||
## JDK 25: plain ZGC
|
||||
collector MXBeans : ZGC Minor Cycles | ZGC Minor Pauses | ZGC Major Cycles | ZGC Major Pauses
|
||||
|
||||
## ZGC flags present on 28 early access but not on 27 (diff of -XX:+PrintFlagsFinal -XX:+UseZGC, names only)
|
||||
only on 28:
|
||||
ZAdaptiveHeapSizing
|
||||
ZGCIntensity
|
||||
ZMemoryHeating
|
||||
only on 27:
|
||||
|
||||
## its default on 28
|
||||
size_t SoftMaxHeapSize = 1449551462 {manageable} {ergonomic}
|
||||
bool ZAdaptiveHeapSizing = false {product} {default}
|
||||
@@ -0,0 +1,8 @@
|
||||
# Reachability observed with weak references (JDK 25)
|
||||
A (local variable) alive
|
||||
B (static field) alive
|
||||
C (child of A) alive
|
||||
D (no references) collected
|
||||
X (cycle with Y, no root) collected
|
||||
Y (cycle with X, no root) collected
|
||||
A and C are still used here: A -> C
|
||||
@@ -0,0 +1,29 @@
|
||||
# Reading a G1 log: the first lines of -Xlog:gc for the Churn workload (JDK 25, -Xms512m -Xmx512m, 150 MB live)
|
||||
$ java -Xms512m -Xmx512m -Xlog:gc Churn 150 3
|
||||
[0.004s][info][gc] Using G1
|
||||
[0.044s][info][gc] GC(0) Pause Young (Normal) (G1 Evacuation Pause) 26M->25M(512M) 12.661ms
|
||||
[0.209s][info][gc] GC(1) Pause Young (Normal) (G1 Evacuation Pause) 205M->164M(512M) 88.487ms
|
||||
[0.244s][info][gc] GC(2) Pause Young (Normal) (G1 Evacuation Pause) 283M->175M(512M) 17.136ms
|
||||
[0.268s][info][gc] GC(3) Pause Young (Normal) (G1 Evacuation Pause) 318M->176M(512M) 1.967ms
|
||||
[0.298s][info][gc] GC(4) Pause Young (Normal) (G1 Evacuation Pause) 340M->176M(512M) 2.303ms
|
||||
[0.332s][info][gc] GC(5) Pause Young (Normal) (G1 Evacuation Pause) 356M->176M(512M) 2.059ms
|
||||
[0.386s][info][gc] GC(6) Pause Young (Normal) (G1 Evacuation Pause) 387M->176M(512M) 10.611ms
|
||||
[0.439s][info][gc] GC(7) Pause Young (Normal) (G1 Evacuation Pause) 407M->176M(512M) 10.162ms
|
||||
[0.487s][info][gc] GC(8) Pause Young (Normal) (G1 Evacuation Pause) 424M->177M(512M) 6.242ms
|
||||
[0.541s][info][gc] GC(9) Pause Young (Normal) (G1 Evacuation Pause) 438M->177M(512M) 8.665ms
|
||||
[0.591s][info][gc] GC(10) Pause Young (Normal) (G1 Evacuation Pause) 447M->177M(512M) 8.525ms
|
||||
[0.642s][info][gc] GC(11) Pause Young (Normal) (G1 Evacuation Pause) 455M->178M(512M) 7.669ms
|
||||
[0.694s][info][gc] GC(12) Pause Young (Normal) (G1 Evacuation Pause) 462M->178M(512M) 7.269ms
|
||||
[0.748s][info][gc] GC(13) Pause Young (Normal) (G1 Evacuation Pause) 467M->178M(512M) 8.543ms
|
||||
[0.801s][info][gc] GC(14) Pause Young (Normal) (G1 Evacuation Pause) 471M->178M(512M) 6.383ms
|
||||
[0.857s][info][gc] GC(15) Pause Young (Normal) (G1 Evacuation Pause) 471M->179M(512M) 5.703ms
|
||||
[0.910s][info][gc] GC(16) Pause Young (Normal) (G1 Evacuation Pause) 472M->179M(512M) 5.622ms
|
||||
[0.962s][info][gc] GC(17) Pause Young (Normal) (G1 Evacuation Pause) 471M->179M(512M) 5.201ms
|
||||
[1.014s][info][gc] GC(18) Pause Young (Normal) (G1 Evacuation Pause) 471M->180M(512M) 5.320ms
|
||||
[1.065s][info][gc] GC(19) Pause Young (Normal) (G1 Evacuation Pause) 472M->180M(512M) 5.347ms
|
||||
[1.117s][info][gc] GC(20) Pause Young (Normal) (G1 Evacuation Pause) 472M->180M(512M) 5.279ms
|
||||
[1.168s][info][gc] GC(21) Pause Young (Normal) (G1 Evacuation Pause) 472M->180M(512M) 4.655ms
|
||||
[1.217s][info][gc] GC(22) Pause Young (Normal) (G1 Evacuation Pause) 472M->180M(512M) 3.155ms
|
||||
|
||||
# the same run, counting what G1 did
|
||||
88 Pause Young (Normal) (G1 Evacuation Pause)
|
||||
@@ -0,0 +1,42 @@
|
||||
# Same workload, five collectors, JDK 25, -Xms1g -Xmx1g, 450 MB live set of small linked objects that are constantly replaced, 8 s measured after a 1.5 s warm-up, three runs each
|
||||
# (2 vCPU sandbox: shape, not result. 'requests' counts completed loop iterations, a rough throughput signal)
|
||||
|
||||
## -XX:+UseSerialGC
|
||||
run 1 requests : 2077033 (10135 MB allocated)
|
||||
run 1 ticker max stall: 576.0 ms; wakeups >10 ms: 38; >50 ms: 26
|
||||
run 2 requests : 2026832 (9889 MB allocated)
|
||||
run 2 ticker max stall: 595.4 ms; wakeups >10 ms: 37; >50 ms: 24
|
||||
run 3 requests : 1942997 (9479 MB allocated)
|
||||
run 3 ticker max stall: 586.2 ms; wakeups >10 ms: 37; >50 ms: 17
|
||||
|
||||
## -XX:+UseParallelGC
|
||||
run 1 requests : 957464 (4672 MB allocated)
|
||||
run 1 ticker max stall: 538.7 ms; wakeups >10 ms: 19; >50 ms: 19
|
||||
run 2 requests : 906922 (4425 MB allocated)
|
||||
run 2 ticker max stall: 553.8 ms; wakeups >10 ms: 18; >50 ms: 18
|
||||
run 3 requests : 908001 (4429 MB allocated)
|
||||
run 3 ticker max stall: 536.8 ms; wakeups >10 ms: 18; >50 ms: 18
|
||||
|
||||
## -XX:+UseG1GC
|
||||
run 1 requests : 3227925 (15750 MB allocated)
|
||||
run 1 ticker max stall: 566.5 ms; wakeups >10 ms: 40; >50 ms: 35
|
||||
run 2 requests : 3255959 (15885 MB allocated)
|
||||
run 2 ticker max stall: 575.7 ms; wakeups >10 ms: 40; >50 ms: 40
|
||||
run 3 requests : 3132846 (15284 MB allocated)
|
||||
run 3 ticker max stall: 515.3 ms; wakeups >10 ms: 38; >50 ms: 35
|
||||
|
||||
## -XX:+UseZGC
|
||||
run 1 requests : 5195766 (25350 MB allocated)
|
||||
run 1 ticker max stall: 12.4 ms; wakeups >10 ms: 1; >50 ms: 0
|
||||
run 2 requests : 5701049 (27813 MB allocated)
|
||||
run 2 ticker max stall: 8.3 ms; wakeups >10 ms: 0; >50 ms: 0
|
||||
run 3 requests : 5588330 (27264 MB allocated)
|
||||
run 3 ticker max stall: 13.0 ms; wakeups >10 ms: 1; >50 ms: 0
|
||||
|
||||
## -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational
|
||||
run 1 requests : 1742398 (8501 MB allocated)
|
||||
run 1 ticker max stall: 11.1 ms; wakeups >10 ms: 1; >50 ms: 0
|
||||
run 2 requests : 1680239 (8197 MB allocated)
|
||||
run 2 ticker max stall: 11.2 ms; wakeups >10 ms: 2; >50 ms: 0
|
||||
run 3 requests : 1684136 (8216 MB allocated)
|
||||
run 3 ticker max stall: 5.0 ms; wakeups >10 ms: 0; >50 ms: 0
|
||||
@@ -0,0 +1,33 @@
|
||||
# The defaults on each release, same workload and heap as 07, two runs each
|
||||
|
||||
## JDK 25: OpenJDK Runtime Environment Temurin-25.0.5.1+2 (build 25.0.5.1+2-LTS), no collector flag
|
||||
run 1 collector beans : G1 Young Generation G1 Concurrent GC G1 Old Generation
|
||||
run 1 requests : 3243911 (15827 MB allocated)
|
||||
run 1 ticker max stall: 78.1 ms; wakeups >10 ms: 37; >50 ms: 37
|
||||
run 2 collector beans : G1 Young Generation G1 Concurrent GC G1 Old Generation
|
||||
run 2 requests : 3279760 (16002 MB allocated)
|
||||
run 2 ticker max stall: 534.3 ms; wakeups >10 ms: 39; >50 ms: 36
|
||||
|
||||
## JDK 27: OpenJDK Runtime Environment Temurin-27.0.1.1+4 (build 27.0.1.1+4), no collector flag
|
||||
run 1 collector beans : G1 Young Generation G1 Concurrent GC G1 Old Generation
|
||||
run 1 requests : 4914119 (23976 MB allocated)
|
||||
run 1 ticker max stall: 600.6 ms; wakeups >10 ms: 53; >50 ms: 51
|
||||
run 2 collector beans : G1 Young Generation G1 Concurrent GC G1 Old Generation
|
||||
run 2 requests : 4690805 (22886 MB allocated)
|
||||
run 2 ticker max stall: 512.3 ms; wakeups >10 ms: 53; >50 ms: 49
|
||||
|
||||
## JDK 28: OpenJDK Runtime Environment Temurin-28+25-202611191755 (build 28-beta+25-ea), no collector flag
|
||||
run 1 collector beans : G1 Young Generation G1 Concurrent GC G1 Old Generation
|
||||
run 1 requests : 4456120 (21741 MB allocated)
|
||||
run 1 ticker max stall: 567.4 ms; wakeups >10 ms: 51; >50 ms: 49
|
||||
run 2 collector beans : G1 Young Generation G1 Concurrent GC G1 Old Generation
|
||||
run 2 requests : 4790262 (23369 MB allocated)
|
||||
run 2 ticker max stall: 503.2 ms; wakeups >10 ms: 52; >50 ms: 49
|
||||
|
||||
## JDK 28 early access, -XX:+UseShenandoahGC with no mode flag
|
||||
run 1 collector beans : Shenandoah Pauses Shenandoah Cycles
|
||||
run 1 requests : 1758008 (8578 MB allocated)
|
||||
run 1 ticker max stall: 301.2 ms; wakeups >10 ms: 29; >50 ms: 25
|
||||
run 2 collector beans : Shenandoah Pauses Shenandoah Cycles
|
||||
run 2 requests : 1760812 (8592 MB allocated)
|
||||
run 2 ticker max stall: 289.3 ms; wakeups >10 ms: 27; >50 ms: 22
|
||||
@@ -0,0 +1,30 @@
|
||||
# jcmd GC.heap_info on a live process, per collector (JDK 25, 512 MB heap, 150 MB live)
|
||||
|
||||
## -XX:+UseParallelGC
|
||||
PSYoungGen total 163328K, used 67168K [0x00000000f5580000, 0x0000000100000000, 0x0000000100000000)
|
||||
eden space 152064K, 37% used [0x00000000f5580000,0x00000000f8c783c8,0x00000000fea00000)
|
||||
from space 11264K, 96% used [0x00000000ff500000,0x00000000fffa0000,0x0000000100000000)
|
||||
to space 11264K, 0% used [0x00000000fea00000,0x00000000fea00000,0x00000000ff500000)
|
||||
ParOldGen total 349696K, used 216440K [0x00000000e0000000, 0x00000000f5580000, 0x00000000f5580000)
|
||||
object space 349696K, 61% used [0x00000000e0000000,0x00000000ed35e2e0,0x00000000f5580000)
|
||||
|
||||
## -XX:+UseG1GC
|
||||
garbage-first heap total reserved 524288K, committed 524288K, used 214460K [0x00000000e0000000, 0x0000000100000000)
|
||||
region size 1024K, 24 young (24576K), 15 survivors (15360K)
|
||||
|
||||
## -XX:+UseZGC
|
||||
ZHeap used 320M, capacity 512M, max capacity 512M
|
||||
Cache 192M (23)
|
||||
size classes 2M (12), 4M (7), 8M (2), 32M (1), 64M (1)
|
||||
|
||||
## -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational
|
||||
Shenandoah Heap
|
||||
512M max, 512M soft max, 512M committed, 261M used
|
||||
2048 x 256 K regions
|
||||
Status: not cancelled
|
||||
Reserved region:
|
||||
- [0x00000000e0000000, 0x0000000100000000)
|
||||
Collection set:
|
||||
- map (vanilla): 0x0000000000004800
|
||||
- map (biased): 0x0000000000001000
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# Running out of memory: the message depends on how the collector fails (JDK 25, -Xmx64m)
|
||||
|
||||
## G1, 1 MB arrays
|
||||
kept 31 arrays of 1 MB then: java.lang.OutOfMemoryError: Java heap space
|
||||
|
||||
## G1, tiny objects
|
||||
kept 1215487 tiny objects then: java.lang.OutOfMemoryError: Java heap space
|
||||
|
||||
## Parallel, tiny objects
|
||||
kept 1160801 tiny objects then: java.lang.OutOfMemoryError: Java heap space
|
||||
@@ -0,0 +1,31 @@
|
||||
# What one System.gc() costs (JDK 25, G1, 150 MB live)
|
||||
|
||||
## default
|
||||
[0.187s][info][gc] GC(7) Pause Full (System.gc()) 156M->154M(267M) 22.122ms
|
||||
System.gc() #1 took 22.5 ms
|
||||
[0.224s][info][gc] GC(8) Pause Full (System.gc()) 155M->154M(267M) 18.764ms
|
||||
System.gc() #2 took 18.9 ms
|
||||
[0.238s][info][gc] GC(9) Pause Full (System.gc()) 155M->154M(267M) 13.827ms
|
||||
System.gc() #3 took 14.0 ms
|
||||
live chunks still referenced: 153600
|
||||
|
||||
## -XX:+DisableExplicitGC
|
||||
System.gc() #1 took 0.1 ms
|
||||
System.gc() #2 took 0.0 ms
|
||||
System.gc() #3 took 0.0 ms
|
||||
live chunks still referenced: 153600
|
||||
|
||||
## -XX:+ExplicitGCInvokesConcurrent
|
||||
[0.203s][info][gc] GC(7) Pause Young (Concurrent Start) (System.gc()) 168M->168M(267M) 8.496ms
|
||||
System.gc() #1 took 34.4 ms
|
||||
[0.261s][info][gc] GC(9) Pause Young (Concurrent Start) (System.gc()) 168M->169M(285M) 4.044ms
|
||||
System.gc() #2 took 31.7 ms
|
||||
[0.290s][info][gc] GC(11) Pause Young (Concurrent Start) (System.gc()) 169M->168M(287M) 0.919ms
|
||||
System.gc() #3 took 22.5 ms
|
||||
live chunks still referenced: 153600
|
||||
|
||||
## ZGC
|
||||
System.gc() #1 took 47.5 ms
|
||||
System.gc() #2 took 23.6 ms
|
||||
System.gc() #3 took 19.2 ms
|
||||
live chunks still referenced: 153600
|
||||
@@ -0,0 +1,28 @@
|
||||
# finalize() today
|
||||
|
||||
## what javac says (JDK 25, -Xlint:deprecation)
|
||||
src/Finalize.java:13: warning: [removal] finalize() in Object has been deprecated and marked for removal
|
||||
protected void finalize() { // deliberately not suppressed: javac prints a removal warning
|
||||
^
|
||||
1 warning
|
||||
|
||||
## JDK 25, default
|
||||
finalize() ran
|
||||
main done
|
||||
|
||||
## JDK 25, --finalization=disabled
|
||||
main done
|
||||
|
||||
## JDK 27, default
|
||||
finalize() ran
|
||||
main done
|
||||
|
||||
## JDK 27, --finalization=disabled
|
||||
main done
|
||||
|
||||
## JDK 28, default
|
||||
finalize() ran
|
||||
main done
|
||||
|
||||
## JDK 28, --finalization=disabled
|
||||
main done
|
||||
@@ -0,0 +1,4 @@
|
||||
# the other two snippets in the article, run
|
||||
10 Hello
|
||||
read byte count: 5
|
||||
stream closed deterministically at the end of the try block
|
||||
@@ -0,0 +1,21 @@
|
||||
# The baseline: a FLAT live set (one list of 1 KB byte arrays, no pointers inside), JDK 25, -Xms512m -Xmx512m, 150 MB live, 8 s, one run each
|
||||
|
||||
## -XX:+UseSerialGC
|
||||
requests : 10735539 (52378 MB allocated)
|
||||
ticker max stall: 8.6 ms; wakeups >10 ms: 0; >50 ms: 0
|
||||
|
||||
## -XX:+UseParallelGC
|
||||
requests : 13025302 (63552 MB allocated)
|
||||
ticker max stall: 5.0 ms; wakeups >10 ms: 0; >50 ms: 0
|
||||
|
||||
## -XX:+UseG1GC
|
||||
requests : 8873404 (43294 MB allocated)
|
||||
ticker max stall: 7.2 ms; wakeups >10 ms: 0; >50 ms: 0
|
||||
|
||||
## -XX:+UseZGC
|
||||
requests : 13262536 (64709 MB allocated)
|
||||
ticker max stall: 6.3 ms; wakeups >10 ms: 0; >50 ms: 0
|
||||
|
||||
## -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational
|
||||
requests : 9827770 (47951 MB allocated)
|
||||
ticker max stall: 5.3 ms; wakeups >10 ms: 0; >50 ms: 0
|
||||
@@ -0,0 +1,37 @@
|
||||
# Why is G1's worst case so uneven? Pause types and the three longest pauses in three G1 runs of the graph workload (JDK 25, -Xms1g -Xmx1g, 450 MB live)
|
||||
|
||||
## run 1
|
||||
pause counts by type:
|
||||
38 Pause Young (Normal)
|
||||
5 Pause Young (Mixed)
|
||||
5 Pause Young (Concurrent Start)
|
||||
4 Pause Young (Prepare Mixed)
|
||||
1 Pause Full (G1 Compaction Pause)
|
||||
three longest pauses:
|
||||
GC(51) Pause Full (G1 Compaction Pause) 1024M->464M(1024M) 467.261ms
|
||||
GC(2) Pause Young (Normal) (G1 Evacuation Pause) 409M->409M(1024M) 109.383ms
|
||||
GC(49) Pause Young (Mixed) (G1 Evacuation Pause) (Evacuation Failure: Allocation) 971M->975M(1024M) 106.895ms
|
||||
|
||||
## run 2
|
||||
pause counts by type:
|
||||
38 Pause Young (Normal)
|
||||
5 Pause Young (Mixed)
|
||||
5 Pause Young (Concurrent Start)
|
||||
4 Pause Young (Prepare Mixed)
|
||||
1 Pause Full (G1 Compaction Pause)
|
||||
three longest pauses:
|
||||
GC(51) Pause Full (G1 Compaction Pause) 1023M->464M(1024M) 467.847ms
|
||||
GC(49) Pause Young (Mixed) (G1 Evacuation Pause) (Evacuation Failure: Allocation) 970M->979M(1024M) 132.893ms
|
||||
GC(2) Pause Young (Normal) (G1 Evacuation Pause) 410M->410M(1024M) 111.761ms
|
||||
|
||||
## run 3
|
||||
pause counts by type:
|
||||
37 Pause Young (Normal)
|
||||
5 Pause Young (Mixed)
|
||||
5 Pause Young (Concurrent Start)
|
||||
4 Pause Young (Prepare Mixed)
|
||||
1 Pause Full (G1 Compaction Pause)
|
||||
three longest pauses:
|
||||
GC(51) Pause Full (G1 Compaction Pause) 1024M->464M(1024M) 507.602ms
|
||||
GC(49) Pause Young (Mixed) (G1 Evacuation Pause) (Evacuation Failure: Allocation) 971M->975M(1024M) 121.870ms
|
||||
GC(2) Pause Young (Normal) (G1 Evacuation Pause) 409M->410M(1024M) 118.036ms
|
||||
@@ -0,0 +1,25 @@
|
||||
# Heap is not the whole process: Native Memory Tracking on a live JVM (JDK 25, G1, -Xmx512m, 150 MB live)
|
||||
$ jcmd <pid> VM.native_memory summary (category totals only)
|
||||
Total: reserved=1973775KB, committed=597955KB
|
||||
Java Heap (reserved=524288KB, committed=524288KB)
|
||||
Class (reserved=1048647KB, committed=199KB)
|
||||
Thread (reserved=20545KB, committed=1053KB)
|
||||
Code (reserved=247794KB, committed=7650KB)
|
||||
GC (reserved=47599KB, committed=47599KB)
|
||||
GCCardSet (reserved=9KB, committed=9KB)
|
||||
Compiler (reserved=214KB, committed=214KB)
|
||||
Internal (reserved=1297KB, committed=1297KB)
|
||||
Symbol (reserved=1131KB, committed=1131KB)
|
||||
Native Memory Tracking (reserved=180KB, committed=180KB)
|
||||
Shared class space (reserved=16384KB, committed=13928KB, readonly=0KB)
|
||||
Arena Chunk (reserved=1KB, committed=1KB)
|
||||
Tracing (reserved=5KB, committed=5KB)
|
||||
Module (reserved=40KB, committed=40KB)
|
||||
Safepoint (reserved=8KB, committed=8KB)
|
||||
Synchronization (reserved=66KB, committed=66KB)
|
||||
Serviceability (reserved=17KB, committed=17KB)
|
||||
Metaspace (reserved=65548KB, committed=268KB)
|
||||
String Deduplication (reserved=1KB, committed=1KB)
|
||||
Object Monitors (reserved=1KB, committed=1KB)
|
||||
|
||||
resident set size of the process, from /proc: 549.477 MB
|
||||
@@ -0,0 +1,11 @@
|
||||
# A few defaults worth knowing (JDK 25)
|
||||
$ java -Xmx1g -XX:+UseG1GC -XX:+PrintFlagsFinal -version | grep ...
|
||||
uint ConcGCThreads = 1 {product} {ergonomic}
|
||||
size_t G1HeapRegionSize = 1048576 {product} {ergonomic}
|
||||
uint InitiatingHeapOccupancyPercent = 45 {product} {default}
|
||||
uintx MaxGCPauseMillis = 200 {product} {default}
|
||||
uint ParallelGCThreads = 2 {product} {default}
|
||||
$ java -Xmx1g -XX:+UseSerialGC -XX:+PrintFlagsFinal -version | grep -E 'NewRatio|SurvivorRatio|MaxTenuringThreshold'
|
||||
uint MaxTenuringThreshold = 15 {product} {default}
|
||||
uintx NewRatio = 2 {product} {default}
|
||||
uintx SurvivorRatio = 8 {product} {default}
|
||||
@@ -0,0 +1,25 @@
|
||||
# Shenandoah by JDK and mode, same graph workload as 07 (-Xms1g -Xmx1g, 450 MB live), one run each
|
||||
|
||||
## JDK 25, -XX:ShenandoahGCMode=satb
|
||||
requests : 539727 (2633 MB allocated)
|
||||
ticker max stall: 11.3 ms; wakeups >10 ms: 2; >50 ms: 0
|
||||
|
||||
## JDK 25, -XX:ShenandoahGCMode=generational
|
||||
requests : 1710722 (8347 MB allocated)
|
||||
ticker max stall: 10.7 ms; wakeups >10 ms: 1; >50 ms: 0
|
||||
|
||||
## JDK 27, -XX:ShenandoahGCMode=satb
|
||||
requests : 652517 (3183 MB allocated)
|
||||
ticker max stall: 1125.5 ms; wakeups >10 ms: 11; >50 ms: 11
|
||||
|
||||
## JDK 27, -XX:ShenandoahGCMode=generational
|
||||
requests : 1075858 (5249 MB allocated)
|
||||
ticker max stall: 1345.8 ms; wakeups >10 ms: 16; >50 ms: 16
|
||||
|
||||
## JDK 28, -XX:ShenandoahGCMode=satb
|
||||
requests : 750947 (3663 MB allocated)
|
||||
ticker max stall: 952.4 ms; wakeups >10 ms: 14; >50 ms: 14
|
||||
|
||||
## JDK 28, -XX:ShenandoahGCMode=generational
|
||||
requests : 1854932 (9052 MB allocated)
|
||||
ticker max stall: 307.9 ms; wakeups >10 ms: 27; >50 ms: 25
|
||||
@@ -0,0 +1,21 @@
|
||||
# Headroom: the graph workload again with a 2 GB heap instead of 1 GB (450 MB live is now 22 percent of the heap), JDK 25, one run each
|
||||
|
||||
## -XX:+UseSerialGC
|
||||
requests : 4584936 (22369 MB allocated)
|
||||
ticker max stall: 121.8 ms; wakeups >10 ms: 43; >50 ms: 43
|
||||
|
||||
## -XX:+UseParallelGC
|
||||
requests : 6845614 (33401 MB allocated)
|
||||
ticker max stall: 52.3 ms; wakeups >10 ms: 68; >50 ms: 1
|
||||
|
||||
## -XX:+UseG1GC
|
||||
requests : 5148123 (25117 MB allocated)
|
||||
ticker max stall: 132.1 ms; wakeups >10 ms: 23; >50 ms: 23
|
||||
|
||||
## -XX:+UseZGC
|
||||
requests : 6501613 (31722 MB allocated)
|
||||
ticker max stall: 8.1 ms; wakeups >10 ms: 0; >50 ms: 0
|
||||
|
||||
## -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational
|
||||
requests : 2706531 (13206 MB allocated)
|
||||
ticker max stall: 6.9 ms; wakeups >10 ms: 0; >50 ms: 0
|
||||
@@ -0,0 +1,33 @@
|
||||
# What Shenandoah did on each JDK for the graph workload (-Xms1g -Xmx1g, 450 MB live, generational mode, one run each): pause types and the three longest pauses
|
||||
|
||||
## JDK 25
|
||||
pause counts by type:
|
||||
42 Pause Final Mark
|
||||
41 Pause Init Mark
|
||||
38 Pause Init Update Refs
|
||||
38 Pause Final Update Refs
|
||||
three longest pauses:
|
||||
GC(15) Pause Final Mark (Young) 5.844ms
|
||||
GC(8) Pause Final Update Refs 1.035ms
|
||||
GC(14) Pause Final Update Refs 0.412ms
|
||||
|
||||
## JDK 27
|
||||
pause counts by type:
|
||||
16 Pause Init Mark
|
||||
15 Pause Degenerated GC
|
||||
5 Pause Final Mark
|
||||
3 Pause Full
|
||||
three longest pauses:
|
||||
GC(27) Pause Full 993M->434M(1024M) 1304.922ms
|
||||
GC(18) Pause Full 993M->434M(1024M) 1210.941ms
|
||||
GC(9) Pause Full 1024M->433M(1024M) 1152.424ms
|
||||
|
||||
## JDK 28
|
||||
pause counts by type:
|
||||
36 Pause Init Mark
|
||||
35 Pause Final Mark
|
||||
34 Pause Final Update Refs
|
||||
three longest pauses:
|
||||
GC(1) Pause Final Mark (Young) 0.321ms
|
||||
GC(6) Pause Final Mark (Global) 0.265ms
|
||||
GC(18) Pause Final Mark (Young) 0.232ms
|
||||
@@ -0,0 +1,21 @@
|
||||
# A pause-free log is not a stall-free application: Shenandoah allocation stalls (generational mode, graph workload, -Xms1g -Xmx1g, 450 MB live, one run each)
|
||||
|
||||
## JDK 25
|
||||
allocation stalls logged : 0
|
||||
longest allocation stalls :
|
||||
longest stop-the-world pause: 0.913ms
|
||||
ticker max stall: 5.2 ms; wakeups >10 ms: 0; >50 ms: 0
|
||||
|
||||
## JDK 27
|
||||
allocation stalls logged : 0
|
||||
longest allocation stalls :
|
||||
longest stop-the-world pause: 1293.419ms
|
||||
ticker max stall: 1292.7 ms; wakeups >10 ms: 15; >50 ms: 15
|
||||
|
||||
## JDK 28
|
||||
allocation stalls logged : 83
|
||||
longest allocation stalls :
|
||||
Allocation Stall (main) 285.067ms
|
||||
Allocation Stall (main) 282.400ms
|
||||
longest stop-the-world pause: 0.372ms
|
||||
ticker max stall: 281.3 ms; wakeups >10 ms: 28; >50 ms: 22
|
||||
@@ -0,0 +1,19 @@
|
||||
# The default collector inside real container limits (docker run --cpus --memory; needs Docker and the eclipse-temurin:25-jre and :27-jre images)
|
||||
|
||||
## eclipse-temurin:25-jre
|
||||
--cpus=1 --memory=4g -> UseSerialGC
|
||||
--cpus=2 --memory=1g -> UseSerialGC
|
||||
--cpus=2 --memory=1500m -> UseSerialGC
|
||||
--cpus=2 --memory=1791m -> UseSerialGC
|
||||
--cpus=2 --memory=1792m -> UseG1GC
|
||||
--cpus=2 --memory=1800m -> UseG1GC
|
||||
--cpus=2 --memory=2g -> UseG1GC
|
||||
|
||||
## eclipse-temurin:27-jre
|
||||
--cpus=1 --memory=4g -> UseG1GC
|
||||
--cpus=2 --memory=1g -> UseG1GC
|
||||
--cpus=2 --memory=1500m -> UseG1GC
|
||||
--cpus=2 --memory=1791m -> UseG1GC
|
||||
--cpus=2 --memory=1792m -> UseG1GC
|
||||
--cpus=2 --memory=1800m -> UseG1GC
|
||||
--cpus=2 --memory=2g -> UseG1GC
|
||||
Reference in New Issue
Block a user