Results 1 to 3 of 3

Thread: Spring AOP using Proxy

  1. #1
    Join Date
    Aug 2005
    Location
    Romania
    Posts
    10

    Default Spring AOP using Proxy

    Hello,

    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 ?




    Thanks,
    Marius

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,104

    Default

    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:
    http://forum.springframework.org/showthread.php?t=13046
    and this benchmark:
    http://docs.codehaus.org/display/AW/AOP+Benchmark
    Last edited by robyn; May 15th, 2006 at 05:47 PM.

  3. #3
    Join Date
    Aug 2005
    Location
    Romania
    Posts
    10

    Default

    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.

Similar Threads

  1. Spring MVC Web Framework versus Struts
    By biguniverse in forum Web Flow
    Replies: 27
    Last Post: Aug 29th, 2012, 03:57 AM
  2. Replies: 14
    Last Post: Feb 21st, 2005, 05:41 PM
  3. Other Hibernate DAO LazyInitializationExceptions
    By bernardsirius in forum Data
    Replies: 5
    Last Post: Feb 18th, 2005, 04:09 PM
  4. Replies: 9
    Last Post: Feb 8th, 2005, 09:25 PM
  5. Spring Proxy error handling
    By dougbryant in forum Container
    Replies: 2
    Last Post: Dec 3rd, 2004, 09:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •