Part 2 · 1 chapters · ~8 min

The JVM

Class loading and bytecode, the interpreter and tiered C1 and C2 compilation, deoptimisation, heap layout and the garbage collectors (G1, ZGC, Shenandoah, Parallel), container memory settings, JIT warm-up, and alternative JVMs (GraalVM, OpenJ9).

4

Class loading, JIT and GC

code
javap -c Fees.class                  # see the bytecode
java -Xlog:gc*:file=gc.log -XX:+UseZGC -XX:MaxRAMPercentage=75 -jar ledger.jar
jcmd <pid> VM.flags                  # effective JVM flags
jcmd <pid> GC.heap_info
INSIDE THE JVM
bytecode loaded, interpreted, profiled, compiled, and garbage collected
.class files / JARclass loadersbootstrap, platform, appinterpreterbytecodeC1 compilerquick, profiledC2 compileroptimised hot codegarbage collectorG1 · ZGC · Shenandoah
swipe the figure sideways, or tap expand for full screen
1/5
class loading
Class loaders find and load classes lazily, verify bytecode, and link them. Spring's classpath scanning and many dependencies make start-up slow for this reason (part 8).
classes loaded lazily and verifieda big classpath = slow start-up