12 Replies Latest reply on Aug 10, 2011 7:42 AM by deeps p

    Richfaces tree performance.

    deeps p Newbie

      Hi,

       

      I am using richfaces 3.3.3 with seam 2.2 and jboss 4.3.2.I am using a tree with around 1600 nodes in my application.The html code for tree is as shown below :

       

      <rich:tree id="apptreestructure"

                                                                            switchType="ajax"

                                                                            value="#{appBuilder.appTree}" var="treeitem"

                                                                            binding="#{appBuilder.sampleTreeBinding}"

                                                                            ajaxSubmitSelection="true" selectedClass="tree-selected-node"

                                                                            nodeSelectListener="#{appBuilder.treeNodeClickedMethod}"

                                                                            adviseNodeSelected="#{appBuilder.adviseNodeSelectedMethod}"

        reRender="monitortabpanel,deptoutputpanel,streeEx,chartid,chartpanelgrid.....">

                                                                  </rich:tree>

       

      When the tree is collapsed or filtered to show a subtree everything is fine.But when the tree is completely expanded with all the nodes,the total size of the tree comes around 117kb and all the requests for which tree needs to be rerendered takes around  14 - 17 secs.Also even the requests which does not include tree rerendering also becomes comparatively very slow.Also after working with the application for some time with the tree expanded the application becomes unresponsive.

       

      Can anyone plese suggests some solutions for improvong performance with tree component.

       

      Thanks,

      Deeps.

        • 1. Richfaces tree performance.
          Nick Belaevski Master

          Hi Deeps,

           

          Please check whether main delay is due to server or client interaction. Also try switching to another parser.

          • 2. Re: Richfaces tree performance.
            deeps p Newbie

            Hi,

             

             

            Server interaction is not taking much time.More time is taken for rendering the component.Also in web .xml I have given

             

             

            <context-param>

             

                    <param-name>org.ajax4jsf.xmlparser.ORDER</param-name>

             

                    <param-value>NONE</param-value>

             

                </context-param>

             

             

            Is this what you mean regarding parser.

             

            I have tried NEKO parser.But the tree was not rendering properly with that.

             

             

            But what can be the reason for the complete application becoming slow once the tree is completely expanded even in case of requests for which tree rerendering is not required.

             

             

            Are there any other optimizations that I can do for improving tree performance.

             

             

            Thanks,

             

            Deeps.

            • 3. Re: Richfaces tree performance.
              Nick Belaevski Master

              >> But what can be the reason for the complete application becoming slow once the tree is completely expanded

              >> even in case of requests for which tree rerendering is not required.

               

              Have you tried profiling the client side of application using developer tools?

              • 4. Re: Richfaces tree performance.
                deeps p Newbie

                Hi,

                 

                If the aplication is profiled what I noticed is that the number of objects were equal to the number of objects in the tree.That is there was no memory leak as such.Did the profiling at the browser level as well as at the server level.We have used firebug tool and google profiler to check the performance.Is it taking more time in converting the HTMLTree object to xml.

                 

                Thanks,

                Deeps.

                • 5. Re: Richfaces tree performance.
                  deeps p Newbie

                  Hi,

                   

                  Actually my application works pretty fast when the tree is small.Once the tree is completely expanded, the time taken for sending a request itself seems to be increased.That is, the if click a button or something the ajax status component for that itself will be shown up only after a while.

                   

                  It will be great if you can suggest something.I tried removing the binding for tree to see whether that can be the reason.But the issue remains same.

                   

                  Thanks,

                  Deeps.

                  • 6. Re: Richfaces tree performance.
                    Nick Belaevski Master

                    Tree has some INPUT elements to track nodes state, so the bigger their number is, more time is taken to prepare form data for submission. Try placing tree into a separate form.

                    • 7. Re: Richfaces tree performance.
                      deeps p Newbie

                      Hi,

                       

                      I tried this.But could not find any difference.

                       

                      Now the code for my tree looks like :

                       

                      <ui:define name="lefttopdata">

                       

                              <rich:panel ........>

                                  <f:facet name="header">

                                      <h:panelGroup>

                                          <h:outputText value="Tree Structure"></h:outputText>

                                      </h:panelGroup>

                                  </f:facet>

                                  <a:region id="exRegion">

                                      <h:form id="abForm1">

                                          <div...........>

                                          <h:panelGrid ........... />

                                          </h:panelGrid></div>

                                      </h:form>

                       

                                  </a:region>

                       

                                  <a:region id="appbuildertreeregion">

                                      <h:form id="abForm2">

                                          <h:panelGrid ...............>

                                          </h:panelGrid>

                                      </h:form>

                                      <h:form id="abForm99">

                                          <rich:panel

                                              style="height:600px;overflow:auto;width:245px;border:0;background-color:#e9e6d2;">

                                              <rich:tree id="apptreestructure"

                                                  switchType="#{appBuilder.treeSiwtchType}"

                                                  value="#{appBuilder.appTree}" var="treeitem"

                                                  ajaxSubmitSelection="true" selectedClass="tree-selected-node"

                                                  nodeSelectListener="#{appBuilder.treeNodeClickedMethod}"

                                                  adviseNodeSelected="#{appBuilder.adviseNodeSelectedMethod}"

                                                  adviseNodeOpened="#{appBuilder.adviseNodeOpenedMethod}"

                                                  changeExpandListener="#{appBuilder.enableNodeExpand}"

                                                  reRender="#{appBuilder.appBRenderList}">

                                              </rich:tree>

                                          </rich:panel>

                                      </h:form>

                                  </a:region>

                              </rich:panel>

                          </ui:define>

                          <ui:define name="centerdata">

                          .........

                          </ui:define>

                       

                      When the tree is completely expanded the performance is worst in mozilla. It will not be respondidng at all.Ie and chrome responds,But takes much time.

                       

                      Thanks,

                      Deeps.

                      • 8. Re: Richfaces tree performance.
                        Kevin Heneghan Newbie

                        I am seeing the same behavior with the rich:tree.  I have a simple tree that has a nodeSelectListener. If I expand a tree node that has a lot of child nodes. I am talking 1000+ the page becomes unresponsive taking 30+ seconds to reRender a second panel with content based on the selected node. Does anyone have any insight on the rich:tree performance or is this control just a toy?

                        • 9. Re: Richfaces tree performance.
                          Nick Belaevski Master

                          Kevin,

                           

                          Do you have exactly the same problem as the original thread author describes?

                          • 10. Re: Richfaces tree performance.
                            Kevin Heneghan Newbie

                            It sounds like the issue I am seeing. node expansion is very slow and the more nodes that are expanded the slower the tree responds. I did add the following attributtes and the node selection is behaving much better, but still not speedy

                             

                            preserveModel="none"

                            ajaxChildActivationEncodeBehavior="none"

                            ajaxNodeSelectionEncodeBehavior="none"

                             

                            When I expand a node and load 1200 children into it (server side time is millseconds) the browser takes over 15 seconds to render the expanded node. I am just wondering if this control is capable of dealing with large node sets?

                            • 11. Re: Richfaces tree performance.
                              cdpointpoint Newbie

                              I can confirm the problem. I had a 5 levels tree with 2000+ nodes in it and I had exactly the same problem. It was better with ajax mode than client mode but still very slow when expanded.

                              I ended up using Yahoo YUI tree (in client mode) which works very well even with IE6... I used jsFunction to make the link between richfaces / jsf and Yahoo YUI.

                               

                              I agree that 2000+ nodes may represent a lot of DOM elements, and processing, especially since the tree is not the only component in the page but other API seems to work very well in that context even with older browsers.

                              • 12. Re: Richfaces tree performance.
                                deeps p Newbie

                                Hi,

                                 

                                Thanks for the reply.Even I could not solve the issue with Richfaces and finally replaced my richfaces tree with jquery tree.

                                 

                                Deeps.