Phase 1 of 4 · Study weeks 1-4
The JVM, threads, memory and measurement
This phase makes the first checkpoint possible: a service you have measured, with a leak and a stall found from evidence.
Topics every week
- Week 18 h
- Records, sealed types and pattern matching
- Virtual threads and what still pins them
- Structured concurrency (check its status in your JDK)
- Thread pools and limits
Hand inA pinning lab: a service with a blocking native call, found and removed
- Week 28 h
- Heap layout and object headers
- G1 as the default collector, ZGC and Shenandoah
- Pause against throughput
- Reading a GC log
Hand inA GC comparison on the service with a log for each collector and your prediction
- Week 38 h
- Tiered compilation, inlining and deoptimisation
- JMH and the traps that ruin results
- Profiling with async-profiler and flame graphs
Hand inA JMH benchmark with spread, and a flame graph that explains one hot method
- Week 48 h
- Java Flight Recorder
- Thread and heap dumps
- Native memory and container limits
- Start-up time and class-data sharing
Hand inCheckpoint 1: the measured service, the two seeded-fault runs and the reference table
Practice projects
- Practice 1, the pinning lab (Week 1): run many virtual threads that block in a native call. Done when: a thread dump shows the stuck carriers, p99 falls from the pinned run to the fixed run, and you can say which JDK version changed what pins.
- Practice 2, the GC log (Week 2): run the service at 300 requests a second under G1 and under generational ZGC. Done when: a table shows pause p99, throughput and heap for each, and you say which one you would ship and why.
- Practice 3, the leak hunt (Week 4): seed a static map that grows per request. Done when: two heap dumps show the growing retainer, the fix passes a 30-minute run with flat heap, and the dump is not committed.
- Optional, a benchmark trap: write a JMH benchmark with dead-code elimination. Done when: the wrong result and the corrected one are side by side.
GitHub repos to study
Existence and last commit were checked on 22 Nov 2026 by shallow clone. Every repository below had a commit in the last 12 months. Look at the README for archive notices before you rely on one.
| Repo | What to read | Week |
|---|---|---|
| openjdk/jdk | The docs and the HotSpot sources for the collector you test | 2 |
| openjdk/jol | Object layout: print the layout of your own order class | 2 |
| openjdk/jmh | The samples directory, for the traps | 3 |
| async-profiler/async-profiler | CPU, allocation and lock profiling, and the flame graph output | 3 |
Milestone checkpoint
Build Checkpoint 1. Write the load script and your predictions first. Add the seeded leak and the seeded pin, and find each from a dump. Run JMH, JFR and the GC log on the fixed service. Hand in the reference table with your own numbers, ADR-1 (which collector) and ADR-2 (threads and limits).
Check yourself
Answer each question in your head first, then open it to check.
What makes a virtual thread stay mounted on its carrier, and which of those causes were removed in recent JDKs?
A blocking native call, or a class initialiser that blocks. Before JDK 24, blocking insidesynchronizedalso pinned; JEP 491 changed that. Check each JDK you run.Why can a G1 service with the same heap show longer pauses after a traffic spike?
The collector adapts to the allocation rate and to how much live data survives. A spike raises both, so collections run longer or more often.Why do microbenchmarks give wrong answers, and what does JMH do about it?
The JIT removes dead code, folds constants and needs warm-up. JMH forks, warms up and gives you tools such asBlackholeto keep results alive.What does a heap dump comparison show for a leak?
Objects in the later dump and not the earlier one, with the retainer path that keeps them reachable.Why can the container memory limit kill a JVM whose heap is under the limit?
The process also uses native memory: metaspace, thread stacks, direct buffers and the collector's own data. All of it counts toward the container limit.