6 Replies Latest reply on Jun 11, 2008 10:00 AM by przemjaskier

    Interception causes a huge performance üpenalty

    stephen

      While trying to increase the performance of my application I noticed that the ManagedEntityIdentityInterceptor takes a lot of time doing its magic.


      What's worse: If I understand it correctly it only deals with passivation and replication, but even if those never happen you pay the price at each and every request.


      To have some hard facts I timed the initial display of the first page in my conversation (using the TimingInterceptor described in a previous performance related thread):


      With ManagedEntityIdentityInterceptor: Each usage of my bean from EL expressions in my facelets page costs about 80ms!


        757,70 ms  10   DocumentHome.getShowProductRelatedControls()
        408,66 ms   5   DocumentHome.getCategory()
        201,10 ms   1   DocumentHome.setProductGroupId()
        167,36 ms   2   DocumentHome.getShowCompanyRelatedControls()
        161,20 ms   1   DocumentHome.init()
        161,11 ms   2   DocumentHome.getShowTemplateRelatedControls()
        146,60 ms   1   EntityHome.create()
        137,19 ms   1   DocumentHome.getDropdownProductGroupList()
        108,59 ms   1   DocumentHome.getCanSeeAdminDoctypes()
         93,83 ms   1   DocumentHome.getProductId()
         92,16 ms   1   DocumentHome.getDocumentTypes()
         88,73 ms   1   Home.getId()
         87,61 ms   1   DocumentHome.getProductGroupId()
         84,77 ms   1   DocumentHome.getDocKindCode()
         75,84 ms   1   DocumentHome.getIsInternal()
         71,77 ms   1   DocumentHome.getShowProductSpecificControls()
         69,24 ms   1   DocumentHome.getCompanyId()
      ===========
       2913,46 ms
      



      Without ManagedEntityIdentityInterceptor my applications works just as fine but the requests takes less than 1/10 the time:



         98,14 ms   1   DocumentHome.setProductGroupId()
         72,52 ms   1   EntityHome.create()
         57,99 ms   1   DocumentHome.init()
         16,93 ms   1   DocumentHome.getDocumentTypes()
          6,92 ms  10   DocumentHome.getShowProductRelatedControls()
          2,32 ms   2   DocumentHome.getShowCompanyRelatedControls()
          2,06 ms   5   DocumentHome.getCategory()
          1,96 ms   1   DocumentHome.getDocKindCode()
          0,88 ms   2   DocumentHome.getShowTemplateRelatedControls()
          0,62 ms   1   DocumentHome.getDropdownProductGroupList()
          0,57 ms   1   Home.getId()
          0,48 ms   1   DocumentHome.getCanSeeAdminDoctypes()
          0,43 ms   1   DocumentHome.getIsInternal()
          0,43 ms   1   DocumentHome.getCompanyId()
          0,34 ms   1   DocumentHome.getShowProductSpecificControls()
          0,34 ms   1   DocumentHome.getProductId()
          0,32 ms   1   DocumentHome.getProductGroupId()
      ===========
        263,25 ms
      
      (The remaining time is almost exclusively spent with db queries that can pretty easily be optimized.)
      
      


      There must be a better way to implement the features that the interceptor provides, don't you think?
      A dozen calls to a simple getter can't really take a full second.


      Any ideas?

        • 1. Re: Interception causes a huge performance üpenalty
          nickarls

          Christian made several observations regarding this issue on the seam-dev mailing list today. I got the impression that the issue was being addressed...

          • 2. Re: Interception causes a huge performance üpenalty
            brachie

            Hi,


            performance is also an important issue with our current Seam application.


            How can I disable the ManagedEntityIdentityInterceptor?


            What are the possible side effects? (we are using EJB3 with no clustering)?


            Is it enough to annotate the class with @BypassInterceptors?



            Regards,


            Alexander

            • 3. Re: Interception causes a huge performance üpenalty
              stephen

              Part of the issue is that there's no easy way to disable that specific interceptor.


              I removed that interceptor from the seam source in org.jboss.seam.Component.initDefaultInterceptors() and recompiled seam.


              You can't simply add @BypassInterceptors because that disables all of seam's interceptors (e.g. bijection won't work any more).


              As for the side effects: The interceptor deals with clustering (which you do not use) and session passivation. For a more specific answer somebody with better knowledge of seam internals will have to chime in.

              • 4. Re: Interception causes a huge performance üpenalty
                diegocoronel

                hi,


                Is there any way to disable only ManagedEntityIdentityInterceptor  without recompile seam? and what are the effects disabling only this interceptor ?


                ty

                • 5. Re: Interception causes a huge performance üpenalty
                  brachie

                  Stephen Friedrich wrote on Jun 06, 2008 10:10:


                  ...
                  You can't simply add @BypassInterceptors because that disables all of seam's interceptors (e.g. bijection won't work any more).
                  ...


                  I am totally aware of this fact. That's why I am using Component.getInstance(myComponent) for Injection and Contexts.getXXXContext.set(myComponent, component) for Outjection.


                  Is @BypassInterceptors also intercepting the ManagedEntityIdentityInterceptor? I guess so. So it seems, that when using @BypassInterceptors you are not only loosing the @In and @Out but also clustering will no longer work?


                  It would be really good if someone with knowledge of the Seam internals could describe the exact impact of @BypassInterceptors, because until now it seems that this annotation is one key in improving performance...


                  Regards,


                  Alexander

                  • 6. Re: Interception causes a huge performance üpenalty

                    FYI: JBSEAM-3096. Cast a vote.