FastAOP is a high performance AOP (Aspect Oriented Programming) framework for java. The framework was initially developed to support performance profiling and monitoring for large applications like J2EE based applications with nearly no runtime overhead. It was successfully tested with Websphere and Jboss Application Server
FastAOP was developed for performance monitoring. It can be installed in few minutes in any application or J2EE server. FastAop supports efficient load time weaving, so that it can be used with any application without changing the build process. On our download site you can find a framework called 'Perfmon'which is published as separate module in the fastAOP open source project. With 'Perfmon' it is possible to map architectural layers of the architecture to classes (e.g. a DAO layer is mapped to MyPersistenceDAO.class... end so on ) and define workflows. A workflow in this case is simply a number of consecutive method calls starting with a defined entry method. Such workflow specification starts the report generation for all executions of methods occurring until the entry method is finished. Once this method is finished the report will be written to the file system. 'Perfmon' generates automatically reports for all specified workflows and highlights the performance issues. 'Perfmon' also generates high level reports like: 30% time is spent in the database layer, 10% in the UI for the workflow XY. If a layer is making calls to other layers, the time spent in these layers is automatically subtracted from the time for the caller. This behavior is very important to detect the performance.
The first, second and third goal were mainly achieved using the ASM byte code manipulation library which has much higher performance than BCEL or Javassist (AspectJ is using BCEL and JBossAOP Javassist). We used the weaving patterns described in [Eugen Kuleshov: Using ASM framework to implement common Java byte code transformation patterns, 2007] and the Java 5 instrumentation API.
The fourth point was achieved by implementing the pointcut language strongly use-case driven, e.g. there was no need for cflow advices or field pointcut matching. FastAOP can determine if a pointcut will match or not at load time. All aspects in fastAOP are singletons, means an aspect instance is instantiated exactly one. This ability makes the framework extremely fast.
Overview
An aspect class is a simple Java class annotated with an @Aspect annotation and implementing an interface with before(..), after(..), and getPointcuts() methods. Unlike in AspectJ where pointcuts are defined as language constructs, in FastAOP a developer has to define pointcuts programmatically using a builder pattern:
Pointcut.classPattern("javax.ejb.SessionBean+"). .or("com.fastaop..*AbstractBean") .or("com.fastaop..*Bean*") .method("*").andNot("*SessionContext").andNot("create") .andNot("destroy").andNot("create").andNot("ejb*").compile();