Monday 16 November 2015

How to find component load time on a page in AEM

You can use CQ timing info to get that data. timing load uses resource dumper https://sling.apache.org/apidocs/sling5/org/apache/sling/api/request/RequestProgressTracker.html to track load time of each jsp within page.

To enable debugging

version <= CQ5.6.1

1) Go to /libs/foundation/components/timing/timing.jsp through CRXDE light and comment following like of code

//uncomment the following to get more timing details in the page
out.println("\nRaw RequestProgressTracker data:");
StringBuilder mb = new StringBuilder();
Iterator<String> it = t.getMessages();
while(it.hasNext()) {
    mb.append(it.next());
}
out.print(mb.toString());
out.println("\nChartData dump:");
for(ChartBar d : chartData) {
    out.print(d.start);
    out.print(' ');
    out.print(d.fullname);
    out.print(" (");
    out.print(d.elapsed);
    out.println("ms)");
}

2) Make sure that timing.jsp is included in your global template using

<cq:include path="timing" resourceType="foundation/components/timing"/>

3) Load your page and do view source

4) Scroll down to bottom of page where you will see google chart URL



5) Copy that URL and paste it in browser to get timing info



CQ > 6

CQ 6 has this feature OOTB



Notes: Please also read http://dev.day.com/docs/en/cq/current/deploying/monitoring_and_maintaining.html to see how you can analyze request log to find page load time on server side. This is also very useful to find any thread contention issues wither using thread dump or session dump from felix console.

On client side there are different products you can use (I don't have preference) (AppDynamicNew Relic,Google Page SpeedGoogle Analytics etc) to find client side load time.

No comments :

Post a Comment