4
votes

I am trying to improve the startup performance for our wars, since we are essentially hosting a services based backend where we have around 50+ wars (one for each service). Deployment of all these services at once sometimes causes PermGen and also the restarting of the server can take quite awhile. So I am trying to evaluate all the possibilities of the architecture (WLS, Spring, Hibernate, CXF) for performance gains.

All our transactions are done through Spring AOP and some of our SLA/Policies utilize AOP Pointcuts.

I have seen some cases where our Spring AOP pointcuts were either poorly created or we had to many that would cause JUnits to PermGen. Where it appears like much of the startup time is the creation of the pointcuts and retrieval of the pointcut objects (so I merged some of our custom Pointcut/Interceptor classes into a single class and single Pointcut, which reduced the amount of Pointcuts created at startup by about 30%).

Is it worth converting all of this to AspectJ (which I haven't used before) in order to get some benefits out of compile time weaving? Would this provide better speed for startup performance as well as memory usage?

I have looked at the posts:

Spring AOP slow startup time

Spring AOP vs AspectJ

And I am definitely looking purely from a way to take the load off of the startup and memory requirements, and only want to make an attempt to migrate if it is worth the effort.

1

1 Answers

0
votes

I have struggled with this very same issue and have not come up with a good answer, but here is what I have tried so far, it might save you some time.

I am using LTW with AspectJ 1.7.1 and it adds about 3 seconds to my startup time, I am using it with tomcat with the custom class loader and I have it configured to only scan my code an no other packages. The rest of my startup time seems to me spring analyzing my code base for annotation based autowiring.

08:11:27,878 INFO  [DefaultContextLoadTimeWeaver] Using a reflective load-time weaver for class loader: org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader
08:11:30,326 INFO -- the last info printed from the LTW infrastructure 

I have a pretty fast machine with an SSD if you are machine is not as fast this could take much longer.

The new AspectJ 1.7 has as a chaching mode for LTW to speed it up see https://bugs.eclipse.org/bugs/show_bug.cgi?id=367673 I have not used it so I don't know how well it works.

fastest choice is to turn the project into an AspectJ project then there is no startup overhead due to aspectJ because we are doing compile time weaving. I am not using this option because i have not bothered to integrate aspectJ into my build system and I don't wan't to make it too easy to write an aspect :)