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 "Thomas Mueller (JIRA)" <ji...@apache.org> on 2013/05/16 16:09:16 UTC

[jira] [Commented] (OAK-825) Unnecessary performance overhead in MongoMK's calculation of keys for the nodeCache, nodeChildrenCache

    [ https://issues.apache.org/jira/browse/OAK-825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13659552#comment-13659552 ] 

Thomas Mueller commented on OAK-825:
------------------------------------

Using a NodeRev class sounds like a good solution.

The biggest performance problem I see in my tests is that MongoDB documents can grow very large, because they are not split. I will first have a look at this problem.
                
> Unnecessary performance overhead in MongoMK's calculation of keys for the nodeCache, nodeChildrenCache
> ------------------------------------------------------------------------------------------------------
>
>                 Key: OAK-825
>                 URL: https://issues.apache.org/jira/browse/OAK-825
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: mongomk
>    Affects Versions: 0.7
>            Reporter: Lukas Eder
>         Attachments: MongoMK.nodeCache.png
>
>
> The key of MongoMK.nodeCache and nodeChildrenCache is currently a String, whose evaluation is somewhat expensive:
> {code}
> path + "@" + rev
> {code}
> In the above code, "rev.toString()" internally creates another StringBuilder to generate another intermediate string. The attached screenshot shows that around 5% of profiling time within "MongoMK.getNode()" is wasted in order to calculate the caching key. Other methods are also affected.
> A simple way to improve this is to reuse a single StringBuilder for the key, as such:
> {code}
> StringBuilder sb = new StringBuilder();
> sb.append(path);
> sb.append("@");
> rev.appendTo(sb);
> {code}
> A better way would probably be to wrap "path" and "rev" in another re-usable "NodeRev" object to be used instead of using two references "path" and "rev". The "NodeRev" object would provide appropriate equals() and hashCode() implementations.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira