You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by vo...@basf-it-services.com on 2003/11/02 19:44:29 UTC

[IMP] Performance Killer and Memory leak

Hi all,

after the Go Life of the new version of the BASF eCommerce Application,
running on top of Cocoon 2.1.2 we had a special performance effect.
After a restart of the server the startpage of the portal has a response
time of 70ms. After one day of work and a lot of page hits the response
time grows to 700ms and after one week to over 4seconds :-( The time was
nearly independent from the load of the server.

After a long time of debugging I found out the reason, it's inside
org.apache.avalon.excalibur.component.DefaultComponentFactory. The Factory
creates a special ComponentManagerProxy/ServiceManagerProxy for every
composable/servicable Component and pass this Instance to the
compose/service method.

The description why this Proxy is created:
/**
 * Proxy <code>ComponentManager</code> class to maintain references to
 * components looked up within a <code>Composable</code> instance created
 * by this factory.
 *
 * This class acts a safety net to ensure that all components looked
 * up within a <code>Composable</code> instance created by this factory are
 * released when the instance itself is released.
 */

What happen inside?

public Component lookup( String role ) throws ComponentException
{
    Component component = m_realManager.lookup( role );
    addUnreleased( component );
    return component;
}

public void release( Component component )
{
    removeUnreleased( component );
    m_realManager.release( component );
}

The lookup/release add/remove the component to/from an ArrayList. If you
have a lot of Components which lookup other Components inside the compose
method the List can be really big. If you have a lot of SubSitemaps which
use many InputModules it grows and grows ..... and the performance goes
down and down ...
Ok, but this is not the Killer. The Killer are Composable
RequestLifecycleComponents, because they are usually lookuped from other
Components using the ComponentManagerProxy but are released by the
CocoonComponentManager which doesn't use the ComponentManagerProxy. What
happen is, that they are not removed from the List, so the List explode.

I think this Proxy Class is completely unnecessary, because Components
which are lookup inside compose should be released inside dispose.

So my proposal is remove ComponentManagerProxy/ServiceManagerProxy from
DefaultComponentFactory.

What do you think?

Volker


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Re: [IMP] Performance Killer and Memory leak

Posted by Berin Loritsch <bl...@apache.org>.
volker.schmitt@basf-it-services.com wrote:


> The lookup/release add/remove the component to/from an ArrayList. If you
> have a lot of Components which lookup other Components inside the compose
> method the List can be really big. If you have a lot of SubSitemaps which
> use many InputModules it grows and grows ..... and the performance goes
> down and down ...

First: ArrayList is only helpful for small lists.  A better list type for
this case would be the LinkedList.

> Ok, but this is not the Killer. The Killer are Composable
> RequestLifecycleComponents, because they are usually lookuped from other
> Components using the ComponentManagerProxy but are released by the
> CocoonComponentManager which doesn't use the ComponentManagerProxy. What
> happen is, that they are not removed from the List, so the List explode.

This is a bug in COcoon's extension of the ECM project.  IT is something
that needs to be fixed.

Cocoon is welcome to update the ECM code in Excalibur if necessary.

-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


Re: [IMP] Performance Killer and Memory leak

Posted by Berin Loritsch <bl...@apache.org>.
volker.schmitt@basf-it-services.com wrote:


> The lookup/release add/remove the component to/from an ArrayList. If you
> have a lot of Components which lookup other Components inside the compose
> method the List can be really big. If you have a lot of SubSitemaps which
> use many InputModules it grows and grows ..... and the performance goes
> down and down ...

First: ArrayList is only helpful for small lists.  A better list type for
this case would be the LinkedList.

> Ok, but this is not the Killer. The Killer are Composable
> RequestLifecycleComponents, because they are usually lookuped from other
> Components using the ComponentManagerProxy but are released by the
> CocoonComponentManager which doesn't use the ComponentManagerProxy. What
> happen is, that they are not removed from the List, so the List explode.

This is a bug in COcoon's extension of the ECM project.  IT is something
that needs to be fixed.

Cocoon is welcome to update the ECM code in Excalibur if necessary.

-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org