9 Replies Latest reply on Jun 2, 2008 8:18 PM by ssilvert

    Simple navigation test takes 100 seconds !?

      I'm using JSFUnit with Facelets (templates configured as *.jspx)
      Here is my test:

       public void testHealthStatusReportHistory()
       throws MalformedURLException, IOException, SAXException {
      
       client.clickLink("reportHistoryMenuItemLink");
       assertEquals("Loaded page doesn't match expected [/status/reportHistory.jspx,"+server.getCurrentViewID()+"]",
       "/status/reportHistory.jspx", server.getCurrentViewID());
       }
      


      After stepping through this code it appears that all of the below code (in clickLink) takes less than 20 seconds (mainly due to the database query in the referenced backing bean) BUT the remaining +60 seconds is taken in the last line ( this.clientIDs = new ClientIDs(); ):

       public void clickLink(String componentID) throws SAXException, IOException
       {
       ComponentTypeException.check("clickLink()", componentID, HtmlOutputLink.class, clientIDs);
       String clientID = this.clientIDs.findClientID(componentID);
       WebLink link = this.webResponse.getLinkWithID(clientID);
       if (link == null) throw new ComponentIDNotFoundException(componentID);
       this.webResponse = link.click();
       this.clientIDs = new ClientIDs();
       }
      


      I've experimented with making the page less complex (removing some of the controls) and it does improve performance, but my thought is why do I need to parse all of the control IDs if all I'm doing is verifying the navigation? Would it be nice to short-cut this?

      Is there any way I could improve this? The page is complex (panelMenu + table + header sort controls + filter controls + a few others) but not that complex considering it is only displaying 10 rows. For a decent jsf app, it doesn't seem unusual.

      Brian

        • 1. Re: Simple navigation test takes 100 seconds !?

          Here's some more information:

          2 pages that take normally ~2 seconds to navigate to: 1 has 6 columns, the other has 10 columns, they both have 10 rows. Each table has 2 contols in the header, and 4 in the footer, plus filter controls for each column, so roughly:

          page 1: (6 x (10+1)) + 2 + 4 = 72
          page 2: (10 x (10+1)) + 2 + 4 = 116

          I ran the extact same navigation test (as listed before) on both pages:

          page 1: 8.744 seconds
          page 2: 33.307 seconds !!!

          Both pages are using the exact same configuration of richfaces controls - to only reall difference is that one page has 6 columns and the other has 10

          (BTW, I also simplified the header controls which dropped the time from 100 seconds to the 33 listed above)

          • 2. Re: Simple navigation test takes 100 seconds !?
            ssilvert

            Hi Brian,

            Thanks for the valuable feedback.

            I'm not surprised that the ClientIDs class is the slowest part of JSFUnit. However, I am surprised that a page with only 116 components takes so long. The RichFaces JSFDemo has tests with similar-sized datatables and each test takes less than a second.

            Is there some way you could create a sample application that demonstrates the problem. Then you or I could profile it and see specifically where the bottleneck is. You can attach whatever you want to this jira issue that I created for this problem:
            http://jira.jboss.com/jira/browse/JSFUNIT-96

            If you've looked at the ClientIDs class, you saw that it will traverse the full component tree and gather the client ID for each component. So the problem could be in the time it takes to recursively navigate the tree. But I suspect that the problem could be that particular components take an excessive amount of time to calculate the client ID when we call UIComponent.getClientId().

            There are lots of things we could do to speed up the ClientIDs class, but I don't want to try anything until we know exactly where the bottleneck is.

            Stan

            • 3. Re: Simple navigation test takes 100 seconds !?

              So far I've found JSFUnit very useful, and plan on using it for regression testing, so I'm highly motivated to support the project any way I can.

              I'll try to build a simple test project this week and post it (M-T?).

              • 4. Re: Simple navigation test takes 100 seconds !?

                BTW, What do you normally use to profile something running in JBoss?
                I would the code could be instrumented to do this, but I was wondering if there are any good tools.

                • 5. Re: Simple navigation test takes 100 seconds !?
                  ssilvert

                   

                  "bgregory" wrote:
                  BTW, What do you normally use to profile something running in JBoss?
                  I would the code could be instrumented to do this, but I was wondering if there are any good tools.

                  I've used OptimizeIt with good results in the past, but I haven't done JBoss AS profiling in a few years. Since I'm a NetBeans user, I'll probably try out the one that comes with NetBeans.

                  Stan

                  • 6. Re: Simple navigation test takes 100 seconds !?

                    I'm actually having trouble coming up with a stand-alone project that reproduces the problem. I have similarly complex pages that all run under 2 seconds. I'm going to try and nail down the slow parts and let you know.

                    I've used OptimizeIt a very long time ago, and I use eclipse now, perhaps I'll check out netbeans...

                    • 7. Re: Simple navigation test takes 100 seconds !?

                      Although I have not been able to reproduce the problem is code that I can submit, I have submitted a log file that shows a little more information.

                      • 8. Re: Simple navigation test takes 100 seconds !?

                        Just posted an example project + more observation. Apparently the "trick" has to do with ExtendedDataModel + rich:dataTable + rich:datascroller.

                        • 9. Re: Simple navigation test takes 100 seconds !?
                          ssilvert