Announcement Announcement Module
Collapse
No announcement yet.
ltw/aspectjweaver.jar and poor performance Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ltw/aspectjweaver.jar and poor performance

    I have retrofitted the @Configurable annotation to my domain model (Consisting of about 244 classes, 8 of which currently need DI). We have a test rig based around integration tests that are run outside of our deployment environment - developers run these tests daily.

    Starting up those tests currently take about 15 seconds with our old, hibernate interceptor-based solution. After converting to @Configurable, the aspectj weaver prints statements for about 50 seconds in addition to the previous 15 seconds I mentioned.

    This is really painful because all of our developers run tests every few minutes or so. I have already narrowed the class space for the weaver down to the 244 classes mentioned, and only the @Configurable annotation class is included. I don't want to mention the 8 classes we need to have DI for directly - that would create more configuration and tight coupling between the configuration and code, and then I might just as well stick with the old hibernate interceptor. It seems that inspecting the classes is the bottleneck (for us, at least).

    This is really a killer since it in effect renders our test suite inoperable for interactive use.

    Are there any resources (or better yet, does anyone have any hints) that describe how I can optimize this further? Do other people see the same behaviour as I do?

    Sun JDK 1.5.0_02, spring 2.0rc2, by the way. It doesn't seem like I am swapping, I am running on a linux 2.6 box, 1GB memory, 3GHz Xeon. Contents of aop.xml:

    Code:
      <weaver 
    	 options="-showWeaveInfo,
                  -XmessageHandlerClass:org.springframework.aop.aspectj.AspectJWeaverMessageHandler">
    	 <include within="no.telio.model..*)"/>
    	 <exclude within="no.telio.model..*CGLIB*"/>
       </weaver>
       <aspects>
           <include within="org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect"/>
        </aspects>

  • #2
    It does not help to refine the aop.xml contents to:

    <include within="@org.springframework.beans.factory.annotat ion.Configurable no.telio.model..*"/>
    <include within="@org.springframework.transaction.annotatio n.Transactional no.telio..*"/>
    <exclude within="no.telio..*CGLIB*"/>

    Still at 50+ seconds

    It seems it is the class loader itself which is slow.

    Comment


    • #3
      I am surprised you're seeing such a degradation. I haven't seen similar. How have you enabled LTW?

      Comment


      • #4
        Originally posted by Rod Johnson
        How have you enabled LTW?
        These are, more or less, the steps I have taken:

        - remove the interceptor from my hibernate session factory that looks up spring prototypes
        - remove interceptor declaration
        - add @Configurable annotations, pointing to the existing spring-declared prototypes previously used by the interceptor I used before
        - I already have aspectjweaver.jar and spring-aspects.jar in my classpath - I use them for transaction demarcation
        - I have <aop:spring-configured/> and <tx:annotation-driven> elements in one of my application context files.
        - I have the following existing aspects in my application context:
        Code:
        	<aop:config>
        			<aop:advisor advice-ref="apiAuthorizer" pointcut="execution(public * no.telio.api.TelioAPIAuth.*(..))" />
          			<aop:advisor advice-ref="telioAPILoggerInterceptor" pointcut="execution(public * no.telio.api.TelioAPI.*(..))" />
        	</aop:config>
        (which do not seem to degrade performance)
        - I add "-javaagent:libs/runtime/aspectjweaver.jar" to the "Run..." meny for my junit test in exclipse (3.2).
        - I jave ajdt 1.4.0_20060629124300 enabled in eclipse
        - My aop.xml looks like this right now:
        Code:
        <!DOCTYPE aspectj PUBLIC
          "-//AspectJ//DTD//EN"    "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
        
        <aspectj>
        <!--   <weaver>
                 <include within="no.telio.model..*"/>
           </weaver>-->
           <weaver
                 options="-showWeaveInfo,
                      -XmessageHandlerClass:org.springframework.aop.aspectj.AspectJWeaverMessageHandler">
                 <include within="@org.springframework.beans.factory.annotation.Configurable no.telio.model..*"/>
                 <include within="@org.springframework.transaction.annotation.Transactional no.telio..*"/>
                 <exclude within="no.telio..*CGLIB*"/>
           </weaver>
           <aspects>
               <include within="org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect"/>
               <include within="org.springframework.transaction.aspectj.AnnotationTransactionAspect"/>
           </aspects>
        </aspectj>
        - java version is 1.5.0_02-b09
        - eclipse can grow to 1512M of heap memory, I have added arguments to the Run... vm argument meny to let my junit tests eat between 256M and 512M of memory.

        The weaving debug statements printed by aspectj are printed at a rate of about 1-3 per second if I let the weaver look at everything. I it looks to me like it takes about 200ms+ for the weaver to handle loading of one class, but Hibernate also is involved here, I guess.

        I have just verified my numbers again - 14 seconds to start running the code of one of my integration tests without LTW, 53 seconds with. 244 model classes, 17 of them with the Configurable annotation right now.

        There are a number of libraries I have not upgraded, though. Could this be related to old versions of CGLIB, Hibernate or something else?

        I am getting a fair amount of CGLIB proxies (and presumably a number of jdk5 proxies where they can be generated), which is why I stopped aspectj from weaving classes with CGLIB in their names.

        Comment


        • #5
          I too have seen massive performance degradation because of ltw.

          I had to give up on it, which is a shame.

          Not only did I have poor runtime performance, but sometimes the ltw would spew bytecode and other times my app just wouldn't come up.

          I've only got @Configurable in a few places, @Transactional in a few more.

          And since I haven't been able to figure out the aspectj compiler yet, I haven't been able to use aop yet.

          Comment


          • #6
            Anyone get a resolution on this? I've been having similiar issues with LTW and tomcat leading to OOM issues

            Comment


            • #7
              Im suffering similar problems using context:load-time-weaver. Running the tests in maven (surefire) bombs out with OOME.

              anyone ?

              rundis

              Comment


              • #8
                I haven't experienced any memory issues when running tests in maven or eclipse. I am using LTW and using spring-agent.jar. Can you post your test case?

                Comment


                • #9
                  HI,

                  I set up maven surefire to run with more memory explicitly adding heap configuration to argline. Seemed to do the trick.

                  rundis

                  Comment


                  • #10
                    I've had some luck with using the maven plugin for compile time weaving. I am struggling trying to get it to inject dependencies into JPA Entity Listeners but it does successfully inject my JPA Entities.

                    Code:
                                <plugin>
                                    <groupId>org.codehaus.mojo</groupId>
                                    <artifactId>aspectj-maven-plugin</artifactId>
                                    <version>1.2</version>
                                    <configuration>
                                        <showWeaveInfo>true</showWeaveInfo>
                                        <complianceLevel>${java.compiler.version}</complianceLevel>
                                        <aspectLibraries>
                                            <aspectLibrary>
                                                <groupId>org.springframework</groupId>
                                                <artifactId>spring-aspects</artifactId>
                                            </aspectLibrary>
                                        </aspectLibraries>
                                    </configuration>
                                    <executions>
                                        <execution>
                                            <goals>
                                                <goal>compile</goal>       <!-- use this goal to weave all your main classes -->
                                                <goal>test-compile</goal>  <!-- use this goal to weave all your test classes -->
                                            </goals>
                                        </execution>
                                    </executions>
                                </plugin>
                    Dustin

                    Comment

                    Working...
                    X