1 Reply Latest reply on Sep 25, 2012 10:45 AM by iabughosh

    JSF slow for complex pages

    nandish

      I have a complex UI screen built on Rich faces. Assume it to be as rich as `facebook` with many inline editors and loads of buttons and labels. I am using `Mojarra` JSF implementation. And its obvious that the performance is taking a beating due to rebuilding of component tree after every server call.`Autocompletes` are pathetically slow. Having read some books on JSF, I think this is the way it works. How would this scale for a application like the one I am building with complex UI. Am i missing anything.

       

      Also what is the best practice to keep the component tree to small size.

       

      Let me explain the problem very clearly.

       

      jsf.png

       

      When the page loads top bar, side bar is fully populated. The green portion is empty.  When any tab button is clicked, it fetches a xhtml file from the server and replaces the innerHTML of green box with the fetched data. The process is done using the jquery ajax call.

       

                  jQuery.ajax({

                    url: url,

                    dataType: "html",

                    cache: false

                  }).done(function( html ) {   

                          

                           jQuery("#green_block").html(html);

       

                       }       

                  });   

       

      Note:

       

      1. Every component on the screen is backed by a `request scoped` bean

          where getter have no business logic.

         

      2. There is a post construct method in every bean to populate bean

              attributes

       

      Observation:

       

      1. When there is any activity on the top bar, be it clicking a button

          or submitting a data, the logs shows that even the side bar is

          rebuilt internally. i.e. the beans used in the sidebar are setup again. We have verified this many times in all the environments. The green part or the tab content of the page is not reloaded in any way (ie those beans are not rebuilt or setup again)

      2. When there is any activity within the green block which got loaded

          through `ajax`, we didn't observe any components being rebuilt on top

          bar or side bar. Only the green block was re built during render

          phase

      3. If any action within green block (command link or command button) tried re-rendering any component in top bar or side bar, the render did not work at all.

       

      > This clearly stated that the JSF treated the two blocks independently.

      > We want to know if this is the actual behavior or have we missed

      > something really trivial?

       

      Also, every time there is an ajax call in the tab content, all the beans within the tab content (basically displaying different types of data within the tab) are rebuilt (confirmed this with the eclipse debugger). Also all the backing beans for components like rich:autocomplete etc are setup again. This is slowing down operations within the tab (like the autocomplete) and the tab switching as well.

       

      As suggested we will try to hire a JSF architect but until then, any help from JSF experts is much appreciated.

        • 1. Re: JSF slow for complex pages
          iabughosh

          Hello Nadish,

          it seems that you are in a real mess , any way can you edit your page to use rich:tabPanel instead of (ajax/jquery) tab loading, lets see if client or server switchType will solve some problems.

           

          regards.