Performance tuning
Purpose: The tuning knobs in the order that pays: cache, code, queries, JVM, then infrastructure.
Who this page is for
| Audience | Why it matters to you |
|---|---|
| Platform engineers | Tuners |
| Backend engineers | Usually the actual fix |
Tune in this order (each step is cheaper than the next)
1. CACHE hit ratio up (rules, TTLs, query-string discipline, personalisation out of HTML)
2. CODE render hotspots (models doing work per-request that belongs in @PostConstruct/jobs)
3. QUERIES traversals, unbounded results, missing indexes
4. JVM heap/GC from evidence (GC logs), not folklore
5. INFRA more/bigger instances — LAST, after 1–4, or you scale the inefficiency
Most "AEM is slow" engagements end at steps 1–3. Measure before and after every change — one knob at a time.
Diagnosis toolbox
| Question | Tool |
|---|---|
| What's slow at the edge? | CDN/dispatcher logs: hit ratio, top MISS URLs (fix THOSE pages/rules) |
| Which requests are slow on publish? | request.log analysis (built-in rlog/log platform percentile queries) |
| What is a slow request doing? | Thread dumps ×3, 10s apart, during slowness — the stuck pattern is usually obvious |
| Slow queries? | error.log traversal warnings + Explain Query (slow queries) |
| GC pain? | GC logs → pause frequency/duration; heap histogram for the leak question (memory & CPU) |
| Repo-level costs? | Oak JMX (cache hit rates — SegmentCache/observation queue), oak-run for offline analysis |
Platform knobs that commonly matter (after code is clean)
- Oak caches (segment cache, document cache sizes) — raise from JMX hit-rate evidence within heap budget.
- Render thread pool sizing vs actual uncached RPS (capacity math ⚡) — bigger pools on a saturated CPU make it worse.
- Async indexing intervals vs write bursts (index management).
- Workflow engine concurrency (DAM ingest events starving authoring).
- Heap: bigger is not faster — right-sized with observed GC behaviour is faster.
Load-test any tuning claim before it reaches prod (load testing); prod is not the lab.