Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

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

Illia_Samoilenko
Level 1
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
Jörg_Hoh
Employee
Employee

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