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 "Angela Schreiber (Jira)" <ji...@apache.org> on 2020/07/29 11:27:00 UTC
[jira] [Commented] (OAK-9158) Performance issue due to
AbstractDocumentNodeState#equals
[ https://issues.apache.org/jira/browse/OAK-9158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17167145#comment-17167145 ]
Angela Schreiber commented on OAK-9158:
---------------------------------------
[~mreutegg], [~julian.reschke@gmx.de], to my knowledge you have more recently working been on the {{AbstractDocumentNodeState}} and the documentmk in general. in case the original post on the list got lost in the general mail flood, i asked [~macster] to create a ticket such that we can properly track his analysis, report and proposed patch. hope that helps... unfortunately i don't feel i have enough insight to review the patch.
> Performance issue due to AbstractDocumentNodeState#equals
> ---------------------------------------------------------
>
> Key: OAK-9158
> URL: https://issues.apache.org/jira/browse/OAK-9158
> Project: Jackrabbit Oak
> Issue Type: Bug
> Components: documentmk
> Affects Versions: 1.10.8, 1.22.3
> Reporter: Alexander Lüders
> Priority: Major
> Attachments: inheritance.png, patch.txt, stacktrace.txt
>
>
> TL;DR: It seems like OAK-7401 broke the symmetry contract of AbstractDocumentNodeState#equals method. This may lead to lots of expensive queries during commit.
> ---
> We have a MongoDB as a backend of a Oak repository where we see hundreds of expensive queries being executed during a rather simple operation.
> It happens when we are saving a session in which we added a child node to a node already containing a very large number of children.
> This has not been the case with Jackrabbit Oak 1.4.8 and 1.4.26 but it is an issue with 1.10.8 and 1.22.3.
> Newer versions have not been tested yet but looking at the source we believe that they will show that performance issue too.
> +What we know so far:+
>
> * The queries against the _MongoDocumentStore_ are triggered via _AbstractNodeState.equals_ (see attached stacktrace)
> * A TODO "inefficient unless there are very few child nodes" in that method indicates poor performance but this has been there since a long time and cannot explain the issue
> * OAK-7401 introduced the class _ModifiedDocumentNodeState_ class which is not inheriting _ModifiedNodeState_ or _AbstractDocumentNodeState_ (see attached class inheritance diagram)
> * _AbstractDocumentNodeState#equals_ is checking against instances of _ModifiedNodeState_ and _AbstractDocumentNodeState_ but not _ModifiedDocumentNodeState_.
> * _AbstractDocumentNodeState#equals_ triggers the "slow" _AbstractNodeState#equals_ as a last resort
>
> Guessing from a high-level perspective it looks like the introduction of _ModifiedDocumentNodeState_ broke the equals logic in class _AbstractDocumentNodeState_.
> We compiled a patch that solves the performance issue. All test and integration tests of oak-document-store also passed.
> See corresponding attachment.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)