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

Joerg Hoh updated SLING-13133:
------------------------------
    Description: 
In our AEM setup every call to ResourceResolver.listChildren() is invoking the 
MergingServletResourceProvider.listChldren():
{noformat}
        at 
org.apache.sling.jcr.resource.internal.helper.jcr.JcrNodeResourceIterator.next(JcrNodeResourceIterator.java:43)
        at 
org.apache.sling.servlets.resolver.internal.resource.MergingServletResourceProvider.listChildren(MergingServletResourceProvider.java:175)
        at 
org.apache.sling.resourceresolver.impl.providers.stateful.AuthenticatedResourceProvider.listChildren(AuthenticatedResourceProvider.java:169)
        at 
org.apache.sling.resourceresolver.impl.helper.ResourceResolverControl.listChildren(ResourceResolverControl.java:307)
        at 
org.apache.sling.resourceresolver.impl.ResourceResolverImpl.listChildren(ResourceResolverImpl.java:572)
        at 
org.apache.sling.api.resource.AbstractResource.listChildren(AbstractResource.java:91)
        at 
org.apache.sling.api.resource.ResourceWrapper.listChildren(ResourceWrapper.java:105)
{noformat}
MergingServletResourceProvider.listChldren() itself is iterating through all 
children of the parentProvider and ads them to a LinkedHashMap, eventually 
returning an iterator to the values of this map.

If the parentProvider has many children, and only a few of the children are 
read, this causes a massive overhead in terms of time and memory. This approach 
should be changed to a streaming approach, which consume children from the 
parentProvider only if required.

  was:
In our AEM setup every call to ResourceResolver.listChildren() is invoking the 
MergingServletResourceProvider.listChldren():
{noformat}
        at 
org.apache.sling.jcr.resource.internal.helper.jcr.JcrNodeResourceIterator.next(JcrNodeResourceIterator.java:43)
        at 
org.apache.sling.servlets.resolver.internal.resource.MergingServletResourceProvider.listChildren(MergingServletResourceProvider.java:175)
        at 
org.apache.sling.resourceresolver.impl.providers.stateful.AuthenticatedResourceProvider.listChildren(AuthenticatedResourceProvider.java:169)
        at 
org.apache.sling.resourceresolver.impl.helper.ResourceResolverControl.listChildren(ResourceResolverControl.java:307)
        at 
org.apache.sling.resourceresolver.impl.ResourceResolverImpl.listChildren(ResourceResolverImpl.java:572)
        at 
org.apache.sling.api.resource.AbstractResource.listChildren(AbstractResource.java:91)
        at 
org.apache.sling.api.resource.ResourceWrapper.listChildren(ResourceWrapper.java:105)
{noformat}
MergingServletResourceProvider.listChldren() itself is iterating through all 
children of the parentProvider and ads them to a LinkedHashMap, eventually 
returning an iterator to the values of this map.

If the parentProvider has many children, and only a few of the children are 
read, this causes a massive overhead in terms of time and memory. This approach 
should be changed to a streaming approach, which is only consume children from 
the parentProvider if required.


> MergingServletResourceProvider.listChildren() reads eagerly all children
> ------------------------------------------------------------------------
>
>                 Key: SLING-13133
>                 URL: https://issues.apache.org/jira/browse/SLING-13133
>             Project: Sling
>          Issue Type: Improvement
>          Components: Servlets
>    Affects Versions: Servlets Resolver 3.0.6
>            Reporter: Joerg Hoh
>            Assignee: Joerg Hoh
>            Priority: Major
>             Fix For: Servlets Resolver 3.0.8
>
>
> In our AEM setup every call to ResourceResolver.listChildren() is invoking 
> the MergingServletResourceProvider.listChldren():
> {noformat}
>       at 
> org.apache.sling.jcr.resource.internal.helper.jcr.JcrNodeResourceIterator.next(JcrNodeResourceIterator.java:43)
>       at 
> org.apache.sling.servlets.resolver.internal.resource.MergingServletResourceProvider.listChildren(MergingServletResourceProvider.java:175)
>       at 
> org.apache.sling.resourceresolver.impl.providers.stateful.AuthenticatedResourceProvider.listChildren(AuthenticatedResourceProvider.java:169)
>       at 
> org.apache.sling.resourceresolver.impl.helper.ResourceResolverControl.listChildren(ResourceResolverControl.java:307)
>       at 
> org.apache.sling.resourceresolver.impl.ResourceResolverImpl.listChildren(ResourceResolverImpl.java:572)
>       at 
> org.apache.sling.api.resource.AbstractResource.listChildren(AbstractResource.java:91)
>       at 
> org.apache.sling.api.resource.ResourceWrapper.listChildren(ResourceWrapper.java:105)
> {noformat}
> MergingServletResourceProvider.listChldren() itself is iterating through all 
> children of the parentProvider and ads them to a LinkedHashMap, eventually 
> returning an iterator to the values of this map.
> If the parentProvider has many children, and only a few of the children are 
> read, this causes a massive overhead in terms of time and memory. This 
> approach should be changed to a streaming approach, which consume children 
> from the parentProvider only if required.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to