12 Replies Latest reply on Oct 31, 2007 12:25 PM by damianharvey

    Performence of Seam 2.0 app

    mschmidke

      Hello all,

      I've got a question about performance.

      I'm not speaking of that drastic performance issues found in other threads (15 seconds per page or so), but of one or two seconds of time to apply request values.

      I am still beginner and am starting with a yet really small application, some Entities, some session beans and yet one single page.

      My environment is JBoss 4.2, Seam 2.0, Tomahawk 1.1.6, Facelets.


      This page contains 12 different input fields, 6 of them text fields, 6 selectOneMenus. Not too much, I think.

      But it takes about 2 seconds for a single round trip (submit, render the same page). There are no database accesses. The select boxes contain no more than 5 or 6 items, all of them cached in an application scoped session bean. I've drastically reduced debugging, not much effect.

      I've tried to make some statistics, turned on DEBUG logging again.

      I found
      67 times [org.jboss.seam.Component] instantiating Seam component: org.jboss.seam.persistence.persistenceProvider

      90 times [org.jboss.seam.Component] instantiating Seam component: org.jboss.seam.web.parameters

      102 times [org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor] ++++ LongLivedSessionPropagationInterceptor

      153 times [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}

      5180 times [org.jboss.seam.Component] instantiating Seam component: org.jboss.seam.core.events (five thousand one hundred eighty!!)

      ... and thousands of lines which seam to result from access to components in contexts, each variable being accessed around one hundred times.

      So, my question is: my page isn't really complicated, but what happens when submitting it is stunning. May I have coded something in a roundabout way, or are these numbers normal for a seam application?

      Marcus.

        • 1. Re: Performence of Seam 2.0 app
          nickarls

           

          "MSchmidke" wrote:

          So, my question is: my page isn't really complicated, but what happens when submitting it is stunning. May I have coded something in a roundabout way, or are these numbers normal for a seam application?


          * Increase the memory of the server with JVM options
          * Check that you don't have a file appender on debug level that spits out those thousands of lines to disk (are there large log files in server/log?)

          • 2. Re: Performence of Seam 2.0 app
            amitev

            There is also a post how to optimize jboss seam http://www.jboss.com/index.html?module=bb&op=viewtopic&t=117190

            • 3. Re: Performence of Seam 2.0 app
              kukeltje

              Initially setting logging to a lower level might help. At least I've seen that happening

              • 4. Re: Performence of Seam 2.0 app
                mschmidke

                 

                "MSchmidke" wrote:
                I've drastically reduced debugging, not much effect.
                .


                Oops ... of course "drastically reduced logging" was what I wanted to say ....

                • 5. Re: Performence of Seam 2.0 app
                  pmuir

                  I created http://wiki.jboss.org/wiki/Wiki.jsp?page=SeamPerformanceFAQ - lets try to put all the performance tips we use there for now, and we'll get a proper area on the community site for this.

                  • 6. Re: Performence of Seam 2.0 app

                    What could help to achieve better performance is variety of stress tests
                    which could be run as a part of the Seam build.

                    They would also have helped to understand how ongoing changes to Seam
                    impact the overall performance.

                    Each stress test should address a specific aspect of JSF application to be more useful in troubleshooting and profiling.

                    Here are some ideas about use cases for stress testing

                    1. Rendering large table - measure response time (stress testing of EL, etc)
                    large number of columns and rows
                    2. Submitting big form (stress testing of validation and apply request values phase)
                    3. Some repeatable evaluations of EL expression
                    4. Stress test case for injection/outjection
                    Backing bean with many In/Out annotations
                    5. Stress test case for annotation reading via Seam APIs
                    6. Stress testing of AJAX responses when using AJAX4JSF,
                    (by trying to rerender large area by Ajax)
                    7. Stress testing of EntityConverter
                    trying to render many dropdowns






                    • 7. Re: Performence of Seam 2.0 app
                      mschmidke

                       

                      "pete.muir@jboss.org" wrote:
                      I created http://wiki.jboss.org/wiki/Wiki.jsp?page=SeamPerformanceFAQ - lets try to put all the performance tips we use there for now, and we'll get a proper area on the community site for this.


                      I've tried all hints ... but with no real success.

                      Ok, page render time reduces from 4,1s to 1,8s when reducing log level.

                      But 1,8s is clearly too much for the page I have. There is absolutely no database access, everything cached in stateful bean, and there are no complicated things on the page. The most "complicated" thing on the page is a combobox with about 100 entries, all other of the about 15 components are really simple.

                      I'm still wondering what the high number of "LongLivedSessionPropagationInterceptor" logs (when I had logging on) tells me.

                      Do I have any other chance to find the bottleneck? Perhaps I've made clumsy jsf code or so.

                      Is s:selectItems / s:convertEntity a problem?


                      Marcus.

                      • 8. Re: Performence of Seam 2.0 app
                        pmuir

                        Can we see the page?

                        • 9. Re: Performence of Seam 2.0 app
                          sbublava

                           

                          "MSchmidke" wrote:

                          The most "complicated" thing on the page is a combobox with about 100 entries, all other of the about 15 components are really simple.

                          ...

                          Is s:selectItems / s:convertEntity a problem?


                          I just profiled on of my pages today and s:selectItems can indeed be a problem for combo-boxes with many entries.

                          The code below is from asSelectItems() in UISelectItems.java:

                           for (Object o : iterable)
                           {
                           initVar(o);
                           selectItems.add(new javax.faces.model.SelectItem(o, getLabel() == null ? null : getLabel(), "", getDisabled() == null ? false : getDisabled()));
                           destroyVar();
                           }
                          


                          As you can see getLabel() and getDisabled() (usually value expressions) are called twice per entry. I've changed this locally to use local variables and it makes a noticeable difference.

                          In my case there are even more combo box entries - your mileage may vary ...

                          Thanks,
                          Stephan

                          • 10. Re: Performence of Seam 2.0 app
                            pmuir

                            Stephan, please file a jira issue for this.

                            • 11. Re: Performence of Seam 2.0 app
                              sbublava

                               

                              "pete.muir@jboss.org" wrote:
                              Stephan, please file a jira issue for this.


                              Done. (JBSEAM-2185)

                              • 12. Re: Performence of Seam 2.0 app
                                damianharvey

                                Stephan,

                                I'm facing a similar/same problem.

                                Can you please show some of your code, particularly around how you are using the local variables.

                                Thanks,

                                Damian.