Announcement Announcement Module
Collapse
No announcement yet.
Is there a performance hit using Spring AOP aspects? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is there a performance hit using Spring AOP aspects?

    What performance penalty (if any) would I incur by having 3 annotation driven aspects on the same method? Is it just a matter of Spring a few extra objects to handle/manage the aspects?

    Assuming that method execution processing is always the same - it's Spring's aspect management impact I'm after.

    Method below might be executed 100,000 per 24 hrs.

    Example method definition:

    @PipelineComponentMonitoring -- this uses around aspect & ProceedingJoinPoint.proceed()
    @PipelinePersistentPoint -- this uses around aspect & ProceedingJoinPoint.proceed()
    @PipelineExceptionHandlingRequired -- this uses after-throwing aspect to perform error handling if an exception is thrown.

    public void validate(Message<PipelineMessage> msg) throws Exception {
    ...
    }


    Example Application.xml

    <!--*********-->
    <!-- ASPECTS -->
    <!--*********-->


    HTML Code:
    	<aop:aspectj-autoproxy/>
    	
    	<beans:bean id="beanFactoryChannelResolver" class="org.springframework.integration.channel.BeanFactoryChannelResolver"/>
    
    	<beans:bean id="exceptionHandlingAdvice" class="com.abc.test.ExceptionHandlerAspect">
    		<beans:property name="beanFactoryChannelResolver" ref="beanFactoryChannelResolver"></beans:property>
    	</beans:bean>	
    	
        <aop:config>
            <aop:aspect id="exceptionHandlerAspect" ref="exceptionHandlingAdvice">
                 <aop:pointcut id="errorHandlingMethodPointcut" expression="@annotation(com.abc.test.PipelineExceptionHandlingRequired)" />
                <aop:after-throwing pointcut-ref="errorHandlingMethodPointcut" method="handleException" />
            </aop:aspect>   
        </aop:config>	
    
    	<beans:bean id="persistencePointHandlingAdvice" class="com.abc.test.PersistencePointHandlerAspect">
    		<beans:property name="beanFactoryChannelResolver" ref="beanFactoryChannelResolver"></beans:property>
    	</beans:bean>	
    	    <aop:config>
            <aop:aspect id="persistencePointHandlerAspect" ref="persistencePointHandlingAdvice">
                <aop:pointcut id="persistencePointMethodPointcut" expression="@annotation(com.abc.test.PipelinePersistentPoint)" />
                <aop:around pointcut-ref="persistencePointMethodPointcut" method="handlePersistencePoint" />
            </aop:aspect>   
        </aop:config>	
    
    	<beans:bean id="monitorHandlingAdvice" class="com.abc.test.PipelineComponentHandlerAspect">
    		<beans:property name="beanFactoryChannelResolver" ref="beanFactoryChannelResolver"></beans:property>
    	</beans:bean>	
    	    <aop:config>
            <aop:aspect id="pipelineMonitorHandlerAspect" ref="monitorHandlingAdvice">
                <aop:pointcut id="monitoringMethodPointcut" expression="@annotation(com.abc.test.PipelineComponentMonitoring)" />
                <aop:around pointcut-ref="monitoringMethodPointcut" method="handleMonitoring" />
            </aop:aspect>   
        </aop:config>
Working...
X