Marcel Reutegger created OAK-2621:
-------------------------------------

             Summary: Too many reads for child nodes
                 Key: OAK-2621
                 URL: https://issues.apache.org/jira/browse/OAK-2621
             Project: Jackrabbit Oak
          Issue Type: Bug
    Affects Versions: 1.0
            Reporter: Marcel Reutegger
            Priority: Minor
             Fix For: 1.1.9


The DocumentNodeStore issues a lot of reads when sibling nodes are deleted, 
which are also index with a property index.

The following calls will become a hotspot:

{noformat}
        at 
org.apache.jackrabbit.oak.plugins.document.mongo.MongoDocumentStore.query(MongoDocumentStore.java:406)
        at 
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.readChildDocs(DocumentNodeStore.java:846)
        at 
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.readChildren(DocumentNodeStore.java:788)
        at 
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.getChildren(DocumentNodeStore.java:753)
        at 
org.apache.jackrabbit.oak.plugins.document.DocumentNodeState.getChildNodeCount(DocumentNodeState.java:194)
        at 
org.apache.jackrabbit.oak.plugins.memory.ModifiedNodeState.getChildNodeCount(ModifiedNodeState.java:198)
        at 
org.apache.jackrabbit.oak.plugins.memory.MutableNodeState.getChildNodeCount(MutableNodeState.java:265)
        at 
org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder.getChildNodeCount(MemoryNodeBuilder.java:293)
        at 
org.apache.jackrabbit.oak.plugins.index.property.strategy.ContentMirrorStoreStrategy.prune(ContentMirrorStoreStrategy.java:456)
{noformat}

I think the code triggering this issue is in 
{{ModifiedNodeState.getChildNodeCount()}}. It keeps track of already deleted 
children and requests {{max += deleted}}. The actual {{max}} is always 1 as 
requested from {{ContentMirrorStoreStrategy.prune()}}, but as more nodes get 
deleted, the higher {{max}} gets passed to 
{{DocumentNodeState.getChildNodeCount()}}. The DocumentNodeStore then checks if 
it has the children in the cache, only to find out the cache entry has too few 
entries and it needs to fetch one more.

It would be best to have a minimum number of child nodes to fetch from MongoDB 
in this case. E.g. when NodeState.getChildNodeEntries() is called, the 
DocumentNodeState fetches 100 children.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to