 |
dynaop 1.0 beta
Posted by crazybob on February 11, 2004 at 04:16 PM | Comments (17)
When we started our project six months ago, we didn't consider AOP at first. After digging deeper into the design, we recognized the unwelcome presence of crosscutting concerns and couldn't deny the urge to reduce dependencies and avoid rote, error-prone code. With an ideal AOP framework in mind, I assessed the landscape.
I thought AspectJ and AspectWerkz were impressively powerful but not well suited to your average J2EE developer. I wanted to steer users toward a good design more than I wanted a pointcut to pick out a type cast. The remaining frameworks all lacked a number of key features as well as the sense of refinement I needed to sell my team. I rolled up my sleeves and started dynaop.
Today dynaop surpasses my original vision with:
- an innovative BeanShell configuration
- a development manual in addition to full Javadocs
- per-proxy interceptors and mixins
- simple hooks for tool support with an example Javadoc-like tool
- 100% support for object serialization
- custom pointcut implementations
- support for JDK 1.3 and later
- a polished and battle tested API
- a low impact on development, J2EE and IDE friendly
- LGPL license
In its category, dynaop blows the doors off competitors:
10^6 invocations/sec. (higher is better)
dynaop 1.0 beta 3.1
JBoss 4.0 DR2 1.6
Spring 1.0 M4 0.7
Nanning 0.9 0.5
The test invoked two different method types, using dynamic proxies (except for JBoss which isn't proxy-based) and a chain of 3 empty interceptors. The test ran on Sun JDK 1.4.1 with the "-server" VM setting. It allotted each framework identical and ample ramp up time.
Thanks to Hani, Rickard, Pat Niemeyer, Paul Brown and my team for their invaluable feedback and support.
I'll give my first public, post release talk at the Gateway Java Software Symposium, March 19-21 in St. Louis, MO. I hope to see you there.
Disclaimer: this is beta software; bugs are present and the documentation is in dire need of grammar check.
Bookmark blog post: del.icio.us Digg DZone Furl Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment
-
Amazing performance!
How did you manage to get such amazing performance? It is even more surprising since JBoss uses bytecode instrumentation, JBoss should really be much faster than that. I'm not surprised it doesn't beat Nanning as Nanning hasn't really been optimized. (It's been optimized "enough" so to speak.)
We have noticed that there are some scalability problems with having interceptors alloctaed per proxy and I'm currently leaning towards a much simpler model where interceptors are basically stateless (one instance per "class" so to speak) and mixins carry all the state.
I think such a restriction (which is quite acceptable) would make it possible to do quite impressive optimizations.
(I must say that parts of the API bears a striking resemblance to Nanning... I'll take that as a compliment. :-) )
Good luck, Bob!
Posted by: tirsen on February 12, 2004 at 01:31 AM
-
Finally!
I have been reading your blog since you started talking about AOP, and found your explanations very clear... so clear in fact that I kept thinking "why the heck doesn't he actually set up a project"? Now I have the answer, it was just about time :-)
All the best.
Posted by: nicolaken on February 12, 2004 at 02:58 AM
-
Amazing performance!
You're correct, all of the frameworks perform acceptably. The trick: Method.hashCode() is very slow.
dynaop supports both singleton and per-proxy interceptors. I started out with singleton only, but came accross use cases where per-proxy interceptors made the most sense--proved myself wrong so to speak.
It should resemble Nanning. Nanning as well as all of the other AOP frameworks, especially AspectJ, were a real inspiration to both the design and implementation of dynaop. Rickard's advice was a huge help as well.
Posted by: crazybob on February 12, 2004 at 08:27 AM
-
Ummm ...
I'm not that well versed in AOP, and going thru the dev manual I was unable to quite make out how the framework was different from similar projects. An overview/FAQ page?
Posted by: sumitkishore on February 12, 2004 at 11:20 AM
-
can you bench AspectWerkz too?
kinda curious
Posted by: patriot1burke on February 12, 2004 at 11:39 AM
-
Ummm ...
The feature list above pretty much sums it up.
Posted by: crazybob on February 12, 2004 at 11:42 AM
-
Amazing performance!
FYI, JBoss AOP, Nanning, Spring, dynaop, AspectWerkz: at the end of the day, they all use reflection. They all have Object[] arg lists they need to allocate. All have some type of Invocation object they must allocate, so it is not surprising that performance is similar. I'd be more curious about AspectWerkz and AspectJ. Especially AspectWerkz because I spent a few weeks in December and January collaborating with Jonas and saw a lot of performance tuning that needed to be done.
An interesting note on Java reflection: I altered JBoss AOP to use Javassist to create a class at runtime that could bypass Java reflection. Surprisingly it had unmeasurable performance improvement.
On DYNAOP's performance: Also, couldn't find how dynaop was faster than JBoss AOP. Could a few more method indirection calls and field sets that JBoss has actually cause dynaop to be that faster? I don't see where I am doing any extra object creations as well.
As far as stateless vs. stateful interceptors, IMO, it should be optional. Bob's InterceptorFactories should do a good job at providing some of that capability to choose. We did the same in JBoss AOP and are extending this capability more in later releases. AspectWerkz has a lot of flexibility in this area as well.
Posted by: patriot1burke on February 12, 2004 at 12:01 PM
-
Amazing performance!
One more thing tirsen:
java.lang.reflect.Proxy IS bytecode instrumentation.
Posted by: patriot1burke on February 12, 2004 at 12:02 PM
-
Performance vs. Design
Bill, I hope you don't mind if I address all of your comments in one place.
Performance doesn't matter. Design does. My benchmark only served to illustrate that dynaop does not sacrifice performance for the strides it makes in the design arena. Also, dynaop performs well enough that it won't noticeably affect your application's performance. Reflection is plenty fast. Use it in good conscience.
As I said in my weblog, AspectWerkz and AspectJ don't fit my design requirements. The JBoss AOP architecture is closer to those two than the other frameworks, and consequently I regret including it in the benchmark.
I need a proxy-based framework, not a framework that uses bytecode modification, i.e. not a framework that modifies the target class itself. Why? I need to use the non-proxied instance, as well as various proxied versions of the instance in the same application.
For example, I want to apply interceptors to List instances that are returned from a given business method (not all List instances). Correct me if I'm wrong, this isn't a straightforward task (if even possible) in frameworks that rely on bytecode modification.
Bill Burke: On DYNAOP's performance: Also, couldn't find how dynaop was faster than JBoss AOP. Could a few more method indirection calls and field sets that JBoss has actually cause dynaop to be that faster? I don't see where I am doing any extra object creations as well.
Read the source.
Bill Burke: As far as stateless vs. stateful interceptors, IMO, it should be optional. Bob's InterceptorFactories should do a good job at providing some of that capability to choose. We did the same in JBoss AOP and are extending this capability more in later releases. AspectWerkz has a lot of flexibility in this area as well.
Yes, "stateful" and "stateless" interceptors are both first class citizens in dynaop. I was there when you added it to JBoss.
Posted by: crazybob on February 12, 2004 at 12:42 PM
-
Performance vs. Design
As I said in my weblog, AspectWerkz and AspectJ don't fit my design requirements. The JBoss AOP architecture is closer to those two than the other frameworks, and consequently I regret including it in the benchmark.
Freakin chill Bob. I was actually trying to be constructive....Wasn't suggesting you use JBoss AOP.
FYI it was good you included JBoss AOP and I was suggesting to include AspectWerk, as, I said before, at the end of the day JBoss, AW, Spring, Nanning, and dynaop all use the same basic design at the core when it comes to the actual interception part.. My point being that they all have Invocation objects, reflection and a command pattern of a chain of "interceptors". They all should have performance that is VERY similar. If they don't then something is wrong.
Posted by: patriot1burke on February 12, 2004 at 12:59 PM
-
Performance vs. Design
Freakin chill Bob. I was actually trying to be constructive....Wasn't suggesting you use JBoss AOP.
Calm down, Bill, no need to get worked up. Just kidding.
I'm not saying there's anything wrong with JBoss AOP. It's great, but comparing it, AspectJ or AspectWerkz to a proxy-based framework is really apples to oranges. There's no point; they target different problems.
Posted by: crazybob on February 12, 2004 at 02:35 PM
-
Advantages versus ASPECTWERK and JBOSS AOP ?
Bob,
Can u elaborate a little bit why u feel that a solution such as ASPECTWERK or JBOSS AOP (STANDALONE) don’t suit your requirements.
I have already used both implementations in several projects and I feel that both of them are powerful solutions in terms of AOP features and are also very easy to use.
They provide not only public method interception as DYNAOP does,but also protected, private,package protected methods, static methods, protected fields interception ,and also constructor interception (JBOSS-AOP only).
Also, an AOP solution based on runtime byte code modification has the advantage to be a non evasive solution in the application targeted.There is no code change required to intercept method or use Introduction.In DYNAOP, a class can be intercepted if only the class has a public empty constructor and if the class is created by DYNAOP .
Rgds ,Claude
Claude Hussenet
Independent Consultant.
Email:chussenet@yahoo.com
Posted by: chussenet on February 15, 2004 at 07:04 PM
-
Advantages versus ASPECTWERK and JBOSS AOP ?
I've already addressed this question with an example use case in this comment: http://weblogs.java.net/cs/user/view/cs_msg/2816
There's also the matter of tool support (neither of those has a documentation tool that I know of), ease and flexibility in configuration, support for object serialization, and development impact (i.e. those two frameworks require custom classloaders), all of which I listed in my entry. Also, IMHO, the dynaop API is more polished and in the "Java spirit."
Posted by: crazybob on February 15, 2004 at 08:14 PM
-
Thanks for CGLib 2.0
The CGLib 1.0 package was causing problems when trying to use dynaop in a web start application. Something related to generated classes not getting the appropriate permissions. I was very happy to see that dynaop had already incorporated CGLib 2.0.
Posted by: jasonrberry on April 25, 2004 at 01:47 PM
-
Will this thing ever leave beta status?
Posted by: trefork on August 08, 2006 at 05:43 AM
-
The 1.0 branch is there. I just haven't had an official release.
Posted by: crazybob on August 08, 2006 at 08:56 AM
-
Any plans for an official release? I hate going through CVS or SVN, and it would look cooler on your website to have 1.0 rather than some half-baked (perception is reality) beta product.
Posted by: trefork on August 24, 2006 at 06:38 AM
|