Announcement Announcement Module
No announcement yet.
Spring AOP using Proxy Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring AOP using Proxy


    As Spring documentation states "Spring defaults to using J2SE dynamic proxies for AOP proxies". The other alternative is to use CGLIB proxies.

    However I'm a bit worried about first approach when is uses Dynamic Proxies. A method invocation through proxy seems to be about 98% slower that invoking the method directly (...which probably is expectable). However it seems to be 8 times slower than invoking it reflectivley using Method class.

    Theses time diffrences were observed in nanoseconds (for a dummy getter method that just returns a reference).

    Has anyone observed any significant perfomance decrease when using dynamic proxies in production ?


  • #2
    I'm a bit worried about first approach when is uses Dynamic Proxies
    Depends what you use them for. You'll probably find it only accounts for a small fraction of your processing time.

    You might be interested in this thread:
    and this benchmark:
    Last edited by robyn; May 15th, 2006, 05:47 PM.


    • #3
      Right ...

      I was thinking that even if you use Spring AOP for coarse grained objects (or business objectw) as it is used for transaction demarcation, with millions of simultaneous transactions the use of reflection may degrade performance.

      Thanks so much for the links. AspectJ performs pretty well (as I expected) that's most probably because compile-time weaving.

      As for dynamic proxy-ing for fine grained objects that are used extremly frequently, seems that byte-code level instrumentation is much more appropriate than java.lang.reflect.Proxy approach.

      Thank you again.