Accessing JCR node Concurrently/multi threading using apache jackrabbit | Community
Skip to main content
Arun_Chola
Level 2
December 13, 2017
Solved

Accessing JCR node Concurrently/multi threading using apache jackrabbit

  • December 13, 2017
  • 3 replies
  • 1945 views

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

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

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

3 replies

joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
December 13, 2017

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
December 15, 2017

Thanks for the info.

I have found another alternative solution.

joerghoh
Adobe Employee
Adobe Employee
December 15, 2017

Can you share the way you have found to work?

Jörg