Logo
StartDownloadsDocumentationPublicationsContactCommunityDevelopers

JAsCo Run-time Weaver

JAsCo is one of the first approaches to implement a real run-time weaver that weaves and unweaves the aspects physically into the target application while it is running. The principle of the JAsCo runtime weaver is identical to AspectJ’s weaver, except that the weaving happens at run-time. Unlike a lot of other approaches, unweaving and reweaving during runtime are possible, even at joinpoints that are not woven before! The performance of the JAsCo run-time weaver is able to compete with AspectJ and AspectWerkz, and in some cases even improve, while allowing the additional flexibility of genuine run-time weaving.

The main advantage of this run-time weaver with respect to the previous JAsCo implementation (HotSwap+Jutta) is performance. The functionality remains identical, but because the aspects are woven into the target application, the aspects’ logic executes faster and additional optimalizations are possible.

System Requirements

  • Requires a Java 1.5 compatible virtual machine. (only tested on Sun’s HotSpot VM at the moment)
  • JAsCo 0.7 or higher.

How-to

Make sure to run JAsCo using the HotSwap2 startup command and also enable the run-time weaver using the following command: -Djasco.hotswap.inlinecompiler=true.

Example usage:

 java -javaagent:/home/test/jasco/jasco.jar -Djasco.hotswap.inlinecompiler=true MainPackage.MainClass

More information on running JAsCo HotSwap2 can be found here.

It is also possible to specify a heuristics function to decide on a per-joinpoint basis whether traps have to be inserted or whether the aspects are invasively weaved. Traps are inserted faster and do not have to be altered when aspects are added or removed to the trap’s joinpoint. The run-time weaver takes more time for the weaving itself and for every additional aspect to the joinpoint, the joinpoint has to be reweaved, which takes time. At the other hand, the run-time performance of the run-time weaver is a lot better. For more information on the different JAsCo weavers, see the paper below, or one of the articles available here.

In order allow users to tweak their applications for fastest performance, the heuristitcs function allows to decide for which joinpoints run-time weaving is used and for which traps are used. To do this, implement a class that implements the following interface: jasco.runtime.inline.InlineHeuristics . This interface contains one method:

public boolean inlineCompile(MethodJoinpoint method, Vector hooks);

When this method returns true, the run-time weaver is employed. Otherwise, a trap is inserted. The first argument (MethodJoinpoint) contains reflective data about the current method joinpoint, the second argument contains the list of hooks that are applicable at this joinpoint. Both information can thus be used to assess whether the inline compiler has to be triggered. Finally, inform the JAsCo run-time infrastructure about this heuristics by specifying the following command: -Djasco.hotswap.inlinecompiler.heuristics=FullClassNameOfHeuristics

Limitations of the current implementation

  • The run-time weaver does not work for the following joinpoints (reverts to regular and slower interpreter):
    • connectors that are declared non-static
    • hooks that define a dynamic condition (withincode, cflow, isApplicable, stateful aspects,...) AND are applied in a connector using a combination strategy
  • The time for the weaving itself is still quite long in the current version (0.8.0) (see benchmarks), this will be addressed in one of the next releases.

Benchmark Evalution

We performed several bencmarks using the AWBench benchmarking project made by the AspectWerkz team.

The results are described in the following paper: De Fraine, B., Vanderperren, W., Suvee, D. and Brichau, J. Jumping Aspects Revisited. In Proceedings of DAW 2005, Chicago, USA, March 2005. [download draft]

For more info on AWBench and downloads, see the official AWBench website. JAsCo is integrated in the version downloadable from their CVS.

The figure below shows AWBench benchmark results run on a PENTIUM4, 2GHZ, 256 RAM with Ubuntu Linux 4.10, Java 1.5.0 update 1 and JAsCo 0.8.5M1. Notice the logarithmic scale of the timings in order to keep every result readable.

JAsCo including the novel run-time weaver is able to compete with both AspectJ and AspectWerkz and performs significantly better than the other approaches. For instance, JAsCo executes all advices at least hundred times faster than Spring/AOP. Also notice the improvement over running JAsCo without the run-time weaver (JAsCo noRTW).

More benchmarks including weave-time, aspect factories, stateful aspects will be published soon!

documentation/ruw.txt · Last modified: 13.06.2005 14:18 by wvdperre
SiteMapRecent Content by SSEL ©2002-2005     Latest JAsCo Release: JAsCo 0.8.7 (revised 2005-11-25 16:29:02)