Debugging Jackrabbit Oak indexes in AEM 6

0

When those “traverse” messages pop up in your logs within some queries are performed, it is likely you will need to take action and create index(es).

There are tools that can be used to find problematic queries and to fix them.

Oak Buddy

Oak Buddy provides suggestions for indexes to address problems with specific queries. Based on your needs, you may need to tweak the indexes. An example of a tweak could be limiting the directories that are indexed. The index definition Oak Buddy provides are for the whole repository. Limit the index to a specific path if the content to be queried is all under a single path.

http://oakutils.appspot.com/generate/index

Query Performance Dashboard

View log running and popular queries.
It is important to look at two things when troubleshooting queries. How long the query takes to run, of course, is one consideration. But a query that runs only once a month and takes 100 seconds should not be indexed unless it is crucial for that query to return information quickly. You need to look at the combination of how long it takes plus how common the query is. A query that takes 500 milliseconds and runs 100,000 times a day is very important to optimize. One that takes 10 seconds but runs once a day may not be.

URL within AEM: /libs/granite/operations/content/diagnosis/tool.html/_granite_queryperformance

There is a JMX service in AEM that can provide information about both the most common queries and the longest running queries:
URL within AEM: /system/console/jmx/org.apache.jackrabbit.oak%3Aid%3D9%2Cname%3D%22Oak+Query+Statistics%22%2Ctype%3D%22QueryStat%22

Explain Query

Available for AEM 6.1 and AEM 6.0 by installing ACS Tools. Shipped with AEM 6.2. This shows usage of indexes when running queries.

https://adobe-consulting-services.github.io/acs-aem-tools/explain-query.html

rlog

The rlog utility is part of the toolset that comes with AEM. Find it in the quickstart directory under opt/helpers. This helps to find the longest running requests. When there are multiple requests on a page, this tool allows you to see which ones are the most problematic.

See “Using rlog.jar to find requests with long duration times” at https://docs.adobe.com/docs/en/cq/5-6-1/deploying/monitoring_and_maintaining.html

Logging

Set up a log for org.apache.jackrabbit.oak.query.QueryImpl at the debug level. This will show what indexes queries are using.

About The Author

Deke departed Southern Alabama as a young man, leaving the humidity and fire ants behind. The fire ants are catching up with him. He works for Adobe. Despite that, his opinions expressed on this site are his own and should never, ever, be attributed or blamed on Adobe. Ask him what he thinks of chiggars sometime. Home Page | GitHub | Adobe Blog | Twitter | LinkedIn