Here's the fix that can be applied to make sure that Oak Indexes are done faster:
- For LuceneIndexProvider OSGi config - Enable CopyOnWrite
- On path /oak:index/lucene add a String property indexPath=/oak:index/lucene
Note: AEM 6.2 ships with the above changes - and the above fix is applicable for 6.1 on Oak > 1.2.11
Here's how you can measure the performance:
- Enable the Trace logs for "org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorContext.perf"
- Below are statements to look for in the logs:
Before the change:
*TRACE* [pool-6-thread-2] org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorContext.perf Closed writer for directory Lucene Index : OOTBlucene [took 32235ms]
*TRACE* [pool-6-thread-2] org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorContext.perf Closed directory for directory Lucene Index : OOTBlucene [took 32236ms]
*TRACE* [pool-6-thread-2] org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorContext.perf Overall Closed IndexWriter for directory Lucene Index : OOTBlucene [took 32236ms]
After the change:
*TRACE* [pool-6-thread-1] org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorContext.perf Closed writer for directory Lucene Index : OOTBlucene(/oak:index/lucene) [took 737ms]
*TRACE* [pool-6-thread-1] org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorContext.perf Closed directory for directory Lucene Index : OOTBlucene(/oak:index/lucene) [took 738ms]
*TRACE* [pool-6-thread-1] org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorContext.perf Overall Closed IndexWriter for directory Lucene Index : OOTBlucene(/oak:index/lucene) [took 738ms]
- See the time difference.