Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

[AEM] Profile tool to identify slow areas of a code on AEM server side

Avatar

Level 1

We need to identify which code taking more time during page rendering. To do that we need to use profiling which can show the timings of operations execution (code which is called in models and beans). We tried to use built-in profiler http://localhost:4503/system/console/profiler, but it is too simple, just collects stack traces of running threads without any other information like time of execution, etc. Due to this, we need a full-fledged profiling tool to measuring the time of code execution during page rendering.
We are using AEM 6.1. Are there any other built-in profiling tools or which profile tool can we use to achieve our goal?

1 Reply

Avatar

Employee Advisor

You can use the recent requests page (/system/console/requests) which lists the details of the timings of page rendering down to a component/servlet level granularity. (The timing was changed once from miliseconds to microseconds, not sure if that was already done for AEM 6.1).

 

By default you can see here the details of the last 20 requests, which should be sufficient for testing. If if you want to increase this number, you can change the property "sling.max.request.record" ("Number of Requests to Record") on the SlingMainServlet to a higher value. 

 

Instead of writing timing information to the log files, you can easily write information into this view, so it's much easier to see them in context. The relevant searchterm / API is the RequestProgressTracker [1]

 

request.getRequestProgressTracker().log("my message");

 

[1] https://sling.apache.org/apidocs/sling11/org/apache/sling/api/request/RequestProgressTracker.html