Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Accessing JCR node Concurrently/multi threading using apache jackrabbit

Avatar

Level 2

Hi ,

I am using below code to get the chidnodes of a particular page. Suppose a parent page contains more than 1000 child pages. Below method approximately taking 5 to 10 minutes to complete.

JcrUtils.getChildNodes("ParentNode");

Thinking of doing multi threading for iterating child pages. I read that JCR/Jackrabbit does not support multi threading in a single session.

Any other alternative way to use multi threading concept in JCR?

Thanks

Arun

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi,

JcrUtils.getChildNodes() takes a node as parameter, not a string :-)

First of all, even with 10k of childnodes just iterating through them should not take 5-10 minutes. I would expect 5-10 seconds at maximum. Of course depending on various other environmental parameters (memory, segmentnodestore vs documentNodeStore, caching, disk, ACLs, ...)

Next question is, why do you have so many child nodes? By design? David's Model [1] is still valid for designing content structures in JCR, and Rule #2 recommends you to really think hard about using hierarchy.

And to finally answer your question: Listing the nodes is a non-splittable JCR API call; I don't think that you can iterate over the children of the same node (rather: path) in multiple sessions, handling a subset of childrens with each thread/session (from a global view. covering all childs) and get a performance improvement from it.

Jörg

[1] DavidsModel - Jackrabbit Wiki

View solution in original post

3 Replies

Avatar

Correct answer by
Employee Advisor

Hi,

JcrUtils.getChildNodes() takes a node as parameter, not a string :-)

First of all, even with 10k of childnodes just iterating through them should not take 5-10 minutes. I would expect 5-10 seconds at maximum. Of course depending on various other environmental parameters (memory, segmentnodestore vs documentNodeStore, caching, disk, ACLs, ...)

Next question is, why do you have so many child nodes? By design? David's Model [1] is still valid for designing content structures in JCR, and Rule #2 recommends you to really think hard about using hierarchy.

And to finally answer your question: Listing the nodes is a non-splittable JCR API call; I don't think that you can iterate over the children of the same node (rather: path) in multiple sessions, handling a subset of childrens with each thread/session (from a global view. covering all childs) and get a performance improvement from it.

Jörg

[1] DavidsModel - Jackrabbit Wiki

Avatar

Level 2

Thanks for the info.

I have found another alternative solution.

Avatar

Employee Advisor

Can you share the way you have found to work?

Jörg