Expand my Community achievements bar.

SOLVED

Issues with Queries using sling:resource property

Avatar

Level 3

hi,

We are using aem 6.1 with oak version 1.2.7.

We see lot of traversal warnings for queries which use sling:resource property. Mostly these queries have paths for assets. Not sure when exactly this query is triggered by AEM.

There is already OOB oak property index available for sling:resource property but still these queries give warnings.

Sample Query

13.04.2016 10:41:31.328 *WARN* [pool-11-thread-5-<main queue>(com/adobe/cq/collection/update/job)] org.apache.jackrabbit.oak.plugins.index.property.strategy.ContentMirrorStoreStrategy Traversed 10000 nodes (15345 index entries) using index slingResource with filter Filter(query=select [jcr:path], [jcr:score], * from [nt:unstructured] as a where [sling:resource] like '/content/dam/cxxc/yyy/xxx/yy/1860x1050-fm-D11C-330-370-410-450.png%' and isdescendantnode(a, '/content/dam') /* xpath: /jcr:root/content/dam//element(*, nt:unstructured)[jcr:like(@sling:resource, '/content/dam/cxxc/yyy/xxx/yy/1860x1050-fm-D11C-330-370-410-450.png%')] */, path=/content/dam//*, property=[sling:resource=[[/content/dam/cxxc/yyy/xxx/yy/1860x1050-fm-D11C-330-370-410-450.png.., ../content/dam/cxxc/yyy/xxx/yy/1860x1050-fm-D11C-330-370-410-450.pnh]]])

These warnings are causing performance issues in author.

Thanks,

Deepikaa

1 Accepted Solution

Avatar

Correct answer by
Level 2

Solution for this particular issue is to have lucene property index.Not sure why existing oak property index didnt work.We had to disable it and put in lucene property index as shown below

 

"slingResourceLucene": {

    "jcr:primaryType": "oak:QueryIndexDefinition",

    "compatVersion": 2,

    "type": "lucene",

    "async": "async",

    "reindex": false,

    "reindexCount": 1,

    "indexRules": {

      "jcr:primaryType": "nt:unstructured",

      "nt:unstructured": {

        "jcr:primaryType": "nt:unstructured",

        "properties": {

          "jcr:primaryType": "nt:unstructured",

          "slingResource": {

            "jcr:primaryType": "nt:unstructured",

            "propertyIndex": true,

            "name": "sling:resource"

            }

          }
        }

      }

    }

  }

View solution in original post

16 Replies

Avatar

Level 10

If you have done OAK Indexing - that is the best way to improve performance when querying in AEM for 6.x. 

For those reading this thread and not aware of OAK indexing - see this GEMS session: 

http://dev.day.com/content/ddc/en/gems/oak-lucene-indexes.html

Avatar

Level 10

Can you please provide the exact syntax of the query you are using. 

Avatar

Level 3

Hi Scott,

1.Regarding the query syntax - 

Actually our application doesn't trigger this query. I think AEM itself does it when we either search for an asset in cf or in dam,but i am not sure when this query is actually triggered.

I have already put up the warning that comes in error logs. I have just changed asset path to a dummy value.When i tried identifying slow running queries using qla.jar, I got lot of entries like this for different assets in dam.

  Query: /jcr:root/content/dam//element(*, nt:unstructured)
        [jcr:like(@sling:resource, '/content/dam/test/business/markets/country/en-gb/news/0/Sample0.PDF/subassets/page0.pdf%')]
  Longest: /jcr:root/content/dam//element(*, nt:unstructured)
        [jcr:like(@sling:resource, ''/content/dam/test/business/markets/country/en-gb/news/news/2016/Sample4.PDF/subassets/page1.pdf%')]
  10,000 nodes traversed; ran 1 times, max 10,000 nodes, 2,234 lines 

2.There is already oak property index available for this (given below) and i also see that query is using this index.May be should we use lucene property index or fine tune the existing index?

<slingResource
        jcr:primaryType="oak:QueryIndexDefinition"
        propertyNames="{Name}[sling:resource]"
        reindex="{Boolean}false"
        reindexCount="{Long}1"
        type="property"/>

Avatar

Level 7

This looks like, the queries are getting triggered when you are searching digital assets in the AEM. Now one of the many causes might be the assets are heavy weight and while searching 10000 nodes should not be a big deal for AEM, still the weight of the assets might be playing a vital role here. 

What is the exact nature of your search, is it some search where the users are searching the website or this is some search which the developers and the content authors are doing. It looks like from your reply that you are experiencing the second scenario. In this case as Scott mentioned indexing is the way of optimizing a query so avoid performance issues.

Since this is not likely to affect the user experience I would not worry much about the warning much as long as its not wasting precious development and authoring time.

 

Thanks

Tuhin

Avatar

Level 3

Hi Tuhin,

This is not site search,this happens only in author instance. Our author severs are performing very slow and during our analysis we found these warnings popping up for nearly 2500 times in a day.

I think query is already using existing oak index ,i could see this phrase "using index slingResource " in the warning.

I tried re-indexing this index but still no visible results.

 

Thanks,

Deepikaa

Avatar

Level 7

Hi Deepika,

To be honest, right now I am not able to determine the exact reason of this issue. I would recommend doing a offline compaction once on your servers and see if this helps. Though not a foolproof solution to your problem but it might help you.

Thanks

Tuhin 

Avatar

Level 3

Thanks  for the reply Tuhin.

Have raised day care ticket for this.

Avatar

Level 7

Hi Deepika,

Kindly close this ticket then.

Thanks

Tuhin

Avatar

Level 2

I shall close this with solution provided so that others can refer it.

Also I am nt sure how exactly to close a question here.

Avatar

Level 7
        You just need to mark the answer as correct and that should suffice. Thanks Tuhin

Avatar

Correct answer by
Level 2

Solution for this particular issue is to have lucene property index.Not sure why existing oak property index didnt work.We had to disable it and put in lucene property index as shown below

 

"slingResourceLucene": {

    "jcr:primaryType": "oak:QueryIndexDefinition",

    "compatVersion": 2,

    "type": "lucene",

    "async": "async",

    "reindex": false,

    "reindexCount": 1,

    "indexRules": {

      "jcr:primaryType": "nt:unstructured",

      "nt:unstructured": {

        "jcr:primaryType": "nt:unstructured",

        "properties": {

          "jcr:primaryType": "nt:unstructured",

          "slingResource": {

            "jcr:primaryType": "nt:unstructured",

            "propertyIndex": true,

            "name": "sling:resource"

            }

          }
        }

      }

    }

  }

Avatar

Level 7

Hi Deepikaa,

 

Was this solution given by Adobe ? If yes what was the rationale provided?

 

Thanks and Regards,

Tuhin

Avatar

Level 3

Hi Deepika,

I am also facing the same issue. Could you please share your findings if your issue is resolved?

Any pointers would be highly appreciated.

Thanks,

Avatar

Level 3

Hi Tuhin, 

 

Sorry for very delayed response. Yes this was given by Adobe.

This was the reason given by Adobe Support ,

, lets disable sling:Resource property index at oak:index/slingResource as I can see in your query string its searching using jcr:like over the property sling:Resource. Hence, lets disable from oak:index/slingResource and add these property under oak:index/lucene/nt:base like I have mentioned. To disable oak:index/slingResource change the type property value to disable.

There is caution note, if we see the oak:index/slingResource indexes are needed in future then we have enable it as either of one would be picked based on the cost and oak:index/slingResource would have less cost over the lucene one. 

Thanks,

Deepikaa

Avatar

Level 3

RadhikaKush wrote...

Hi Deepika,

I am also facing the same issue. Could you please share your findings if your issue is resolved?

Any pointers would be highly appreciated.

Thanks,

 

Hi Radhika,

If you have the same issue,did you try putting the lucene index as stated above?

could you please post the warning you get so that i can say if this one index will serve your query.

Thanks,

Deepikaa

Avatar

Community Advisor

Hi,

Does anyone know's DayCare/Engineering ticket number related to this issue?


Regards,

Peter