JVM, JIT, garbage collection and diagnosis
Prerequisites: 01-ecosystem
How do execution and evidence connect?
Goal & mental model verified
HotSpot starts with interpretation and adaptively compiles hot code. Garbage collection manages object memory. Flight Recorder captures runtime events for diagnosis; request latency can include CPU, allocation, locks and external waiting.
[S14] [S15]Worked example · design exercise synthesis
A quote endpoint’s latency rises while CPU stays modest. A recording and dependency timings may reveal contention or connection waits rather than expensive Java computation.
[S14] [S15]Engineering decision synthesis
Choose a runtime and collector against workload and deployment limits. Compare warm steady-state behavior and startup separately; a microbenchmark rarely predicts full service latency.
[S14] [S15]Pitfall & diagnosis synthesis
Treating every pause as a GC problem can hide a slow database. Increasing heap can reduce some collection pressure while increasing footprint and changing pause behavior.
[S14] [S15]Improve & validate synthesis
Form a hypothesis, capture JFR plus service metrics, change one factor, then repeat representative load. Keep the measurement environment and warm-up conditions explicit.
[S14] [S15]Check yourself: Can low CPU coexist with high latency?
Yes. A request may be waiting for a lock, I/O or a scarce connection.