Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Cache warming for DocumentNodeStore. Goal is for indexing to warm up the cache for a select few eg paths to allow for faster iterating/reading of the same eg paths later on.
Example usage
The common usage is to read a number of query result paths from the index (depending on the configured prefetch count), and then prefetches these nodes from the node store. To enable prefetch for all queries, use the QueryEngineSettings JMX bean, setting "PrefetchCount" (default 0). Also supported is enabling prefetch for an individual query, by appending "option(prefetches <number of nodes>)":
select * from [dam:Asset] where contains(*, 'admin') option(prefetches 100)
Relative Prefetch
We found that existing code often executes queries, and then for each result node, it reads some additional nodes (satellite data). To better support this common pattern, we support relative prefetch. This is done by appending "option(prefetch(<relative path>,...))" to the query. If we already know that the application will read the child node "jcr:content/comments" and "jcr:content/metadata" for each of the results, use:
select * from [dam:Asset] where contains(*, 'admin') option ( prefetches 100, prefetch ( 'jcr:content/comments', 'jcr:content/metadata' ) )
We found that often, prefetch of 20 to 100 is faster than a higher prefetch count. (This is because the cache might evict the entries if access is too far in the future.) We recommend to test with different prefetch options.