HomeTroubleshooting Hub › Memory & CPU issues

Memory & CPU issues

Purpose: Diagnose OOMs, GC thrash and CPU saturation on AEM instances with evidence instead of restarts.

Who this page is for

AudienceWhy it matters to you
Backend/platform engineersPerformance incident responders

Memory: leak vs pressure

Heap graph over days tells you which problem you have:

sawtooth returning to same floor after full GC  → healthy / just undersized if ceiling near max
floor RISING after every full GC                → leak: something accumulates
sudden cliff → OOM after a deploy/feature       → new allocation pattern: recent change lane
ProblemMove
LeakHeap dump at high-water (jmap / -XX:+HeapDumpOnOutOfMemoryError) → dominator tree in MAT: the top retained-size class usually names the culprit (unbounded cache, listener accumulating, resolver/session leak — the AEM classics)
Pressure (no leak)Right-size heap from evidence; check Oak cache configs vs heap budget (tuning); reduce per-request allocation hotspots
OOM: Metaspace / direct buffersDifferent pools — deploy churn (metaspace) or IO libraries (direct); the OOM message names the pool, read it precisely

Session leaks deserve a call-out: "unclosed resolver" warnings in error.log correlate with both memory pressure and repository growth — grep for them during any memory investigation.

CPU saturation

Three thread dumps, 10s apart, DURING the event (jstack) — then read:

Pattern in dumpsMeaning
Many threads in the same app stack frameYour hot spot — usually a loop/query per request that should be cached (tuning ladder)
Threads parked waiting on one lockContention — synchronised singleton service doing slow work
GC threads dominating + tiny app timeIt's memory pressure wearing a CPU costume — memory lane above
Render threads all busy, queue buildingLoad exceeds capacity: cold cache event? (dispatcher) or genuine capacity ⚡
Indexing/compaction threads busyMaintenance colliding with peak (windows)

The restart temptation

A restart destroys the evidence and reschedules the incident. Capture first (dumps are minutes), THEN restart if service demands it (stabilise vs diagnose) — with the dumps in hand, the calm follow-up actually ends the pattern.

Quick navigation