You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Miroslav Smiljanic (Jira)" <ji...@apache.org> on 2021/05/27 08:55:00 UTC
[jira] [Resolved] (OAK-9332) Document best practices and
anti-patterns in repository tree traversal
[ https://issues.apache.org/jira/browse/OAK-9332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Miroslav Smiljanic resolved OAK-9332.
-------------------------------------
Fix Version/s: 1.40.0
Assignee: Miroslav Smiljanic
Resolution: Fixed
> Document best practices and anti-patterns in repository tree traversal
> ------------------------------------------------------------------------
>
> Key: OAK-9332
> URL: https://issues.apache.org/jira/browse/OAK-9332
> Project: Jackrabbit Oak
> Issue Type: Improvement
> Components: doc
> Reporter: Miroslav Smiljanic
> Assignee: Miroslav Smiljanic
> Priority: Major
> Fix For: 1.40.0
>
>
> When using JCR API, there is more than one way to perform tree/path traversal:
> {code:java}
> Node c = session.getNode("/a/b/c");
> Node d = null;
> //get child node
> d = session.getNode("/a/b/c/d");
> d = c.getNode("d");
> // get parent node
> c = d.getParent();
> c = session.getNode("/a/b/c");
> {code}
> To traverse a path using Node API with performs better compared to Session API.
> {noformat}
> > java -jar target/oak-benchmarks-*-SNAPSHOT.jar benchmark GetParentNodeWithNodeAPI GetParentNodeWithSessionAPI Oak-Segment-Tar
> Apache Jackrabbit Oak 1.37-SNAPSHOT
> # GetParentNodeWithNodeAPI C min 10% 50% 90% max N mean
> Oak-Segment-Tar 1 2 2 2 3 5 25891 2
> # GetParentNodeWithSessionAP C min 10% 50% 90% max N mean
> Oak-Segment-Tar 1 26 27 29 32 40 2069 29{noformat}
> Example where Session API is used: https://issues.apache.org/jira/browse/SLING-10011
> Considering Oak implementation details (tree repository structure, ACL evaluation, ...) the best practice for path traversal should be explicitly documented.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)