jackrabbit-oak-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Miroslav Smiljanic (Jira)" <j...@apache.org>
Subject [jira] [Closed] (OAK-9158) Performance issue due to AbstractDocumentNodeState#equals
Date Thu, 03 Jun 2021 14:54:06 GMT

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

Miroslav Smiljanic closed OAK-9158.
-----------------------------------

> 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
>            Assignee: Marcel Reutegger
>            Priority: Major
>             Fix For: 1.40.0
>
>         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)

Mime
View raw message