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

Query: optimize for sling's i18n support

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.13
    • query
    • None

    Description

      There are some performance issues with sling's internationalization support query [0].

      The query for a specific locale looks like the following

      //element(*,mix:language)[@jcr:language='en']//element(*,sling:Message)[@sling:message]/(@sling:key|@sling:message)
      

      This turns into a join and it looks like it cannot properly leverage the index on the left side to filter out content on the right side of the join.

      I'm going to use a standard CQ setup for the following analysis.

      The left side of the join is quite efficient with a property index

      //element(*,mix:language)[@jcr:language='en']
      /libs/foundation/components/search/i18n/en
      /libs/foundation/components/mobilefooter/i18n/en
      /libs/commerce/components/search/i18n/en
      /libs/cq/searchpromote/components/pagination/i18n/en
      

      fast query, so far so good.

      Now the trouble begins running the right side

      //element(*,sling:Message)[@sling:message]/(@sling:key|@sling:message)
      

      As far as I see the biggest issue here is that the second query doesn't leverage the left side join info. This affects the overall query time twice

      • first it doesn't know that we're only looking for 'en' so the query will traverse all the existing translations in all the languages (goes up to 91k rows). So it will fetch 91k rows each time, filtering out for english at a later phase
      • second it appears to run the query for each of the left side hit, in our case 4 times making the first issue 4 times worse.

      [0] http://sling.apache.org/site/internationalization-support.html

      Attachments

        Issue Links

          Activity

            People

              stillalex Alex Deparvu
              stillalex Alex Deparvu
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: