CQ Search Performance Tuning
Performance Tuning
Search Performance Tuning
CQ uses different API to perform search against repository including JCR Search, Query Builder API
Search Indexes in CQ is stored under
- /crx-quickstart/repository/workspace/crx.default/index -> Lucene Index for Data
- /crx-quickstart/repository/repository/index -> Lucene Index for Version
In order to debug JCR Search you can do following:
JCR Query Debug
- Log into Felix Console: http://<host>:<port>/system/console/configMgr
- From "Factory Configurations", create "Apache Sling Logging Writer Configuration"
- Set value of "Log File" to "../logs/search.log"
- Click on "Save"
- From "Factory Configurations", create "Apache Sling Logging Logger Configuration"
- Set value of "Log Level" to "Debug"
- Set value of "Log File" to "../logs/search.log"
- Add "Logger" => org.apache.jackrabbit.core.query.QueryImpl If you are using SQL2 then use org.apache.jackrabbit.core.query.lucene.join.QueryEngine
- Click on "Save"
Starting with CRX 2.3, there is an MBean which exposes query statistics. These statistics include the top long running queries. The MBean can be accessed via any JMX client or the built-in client in the OSGi web console:
http://HOST:PORT/system/console/jmx/com.adobe.granite%3Atype%3DQueryStat
In order to debug search through Query Builder, you can use following URL
HOST:PORT/libs/cq/search/content/querydebug.html
You can do following to improve search performance (Only if search performance is slow)
Set CRX Search Index's resultFetchSize param
Result Fetch Size Config
If the result set of a jcr query is large, then the loading the complete setand checking ACLs on them is quite expensive.
To remedy this, limit the fetch size to 50 as via the SearchIndex element in the workspace.xml:
<param name="resultFetchSize" value="50"/>
e.g.
<SearchIndex class="com.day.crx.query.lucene.LuceneHandler">
<param name="path" value="${wsp.home}/index"/>
<param name="resultFetchSize" value="50"/>
</SearchIndex>
Set the CRX Search cacheSize param
Search Cache Size Setting
The search cacheSize can also be set in the SearchIndex element in workspace.xml. Set this parameter to 100000:
<param name="cacheSize" value="100000" />
e.g.
<SearchIndex class="com.day.crx.query.lucene.LuceneHandler">
<param name="path" value="${wsp.home}/index"/>
<param name="resultFetchSize" value="50"/>
<param name="cacheSize" value="100000" />
</SearchIndex>
This parameter is documented here.