⚙️application / jvm

JVM Memory Leak Under Load

senior35 min🏢 SaaS analytics platform (500k daily active users)
JVMHeap DumpJavaGCMemory LeakSpring Boot

Tech Stack

  • Java 17
  • Spring Boot 3.1
  • JVM 17 (G1GC)
  • Micrometer
  • Grafana
🚨

Incident Scenario

Your analytics API handles 200 RPS flawlessly in staging.
After deploying to production (600 RPS peak), the service starts throwing OutOfMemoryError after ~45 minutes of load.
The heap is 8 GB. GC logs are available. A heap dump was captured just before the OOM.
You have 30 minutes before the next deploy window. Find the leak.

🔍 Investigation Artifacts

Reveal artifacts one by one. Each clue brings you closer to the root cause.

📊
Clue #1 · graph
JVM Heap Usage Over 45 Minutes
💡 Compare Eden/Survivor vs Old Gen behavior — one recovers after GC, one does not
📋
Clue #2 · log
GC Log Analysis (G1GC)
💡 Focus on Full GC events — how much memory is freed each time?
🔍
Clue #3 · query
Heap Dump Analysis (jmap histogram)
💡 Which class holds an unusually large number of instances? Who is the owner?
⚙️
Clue #4 · config
SessionCache Implementation
💡 What is missing from this cache implementation that would prevent memory growth?