[ 
https://issues.apache.org/jira/browse/ARIES-1356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14708457#comment-14708457
 ] 

John Ross commented on ARIES-1356:
----------------------------------

The getInstance method is called often, and I'm not surprised it suffers from a 
lot of contention. However, the solution in the patch is to basically remove 
the protection from the instance field, which is read from and written to by 
multiple threads. It looks like it would be okay to simply make the instance 
field volatile and remove the synchronization from the method. I also think 
that checkInstance can be merged into getInstance to make things clearer. 
Finally, it would be interesting to see how much of an impact the entry/exit 
logging is having. Was the log level set to debug during your trials perchance? 
I think this was added to troubleshoot some issues early on and is no longer 
necessary.

private static volatile Activator instance;
public static Activator getInstance() {
        Activator result = instance;
        if (result == null) {
                throw new IllegalStateException("The activator has not been 
initialized or has been shutdown");
        }
        return result;
}

Are you in a position to give that a shot to see if the results are similar? 
Short of that, I think we're looking at a fairly major refactoring here. It 
looks like at least some of the synchronization and volatiles surrounding the 
Activator could be removed by relying on some implicit framework guarantees, 
but that would be a much larger piece of work in terms of both analysis and 
code changes.

> getInstance method on the core Activator shows up on jvisualvm sampling 
> during performance analysis
> ---------------------------------------------------------------------------------------------------
>
>                 Key: ARIES-1356
>                 URL: https://issues.apache.org/jira/browse/ARIES-1356
>             Project: Aries
>          Issue Type: Improvement
>          Components: Subsystem
>    Affects Versions: subsystem-core-1.2.0, subsystem-2.0.1
>         Environment: Java windows linux
>            Reporter: Bas
>            Priority: Minor
>              Labels: patch, performance
>             Fix For: subsystem-core-1.2.0
>
>         Attachments: subsystem-activator-patch.txt
>
>
> The 'getInstance' method on the core Activator shows up on jvisualvm sampling 
> during performance analysis.
> While doing performance analyses because of poor subsystem install 
> performance while running 200 subsystems we encountered the 'getInstance' 
> method in jvisualvm statistics. It is called so much that it actually cost 4 
> seconds on the total process of installing two subsystems when 200 subsystems 
> have been deployed already.
> While using the patch below we didn't notice it anymore in jvisualvm sampling.



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

Reply via email to