4 Replies Latest reply on Apr 8, 2009 3:14 PM by Nikos Paraskevopoulos

    seam performance issue

    Justas Janauskas Newbie

      Hello,


      I am new in Java world, working only about two months, so please accept my apologies if I will make a question in not proper way.


      I am working on a project and we have the following application stack:



      • Oracle 10g

      • JBoss 4.2.3.GA

      • Hibernate 3.x

      • Spring 2.5.4

      • JSF 1.2

      • Seam 2.1.1.GA

      • Richfaces 3.3.0.GA




      I am running all these stuff except DB server (which is on separate machine) on my local machine which is:



      • Windows XP SP3

      • 3 GB RAM

      • 2 GHZ Intel Core 2 Due CPU



      I am starting JBoss server with following params:


      ===============================================================================
      
        JBoss Bootstrap Environment
      
        JBOSS_HOME: C:\java\jboss-4.2.3.GA
      
        JAVA: C:\Program Files\Java\jdk1.6.0_12\bin\java
      
        JAVA_OPTS:  -Dprogram.name=run.bat -server -Xms256m -Xmx800m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=512m -Xverify:none
      
        CLASSPATH: C:\Program Files\Java\jdk1.6.0_12\lib\tools.jar;C:\java\jboss-4.2.3.GA\bin\run.jar
      
      ===============================================================================
      



      and in starts in around 40 seconds.



      Also I have the following configurations:




      And the problem is that pages in my app are rendered extremely slow. For example, to render few lines of rich:extendedDataGrid it takes around 7 sec. (measured with FireBug).


      Standard layout of any page is composed of rich:tree which has many items and is rendered in the following way:


      <rich:tree style="width:200px" switchType="ajax" adviseNodeOpened="#{menuBean.adviseNodeOpened}" changeExpandListener="#{menuBean.changeExpandListener}">
          <rich:recursiveTreeNodesAdaptor var="item" roots="#{menuBean.nodes}" nodes="#{item.nodes}">
                  <rich:treeNode>                       
                       <s:link view="#{item.viewId}" value="#{item.caption}" />
                 </rich:treeNode>
          </rich:recursiveTreeNodesAdaptor>
      </rich:tree>
      



      and a rich:extendedDataGrid, wich has nothing special inside it, just renders items from bean's List<SomeClass>.


      menuBean is also nothing special, all items are already loaded to List structures.


      When I debugging application, I notice that all my business-logic is done very quickly and after that JSF or Seam or RichFaces or all of them are calculating something very heavily and uses my CPU 100% for several seconds. As far as I understand all it does is for rendering phase.


      Also, taking a look at log4j logs I see:


      2009-04-03 22:35:01,866 DEBUG [javax.enterprise.resource.webcontainer.jsf.application] No navigation rule found for null outcome and viewId /lemming/hr/appointment/list.xhtml Explicitly remain on the current view 
      2009-04-03 22:35:01,882 DEBUG [javax.enterprise.resource.webcontainer.jsf.lifecycle] Entering RenderResponsePhase
      2009-04-03 22:35:01,882 DEBUG [javax.enterprise.resource.webcontainer.jsf.lifecycle] About to render view /lemming/hr/appointment/list.xhtml
      2009-04-03 22:35:01,882 DEBUG [javax.enterprise.resource.webcontainer.jsf.application] Created component with component type of 'org.ajax4jsf.LoadStyle'
      2009-04-03 22:35:01,882 DEBUG [javax.enterprise.resource.webcontainer.jsf.application] Created component with component type of 'org.ajax4jsf.LoadStyle'
      2009-04-03 22:35:01,882 DEBUG [javax.enterprise.resource.webcontainer.jsf.application] Created component with component type of 'org.ajax4jsf.LoadStyle'
      2009-04-03 22:35:01,882 DEBUG [javax.enterprise.resource.webcontainer.jsf.application] Created component with component type of 'org.ajax4jsf.LoadScript'
      2009-04-03 22:35:01,882 DEBUG [javax.enterprise.resource.webcontainer.jsf.application] Created component with component type of 'facelets.ui.ComponentRef'
      
      a lot of other stuff, then (notice that already more than 2 seconds have passed!):
      
      2009-04-03 22:35:03,851 DEBUG [javax.enterprise.resource.webcontainer.jsf.application] Created component with component type of 'org.richfaces.ContextMenu'
      2009-04-03 22:35:03,851 DEBUG [javax.enterprise.resource.webcontainer.jsf.application] Created component with component type of 'org.richfaces.MenuItem'
      2009-04-03 22:35:03,851 DEBUG [javax.enterprise.resource.webcontainer.jsf.application] Created component with component type of 'org.richfaces.MenuItem'
      2009-04-03 22:35:03,851 DEBUG [javax.enterprise.resource.webcontainer.jsf.application] Created component with component type of 'org.richfaces.MenuSeparator'
      2009-04-03 22:35:03,851 DEBUG [javax.enterprise.resource.webcontainer.jsf.application] Created component with component type of 'org.richfaces.MenuItem'
      2009-04-03 22:35:03,851 DEBUG [javax.enterprise.resource.webcontainer.jsf.application] Created component with component type of 'org.richfaces.MenuSeparator'
      2009-04-03 22:35:03,851 DEBUG [javax.enterprise.resource.webcontainer.jsf.application] Created component with component type of 'org.richfaces.MenuGroup'
      2009-04-03 22:35:03,851 DEBUG [javax.enterprise.resource.webcontainer.jsf.application] Created component with component type of 'org.richfaces.MenuItem'
      2009-04-03 22:35:03,851 DEBUG [javax.enterprise.resource.webcontainer.jsf.application] Created component with component type of 'org.richfaces.MenuItem'
      2009-04-03 22:35:03,851 DEBUG [javax.enterprise.resource.webcontainer.jsf.application] Created component with component type of 'org.richfaces.MenuItem'
      
      .... 
      
      2009-04-03 22:35:05,257 DEBUG [javax.enterprise.resource.webcontainer.jsf.application] Created component with component type of 'org.richfaces.MenuItem'
      2009-04-03 22:35:05,257 DEBUG [javax.enterprise.resource.webcontainer.jsf.application] Created component with component type of 'org.richfaces.MenuItem'
      2009-04-03 22:35:05,257 DEBUG [javax.enterprise.resource.webcontainer.jsf.application] Created component with component type of 'org.richfaces.MenuItem'
      2009-04-03 22:35:05,257 DEBUG [javax.enterprise.resource.webcontainer.jsf.application] Created component with component type of 'org.richfaces.MenuItem'
      2009-04-03 22:35:05,257 DEBUG [javax.enterprise.resource.webcontainer.jsf.application] Created component with component type of 'org.richfaces.MenuItem'
      
      .. notice that for menu building it takes almost 2 sec! The strange thing is that from logs I see that for some reasons it tries to build that menu probably 10 times, since there are 10 times more log entries of menu creation, rather than there are actual menu items. 
      
      .. And log finishes:
      
      2009-04-03 22:35:05,288 DEBUG [javax.enterprise.resource.webcontainer.jsf.renderkit] component.getValue() returned 
      2009-04-03 22:35:05,288 DEBUG [javax.enterprise.resource.webcontainer.jsf.renderkit] Value to be rendered 
      2009-04-03 22:35:05,335 DEBUG [javax.enterprise.resource.webcontainer.jsf.lifecycle] Exiting RenderResponsePhase
      2009-04-03 22:35:05,335 DEBUG [javax.enterprise.resource.webcontainer.jsf.timing]  [TIMING] - [3688ms] : Execution time for phase (including any PhaseListeners) -> RENDER_RESPONSE 6
      



      WOW! [TIMING] - [3688ms], 3.7 seconds for rendering?!


      I am sure that probably it is a sort of configuration problem, but I have desperately googling and trying all kinds of suggestions to improve the performance but didn't find anything.


      Some other additional information:



      • I am not running JBoss AS in debug mode. In debug mode it takes all the stuff twice longer to process.

      • some of my business logic is done really relatively quickly, so I assume the the performance issue is not in whole application, but exceptionally in JSF rendering phase.

      • even some ajax calls which does simple rerender takes more that 1 sec to rerender small area on the page with no special logic inside it.

      • even a simple page with several controls and no data access (like login form) takes around 2 sec. to load and most of this time is spent after all my backing beans actions.



      So, I would be very grateful If anyone could provide some tips or suggestions where I should look at.


      Thanks in advance,
      Justas Janauskas