Debugging AEM Performance with the Request Snoop and Log Analyzer

Most performance problems in Adobe Experience Manager (AEM) do not arrive with a stack trace attached. A content page that takes six seconds to render still answers with HTTP 200, the uptime dashboard stays green, and what lands in your inbox is a complaint rather than a diagnosis: "the site feels slow lately." Finding the real cause means watching what the publish tier did, request by request, instead of inferring it from the outside. Learn more about Aem And Postgresql For External Data Source Integration 2908.

That is the shape of the CIRCUIT session from Chicago on debugging AEM performance with the request snoop and log analyser: capture live requests, keep the server's own record of them, then read both together. The approach scales from a laptop running a local publish instance to a cloud deployment sitting in an Australian region, and the recordings from the 2015 and 2016 conferences remain a solid reference for the tooling and the workflow. Learn more about Annapolisartscraftswinefestival.net.

Where the response time actually goes

A page load is a chain: browser, CDN or reverse proxy, dispatcher, Sling resource resolution, a read from the JCR, a Sightly render, and a response back out. The time can hide at any link in that chain, and the usual suspects are unglamorous — a selector that misses the cache, a tree walk across a deep content path, a component that queries an external system, a dispatcher rule that stopped matching, replication lag on a freshly published page. Learn more about Aem And Terraform For Infrastructure As Code Deployments F105.

Australian deployments add their own noise. Author and publish tiers hosted in the Sydney region are still a long way from a Brisbane office or a datacentre in Perth, so a 60 ms hop that looks trivial on a diagram turns into real delay once a page fires twenty sequential requests. Log correlation gets messier too, because AEST and AEDT shifts have to be reconciled when an offshore vendor or a Melbourne-based team is watching the same dashboards at the same time.

Start by splitting delivery time from render time. A 200 ms time to first byte with a five-second total load is an asset and caching problem; a four-second time to first byte with a 4.2 second total load is the server. The request snoop helps you make that split from inside the JVM, and the log analyser confirms it from the outside.

Catching slow requests with the request snoop

The request snoop runs alongside the publish tier and records each request as it happens: the path, the selector string, the thread that served it, the time spent resolving and rendering, and the parameters that arrived with it. Because it watches live traffic rather than replaying yesterday's file, you can tie a user's sluggish page to the exact request that caused it instead of to a general feeling that things got slower.

That granularity pays off on sites that look trivial. Take something the size of the Annapolis arts festival — a handful of landing pages and an image gallery — and assume one poorly written selector below the home page: every navigation becomes a fresh tree walk, and the aggregate damage hides behind a page a content editor describes as "a bit sluggish, no worries, probably the imagery".

The snoop also shows whether requests arrive in parallel or in a queue, and whether the same resolution repeats on every page view. Repeated resolution with no cache hit and no matching dispatcher rule is the signature of a problem you can fix in an afternoon, and it is much easier to spot when you can watch it happen in real traffic rather than reconstruct it from an access log.

Reading the request log and the analyser output

AEM writes a request log for both author and publish tiers, one line per request, in Apache access log format: response code, bytes served, referrer, user agent and timing information. It is complete and close to unreadable at volume — a busy day at an Australian publisher can produce hundreds of thousands of lines, and the interesting five per cent is buried in the middle.

The log analyser is the piece that makes that file useful. Point it at a log directory and it buckets responses by path, sorts by cumulative time, calculates percentile figures such as p95 and p99, and flags repeated errors, timeouts and cache misses. Run it over the same window you used for the snoop and you get a clean two-way story: the analyser tells you that one content path grew expensive overnight, and the snoop shows which selector and which thread produced it.

Sometimes the slow line is not the culprit but the witness. A component that reaches out to a relational database through an external data source integration can look innocent in the request log while adding hundreds of milliseconds per render, and the CIRCUIT write-up on external data source integration with PostgreSQL is a useful reminder to instrument that boundary rather than assume the JCR is the only datastore in play.

You can fold in the wider toolchain — Elastic or Splunk for aggregation, Grafana for dashboards, a conversion step in the analyser so each log line becomes a queryable event. Just be careful with debug logging: turning com.day.cq.request up to trace level is informative but noisy, so enable it for a controlled window and keep the volume manageable.

Following the bottleneck through the delivery chain

Once the server-side picture is clear, widen the lens to the delivery path: CDN hit ratio, dispatcher cache rules, flush agents, replication lag behind the publish tier, TLS handshake cost and reverse proxy timeouts. The browser waterfall in DevTools gives you the client side of that story and the analyser gives you the origin side, and the gap between the two is usually where the answer hides.

Reproducible configuration matters here, because a dispatcher rule that quietly stopped matching between environments is a classic source of phantom slowness. The CIRCUIT piece on infrastructure as code deployments with Terraform shows how teams keep dispatcher, publish and author settings under version control rather than in one person's memory, which makes both the fix and the regression test far less painful.

There is a local wrinkle worth naming as well. Australian organisations running AEM for government, banking or telco clients are increasingly conscious of data residency, because the Privacy Act and the Notifiable Data Breaches scheme have pushed the location of logs and customer data from a footnote to a board-level question. Keeping diagnostic data in-country matters — ask the vendor where the log analyser actually stores its index before you point it at a production file.

Checks worth running before you call it fixed

Two short checklists cover most of what a useful investigation looks like, and they sit comfortably next to your dashboards.

In the request snoop:

  • Record the exact selector, thread and duration for the slowest request in the window.
  • Check whether the same resolution repeats across page views instead of hitting cache.
  • Note the split between time spent resolving the resource and time spent rendering it.
  • Capture a thread dump during the stall to see whether the request is blocked or busy.

Cross those observations against the aggregate view before you pick a fix, because the two tools describe different slices of the same traffic.

In the log analyser:

  • Sort by cumulative time, not request count, to find the paths costing the most seconds overall.
  • Compare p95 against p99 — a wide gap usually points at contention rather than one slow query.
  • Flag 404s and redirects on high-traffic paths, which often come from stale links in content.
  • Watch flush agent and replication activity in the same window as the degradation.

Then re-measure with the same method that found the problem. A fix that shifts the average while p99 stays ugly has moved the pain rather than removed it, and in a market where digital teams are spread across Sydney, Melbourne and Brisbane offices, repeatable measurement matters more than a heroic afternoon.

Both tools earn their place in the same toolkit, because they fail in different ways and cover each other's blind spots:

Signal Where you see it What it usually means First move
Slow resolution, fast render Request snoop JCR tree walk or expensive selector Rewrite the query or add a cacheable variant
Slow render, fast resolution Request snoop Sightly template doing heavy work Move the work out of the template
Repeated resolutions of one path Log analyser Cache miss or unmatched dispatcher rule Fix the cache rule before touching code
Wide p99 gap over a steady median Log analyser Contention, garbage collection, stuck thread Take a thread dump and a heap snapshot
Slow time to first byte, low CDN hit ratio Log analyser Cache purge loop or flush agent firing Check flush and replication activity
Tiny page, long total load Browser waterfall Asset weight rather than AEM Trim imagery and bundle front-end requests

Getting hands-on with the CIRCUIT material

CIRCUIT was a two-day Adobe developer event in Chicago built around AEM, with technical workshops, architecture sessions and the kind of hallway conversation where a dispatcher rule mystery gets solved between talks. The site keeps the event information, speaker details, agendas, pricing history and session recordings from the 2015 and 2016 runs, which makes it straightforward to find the performance material and follow it end to end rather than skimming slides.

If a slow page has been sitting on your desk this week, pull a production log sample, run it through the analyser and pick the single costliest path. Then watch that path live with the snoop for fifteen minutes while traffic is ordinary — arvo in Sydney, mid-morning in Melbourne, whenever your users are actually browsing — and write down what you find.

Take that result to the next workshop or community meet-up, because the questions that make these sessions worthwhile are the specific ones: which selector, which thread, which minute of the day. Read the archived session, replay your capture against a local instance, and if you are running a session yourself, hand attendees the log sample and the capture instead of talking at them from the front of the room.