[jboss-jira] [JBoss JIRA] Commented: (JBAOP-716) CopyOnWriteArraySet usage leads to a bottleneck in joinpoint processing

Ales Justin (JIRA) jira-events at lists.jboss.org
Thu Apr 9 07:00:22 EDT 2009


    [ https://jira.jboss.org/jira/browse/JBAOP-716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12461424#action_12461424 ] 

Ales Justin commented on JBAOP-716:
-----------------------------------

There is a ConcurrentHashSet based on CHM in JBoss Commons.

> CopyOnWriteArraySet usage leads to a bottleneck in joinpoint processing
> -----------------------------------------------------------------------
>
>                 Key: JBAOP-716
>                 URL: https://jira.jboss.org/jira/browse/JBAOP-716
>             Project: JBoss AOP
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 2.1.0.CR3
>            Reporter: Jason T. Greene
>            Assignee: Kabir Khan
>             Fix For: 2.1.0.GA
>
>
> Deploying 50 EJB3 beans with 2000 methods each (and no annotations on them), leads to a 10 minute startup time.
> One of the major bottlenecks is finalizeMethodChain (see below), 50 invocations on it lead to 86K calls to adding a joinpoint, which leads to 88M calls on Method.equals().
> This is because Advisor uses CopyOnWriteArraySet to store these values, which means that everytime a method is added, the entire set is scanned before copying and then adding the value. I can think of a couple of possible options
> 1) Use FastCopyHashMap (in common core) like so:
>        if (! map.contains(blah)) 
>        {
>                newMap = map.clone();
>                newMap.put(blah, dummy);
>                chm.put(instance, newMap);
>       }
> 2) Use a CHM with a segment size of (1), and a low initial map size. This would keep the memory usage low, which i am guessing was the reason behind the array
>            
>     
>   23.3% - 471 s - 50 inv. org.jboss.aop.Advisor.finalizeMethodChain
>   22.5% - 453 s - 86,542 inv. org.jboss.aop.MethodMatchInfo.populateBindings
>   22.4% - 453 s - 86,542 inv. org.jboss.aop.MethodMatchInfo.overridePopulateBindings
>   22.3% - 449 s - 346,168 inv. org.jboss.aop.MethodMatchInfo.applyBinding
>   22.1% - 446 s - 346,168 inv. org.jboss.aop.Advisor.pointcutResolved
>   21.9% - 443 s - 346,168 inv. org.jboss.ejb3.interceptors.container.ManagedObjectAdvisor.createInterceptorChain
>   21.9% - 442 s - 346,168 inv. org.jboss.aop.Advisor.createInterceptorChain
>   12.0% - 242 s - 259,626 inv. org.jboss.aop.advice.AdviceFactory.create
>   11.1% - 223 s - 86,542 inv. org.jboss.aop.advice.PerJoinpointAdvice.createInterceptor
>   11.1% - 223 s - 86,542 inv. org.jboss.aop.advice.PerJoinpointAdvice.<init>
>   11.0% - 223 s - 86,542 inv. org.jboss.aop.Advisor.addPerInstanceJoinpointAspect
>   11.0% - 222 s - 86,542 inv. java.util.Set.add
>   8.1% - 164 s - 88,305,350 inv. org.jboss.aop.joinpoint.MethodJoinpoint.equals
>   2.7% - 54,483 ms - 88,305,350 inv. java.lang.reflect.Method.equals

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list