Forcing xpath query timeouts | Community
Skip to main content
roberth55706517
Level 4
November 26, 2018
Solved

Forcing xpath query timeouts

  • November 26, 2018
  • 5 replies
  • 3111 views

I have a client that is on AEM 6.2 and I am being asked to set timeouts on xpath searches. Looking at the documents for javax.jcr.query.QueryManager, I don't see any way to do this.

Is there a way to watch a query's execution time and kill the thread after X number of seconds?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by joerghoh

Unfortunately that's not possible with the current implementation. But you can set limits how many nodes should be iterated at max.

Jörg

5 replies

joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
November 26, 2018

Unfortunately that's not possible with the current implementation. But you can set limits how many nodes should be iterated at max.

Jörg

roberth55706517
Level 4
November 26, 2018

That is what I was afraid of. The client has a lot of sites and authors are dumping large numbers of assets, many could be duplicates so the search in the sidekick for assets takes a very long time to return results. Limit would help where assets are found, but not in the case where it takes a long time to complete. That is the biggest problem is limiting queries that take very long to complete. The user might leave the page but the queries run on, consuming CPU cycles that are no longer needed.

Ravi_Pampana
Community Advisor
Community Advisor
November 26, 2018

Just a thought.

We can try doing multiple searches with limited nodes (1 call for each site) and append results. In this way, we can avoid additional calls if user leaves the page.

vipins5188
Level 3
November 26, 2018

Alternatively you can create oak indexes to optimise your query.

joerghoh
Adobe Employee
Adobe Employee
November 26, 2018

I guess the only chance to mitigate that is not to kill long-running query but to avoid long-running queries at all. Of course with all combinations used you can create arbitrarily complex queries which take a long time to complete. But I am not really aware of immediate issues where the sidekick is unusable due to slow queries. If that's the case I would contact Adobe support.

Do you have any query which is created by sidekick and which is slow or which is traversing the tree instead of using an index?

Jörg