Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Accessing JCR node Concurrently/multi threading using apache jackrabbit

Arun_Chola
Level 2
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
Jörg_Hoh
Correct answer by
Employee
Employee

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
Jörg_Hoh
Correct answer by
Employee
Employee

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

Arun_Chola
Level 2
Level 2

Thanks for the info.

I have found another alternative solution.

Jörg_Hoh
Employee
Employee

Can you share the way you have found to work?

Jörg