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 "Jukka Zitting (JIRA)" <ji...@apache.org> on 2013/11/25 14:55:35 UTC

[jira] [Resolved] (OAK-1130) Performance issues with MutableTree

     [ https://issues.apache.org/jira/browse/OAK-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting resolved OAK-1130.
--------------------------------

    Resolution: Fixed

In revision 1545283 I removed the extra path lookups in query results; instead we use the Tree instances that were already loaded for the selectors. This results in some added performance boost:

{noformat}
# SimpleSearchTest        C     min     10%     50%     90%     max       N
Oak-Tar (before)          1      93      94      96      98     146     624
Oak-Tar (after)           1      77      78      79      80     115     760
{noformat}

I guess we can resolve this as fixed.

> Performance issues with MutableTree
> -----------------------------------
>
>                 Key: OAK-1130
>                 URL: https://issues.apache.org/jira/browse/OAK-1130
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core, query
>            Reporter: Thomas Mueller
>            Assignee: Jukka Zitting
>             Fix For: 0.12
>
>         Attachments: 0001-OAK-1130-Performance-issues-with-MutableTree.patch
>
>
> Benchmarks show that simple queries are slower in Oak than in Jackrabbit 2.x. The profiling data shows that most time is spent in the MemoryNodeBuilder (see below), called from MutableTree, even thought the query engine internally doesn't need mutable trees.
> It would be nice if creating a tree is faster (MemoryNodeBuilder, MutableTree and related). Many components would benefit from that. Unfortunately, the code is quite complex (meaning, I don't understand it).
> I found two alternatives to speed up queries:
> * Not use MutableTree within the query engine, but instead use ImmutableTree. This gave a small performance boost (maybe 15%)
> * Cache trees in the query engine, to avoid creating the same tree multiple times. This gave a speedup of about 50% (twice as fast) for some tests.
> Package summary and top stack trace as reported by the profiler.
> {code}
> summary:
> 65%: org.apache.jackrabbit.oak.plugins.memory
> 9%: org.apache.jackrabbit.oak.plugins.segment
> 4%: org.apache.jackrabbit.oak.jcr.session.operation
> 3%: org.apache.jackrabbit.oak.query
> 2%: com.google.common.collect
> 2%: org.apache.jackrabbit.oak.namepath
> 341/3234 (10%):
> org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder$ConnectedHead.getCurrentNodeState(MemoryNodeBuilder.java:601)
> org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder$UnconnectedHead.update(MemoryNodeBuilder.java:535)
> org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder.head(MemoryNodeBuilder.java:152)
> org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder.exists(MemoryNodeBuilder.java:254)
> org.apache.jackrabbit.oak.core.SecureNodeBuilder.getChildNode(SecureNodeBuilder.java:299)
> org.apache.jackrabbit.oak.core.MutableTree.<init>(MutableTree.java:76)
> org.apache.jackrabbit.oak.core.MutableTree.createChild(MutableTree.java:86)
> org.apache.jackrabbit.oak.core.MutableTree.getChild(MutableTree.java:222)
> org.apache.jackrabbit.oak.util.TreeUtil.getTree(TreeUtil.java:169)
> org.apache.jackrabbit.oak.query.QueryImpl.getTree(QueryImpl.java:604)
> org.apache.jackrabbit.oak.query.ast.AstElement.getTree(AstElement.java:126)
> org.apache.jackrabbit.oak.query.ast.SelectorImpl.currentTree(SelectorImpl.java:351)
> {code}
> Some benchmark results for the oak-run SimpleSearchTest with combination of changes (patch will follow). Just "N", meaning number of iterations within 10 seconds (higher is better), using Oak-Tar:
> * old (mutable tree, no cache): 36
> * immutable tree only: 42
> * cache only: 65
> * cache+immutable: 76



--
This message was sent by Atlassian JIRA
(v6.1#6144)