Spring AOP vs AspectJ startup perf / memory reqs

I am trying to improve launch performance for our wars, since we essentially host a service-based backend where we have about 50+ wars (one for each service). Deploying all of these services at the same time sometimes causes PermGen, and restarting the server may take some time. Therefore, I am trying to evaluate all the features of the architecture (WLS, Spring, Hibernate, CXF) to improve performance.

All our transactions are performed using Spring AOP, and some of our SLA / Policies use POOP points.

I saw some cases where our Spring AOP pointcuts were either poorly created or we had a lot that could lead JUnits to PermGen. Where it seems like most of the startup time is to create a pointcut and search for pointcut objects (so I combined some of our custom Pointcut / Interceptor classes into one class and one Pointcut, which reduced the number of Pointcuts created at startup by about 30%) .

Is it worth it to convert all this to AspectJ (which I have not used before) to get some benefits from weaving compilation time? Will this provide a higher startup speed as well as memory usage?

I looked through the posts:

Spring slow AOP startup time

Spring AOP vs AspectJ

And I definitely look purely on a way to take the load off the startup and memory requirements and just want to try to migrate if it's worth the effort.

+4
source share
1 answer

I struggled with this very problem and did not get a good answer, but here is what I have tried so far, this can save you some time.

I use LTW with AspectJ 1.7.1, and it adds about 3 seconds to my startup time, I use it with tomcat with a custom classloader, and I configured it to only view my code without other packages. The rest of the time I run it seems spring to me, analyzing my code base for autorun based on annotations.

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 SSD machine, if you are not so fast, it can take a lot longer.

The new AspectJ 1.7 has a chaching mode for LTW to speed it up, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=367673 I did not use it, Know how well this works.

The quickest choice is to turn the project into an AspectJ project, then there is no startup cost due to aspectJ, because we are compiling in time. I do not use this parameter because I did not bother to integrate aspectJ into my build system, and I do not want to write the aspect too easily :)

0
source

Source: https://habr.com/ru/post/1397501/


All Articles