Calibrate Garbage Collection on the Ground and Run Your Java App
summary
Two small Java apps run on JDK 21 — an eager factorial (CPU bound) and a continuous file editor (IO bound) — tested with k6 in Testkube and observed via Prometheus + micrometer and gc.log. Defaults use G1 and yield an average 84.17 ms with P95 near 1s for the CPU app; switching to parallel GC avg 4.8 ms CPU app boosts throughput by thousands of requests. ZGC (generational on JDK21) gives lowest latency for large heaps; halving G1 pause target or tuning XMS/XMX and GC threads also measurably improves results.
AI-written summary · about
chapters (12)
- 0:00Garbage collection in Java
- 3:15Why GC calibration matters
- 11:11GC types and generational memory
- 12:34G1 GC setup and results
- 17:14Fine-tuning G1 GC flags
- 22:58Parallel GC performance
- 27:18Fine-tuning Parallel GC
- 29:06Z GC overview and benefits
- 31:15Z GC test results
- 34:09Comparison of garbage collectors
- 37:39GC tuning trade-offs
- 38:02Q&A
related talks
53mCalibrate Garbage Collection on the Ground and Run Your Java App
25mGarbage Collection Primer
46mMastering GC: tame the beast and make it your best ally
48mZGC: A Decade of Redefining Java Performance
43mGarbage Collection in Java: The Performance Benefits of Upgrading
52mGC Tuning & Troubleshooting Crash Course
44mGarbage Collector: How to Tame the Beast and Make It Your Best Ally
45mJava Garbage Collectors’ Current Performance Impact
