Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-9780

Prefetch node states

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.46.0
    • api, core, documentmk
    • 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.

      Attachments

        Issue Links

          Activity

            People

              mreutegg Marcel Reutegger
              stefanegli Stefan Egli
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: