1 2 Previous Next 18 Replies Latest reply on May 28, 2008 1:31 PM by blackdog69

    RichFaces performance?

    blackdog69

      Hi all,

      Would anyone like to comment on the performance of RichFaces components?

      My first experience with RichFaces was the demo at livedemo.exadel.com. I noticed the pages were painfully slow to load but I assumed Exadel had slow hosting. Every page takes a good 5-10 seconds to load.

      We proceeded with our project in RichFaces anyway but our pages our loading slowly too, but we have pretty fast hosting and the server has no load. I've tried the demo apps and my app on several computers, browsers and Internet connections... all SLOW. Even functions that should be 100% client side (like opening a modal panel) take too long.

      RichFaces seems pretty cool but my experience with the performance has been TERRIBLE. The ICEfaces demos run way faster on my computer than the RichFaces demos.

      I don't know what else to do. I'd appreciate any ideas or feedback.


      Thanks in advance!
      Barry

        • 1. Re: RichFaces performance?

          There are to different issues here:

          1 livedemo.exadel.com host is overloaded with tones of other applications (that have no any relation to RichFaces).

          2. It is not too hard to make JSF application works SLOW if it architecture is not correct.

          • 2. Re: RichFaces performance?

            First let me say that I like Richfaces and appreciate all of the work you guys put in to let me use a free product.

            However, why is funding for servers so scarce?

            First there is a shortage of storage for snapshots. Hard drives are cheap.

            Now the demo server is overloaded. Servers are cheap.

            For an company that wants to target enterprise level support contracts, you would think Redhat could spare a little funding for hardware.

            Does M$ site pull slow?

            • 3. Re: RichFaces performance?

               

              "blackdog69" wrote:

              We proceeded with our project in RichFaces anyway but our pages our loading slowly too, but we have pretty fast hosting and the server has no load. I've tried the demo apps and my app on several computers, browsers and Internet connections... all SLOW. Even functions that should be 100% client side (like opening a modal panel) take too long.


              One more known thing.
              Do you use FireFox 2? If so, turn off FireBug and restart FireFox.

              • 4. Re: RichFaces performance?
                eklam

                I've never had any problem with performance using richFaces... All the resources and features I use here are pretty quick and the ajas requests are done and completed as son as I can move my eye from the button to the reRendered component... :) I love it!

                But the online demo really s*cks :(
                It take even minutes to load, but one time loaded the performance is pretty good...

                I think all the problems (not much) richfaces has, performance is the smaller of'em

                • 5. Re: RichFaces performance?
                  lmk

                   

                  "Eklam" wrote:
                  I've never had any problem with performance using richFaces... All the resources and features I use here are pretty quick and the ajas requests are done and completed as son as I can move my eye from the button to the reRendered component... :) I love it!

                  But the online demo really s*cks :(
                  It take even minutes to load, but one time loaded the performance is pretty good...

                  I think all the problems (not much) richfaces has, performance is the smaller of'em



                  dont you get performance problem with modalPanel ? I think that performance problems still exists on some RF components.


                  • 6. Re: RichFaces performance?

                    As best I know, currently, we have no one confirmed case with RichFaces component performance.

                    • 7. Re: RichFaces performance?
                      ilya_shaikovsky

                      Guys, a can add that there was confirmed cases in our jira and all of them was solved. So just show us concrete perfomance cases and we'll investigate them for sure ;)

                      • 8. Re: RichFaces performance?
                        lucab

                         

                        "lmk" wrote:



                        dont you get performance problem with modalPanel ? I think that performance problems still exists on some RF components.


                        I experience some slowdown with modal panels but not on every machine i have available for testing. So i concluded that is not an RF performance issue.
                        For what concern performance in general, i'm currently developing on a pentium IV and all run very fast. I agree with sergey when he says the performance slowdown are more probably due to bad design.

                        I think RF faces performs pretty well (at least in my test environment), even compared with other projects like Icefaces or ZK.

                        • 9. Re: RichFaces performance?
                          mbi

                          hm ...
                          i've got an quite simple tree with "just" 50 elements á 200 childs -> 10.000 nodes

                          every node gots:
                          - some little text
                          - image for a checkbox via h:graphicImage
                          - a4j:support for listenersupport at the image

                          expanding/collapsing nodes and checking the checkboxes takes a lot of time...

                          jprofiler tells me that most of the time is spend by domparsing. i dont know if i handle the tree as intended. here is some code:

                          JSP

                          <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
                          <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
                          <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
                          <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
                          <html>
                          <head>
                          <title>tree</title>
                          </head>
                          <body>
                          <f:view>
                           <h:form>
                           <a4j:loadStyle src="/res/button.css" />
                           <a4j:loadStyle src="/res/tree/style.css" />
                           <a4j:commandButton id="show_me" value="show childs" styleClass="normalButton">
                           <a4j:ajaxListener type="controller.listener.ListenerBean" />
                           </a4j:commandButton>
                           <h:panelGrid columns="2">
                           <h:outputLabel>
                           <h:outputText value="infinite Tree extended"></h:outputText>
                           <rich:tree componentState="#{treeBean.treeState}" id="infinite_Tree_expanded" style="width:300px" switchType="ajax" stateAdvisor="#{treeDemoStateAdvisor}">
                          
                           <rich:recursiveTreeNodesAdaptor roots="#{treeBean.rootNodes}" var="item" nodes="#{item.children}">
                           <rich:treeNode nodeSelectListener="#{treeBean.processSelection}">
                           <h:graphicImage value="/res/tree/chkb_#{item.state}.png">
                           <a4j:support event="onclick" reRender="infinite_Tree_expanded" actionListener="#{item.actionListener}"/>
                           </h:graphicImage>
                           <h:outputText value="#{item.value} - #{item.state}"/>
                           </rich:treeNode>
                           </rich:recursiveTreeNodesAdaptor>
                          
                           </rich:tree>
                           </h:outputLabel>
                           </h:panelGrid>
                           </h:form>
                          </f:view>
                          </body>
                          </html>


                          TreeBean:
                          package my_tree;
                          
                          import java.io.IOException;
                          import java.io.InputStream;
                          import java.util.Properties;
                          
                          import javax.faces.FacesException;
                          import javax.faces.context.ExternalContext;
                          import javax.faces.context.FacesContext;
                          import javax.faces.event.AbortProcessingException;
                          
                          import org.richfaces.component.state.TreeState;
                          import org.richfaces.event.NodeSelectedEvent;
                          
                          public class TreeBean {
                          
                           private TreeNode rootNode = null;
                           private TreeNode[] rootNodes = null;
                          
                           private TreeState treeState;
                          
                           private static final String DATA_PATH = "/res/tree/simple-tree-data.properties";
                          
                           public TreeNode getRootNode() {
                           if (rootNode == null) {
                           loadTree();
                           }
                          
                           return rootNode;
                           }
                          
                           public void setRootNode(TreeNode rootNode) {
                           this.rootNode = rootNode;
                           }
                          
                           public TreeNode[] getRootNodes() {
                           if (rootNodes == null) {
                           rootNodes = this.getRootNode().getChildren();
                           }
                           return rootNodes;
                           }
                          
                           public void setRootNodes(TreeNode[] rootNodes) {
                           this.rootNodes = rootNodes;
                           }
                          
                           public TreeState getTreeState() {
                           return treeState;
                           }
                          
                           public void setTreeState(TreeState treeState) {
                           this.treeState = treeState;
                           }
                          
                           private void addNodes(String path, TreeNode node, Properties properties) {
                           boolean end = false;
                           int counter = 1;
                          
                           while (!end) {
                           String key = path != null ? path + '.' + counter : String
                           .valueOf(counter);
                          
                           String value = properties.getProperty(key);
                           if (value != null) {
                           TreeNode newNode = new TreeNode(value);
                           newNode.setParent(node);
                           node.addNode(newNode);
                           addNodes(key, newNode, properties);
                           counter++;
                           } else {
                           end = true;
                           }
                           }
                           }
                          
                           private void loadTree() {
                           System.out.println("TreeBean -> loadTree()");
                           FacesContext facesContext = FacesContext.getCurrentInstance();
                           ExternalContext externalContext = facesContext.getExternalContext();
                           InputStream dataStream = externalContext.getResourceAsStream(DATA_PATH);
                           try {
                           Properties properties = new Properties();
                           properties.load(dataStream);
                          
                           rootNode = new TreeNode("root");
                           addNodes(null, rootNode, properties);
                           // manual tree extension
                          
                           TreeNode dummy = new TreeNode("Sichtlinie");
                           int count = 0;
                           for (int i = 1; i <= 50; i++) {
                           count++;
                           TreeNode node = new TreeNode("i" + i);
                           for (int j = 1; j <= 200; j++) {
                           count++;
                           if (count % 1000 == 0) {
                           System.out.println(count);
                           }
                           TreeNode child = new TreeNode("j" + j);
                           child.setParent(node);
                           node.addNode(child);
                           }
                           node.setParent(dummy);
                           dummy.addNode(node);
                           }
                           rootNode.addNode(dummy);
                          
                           } catch (IOException e) {
                           e.printStackTrace();
                           throw new FacesException(e.getMessage(), e);
                          
                           } finally {
                           if (dataStream != null) {
                           try {
                           dataStream.close();
                           } catch (IOException e) {
                           e.printStackTrace();
                           externalContext.log(e.getMessage(), e);
                           }
                           }
                           }
                          
                           }
                          
                           public void processSelection(NodeSelectedEvent arg0)
                           throws AbortProcessingException {
                           System.out.println("SimpleTreeBean -> processSelection fired by "
                           + arg0.getComponent().getId());
                          
                           }


                          TreeNode:
                          package my_tree;
                          
                          import javax.faces.event.ActionEvent;
                          
                          import org.richfaces.model.TreeNodeImpl;
                          
                          
                          
                          public class TreeNode{
                          
                          
                           private String value;
                           private String state;
                          
                           private TreeNode parent;
                           private TreeNode[] children;
                          
                          
                           public TreeNode(String value) {
                           this.value = value;
                           this.state = "";
                           }
                          
                           public synchronized void addNode(TreeNode newChild) {
                           System.out.println("addNode("+newChild.getValue()+")");
                           if (this.children == null) {
                           TreeNode[] merged = new TreeNode[1];
                           merged[0] = newChild;
                           this.children = merged;
                           } else {
                           TreeNode[] merged = new TreeNode[this.children.length + 1];
                           int i;
                           for (i = 0; i < this.children.length; i++) {
                           merged = this.children;
                           }
                           merged[merged.length - 1] = newChild;
                           this.children = merged;
                           }
                           }
                          
                           public synchronized void addNodes(TreeNode[] newChildren) {
                           System.out.println("addNodeS("+newChildren.length+")");
                           TreeNode[] merged = new TreeNode[newChildren.length
                           + this.children.length];
                           int i;
                           for (i = 0; i <= this.children.length; i++) {
                           merged = this.children;
                           }
                           for (int i2 = i; i2 <= newChildren.length + i; i2++) {
                           merged[i2] = newChildren[i2];
                           }
                           this.children = merged;
                           }
                          
                           public synchronized void removeNodes(TreeNode[] removeChildren) {
                           TreeNode[] splitted = new TreeNode[this.children.length
                           - removeChildren.length];
                           int pos = 0;
                           for (int i = 0; i <= this.children.length; i++) {
                           boolean contains = false;
                           for (int j = 0; j <= removeChildren.length; j++) {
                           if (this.children == removeChildren[j]) {
                           contains = true;
                           }
                           }
                           if (contains == false) {
                           splitted[pos] = this.children;
                           pos++;
                           }
                           }
                           }
                          
                           public String checkSibling(){
                           //System.out.println("checkSibling() of "+this.value);
                           if(this.children!=null){
                           String state = null;
                           int checked = 0;
                           int sub = 0;
                           int i;
                           TreeNode[] siblings = this.children;
                           for (i = 0; i < siblings.length; i++) {
                          
                           TreeNode treeNode = siblings;
                           //System.out.println("\t"+treeNode.getValue()+" - "+treeNode.getState());
                           if(!treeNode.getState().equals("")){
                           if(treeNode.getState().equals("checked")){
                           checked++;
                           } else if(treeNode.getState().equals("sub")){
                           sub++;
                           }
                           }
                          
                           }
                          
                           if(checked == i){
                           state = "checked";
                           } else if(sub > 0 || checked > 0) {
                           state = "sub";
                           } else {
                           state = "";
                           }
                           //System.out.println("siblings: "+i+" (checked: "+checked+" sub: "+sub+") -> "+state);
                           return state;
                           } else {
                           return "";
                           }
                          
                           }
                          
                           public void setChildsChecked(TreeNode node){
                           //System.out.println("TreeNode -> setChildsChecked of "+node.getValue());
                           if(node.getChildren()!=null){
                           TreeNode[] children = node.getChildren();
                           for (int i = 0; i < children.length; i++) {
                           TreeNode treeNode = children;
                           treeNode.setState("checked");
                           setChildsChecked(treeNode);
                           }
                           }
                           }
                          
                           public void setChildsUnchecked(TreeNode node){
                           //System.out.println("TreeNode -> setChildsUnchecked of "+node.getValue());
                           if(node.getChildren()!=null){
                           TreeNode[] children = node.getChildren();
                           for (int i = 0; i < children.length; i++) {
                           TreeNode treeNode = children;
                           treeNode.setState("");
                           setChildsUnchecked(treeNode);
                           }
                           }
                           }
                          
                           public void setParentsState(TreeNode node){
                           System.out.println("TreeNode -> setParentsState of "+node.getValue());
                           node.setState(node.checkSibling());
                           if(node.getParent()!=null){
                           setParentsState(node.getParent());
                           }
                           }
                          
                           public void actionListener(ActionEvent ae){
                           //System.out.println("TreeNode -> nodeListener fired by "+ae.getComponent().getId());
                           if(this.state == "checked"){
                           this.state = "";
                           setChildsUnchecked(this);
                           } else {
                           this.state = "checked";
                           setChildsChecked(this);
                           }
                           if(this.parent!=null){
                           setParentsState(this.parent);
                           }
                          
                           }
                          
                           public String getValue() {
                           return value;
                           }
                          
                           public void setValue(String value) {
                           this.value = value;
                           }
                          
                           public TreeNode[] getChildren() {
                           return children;
                           }
                          
                           public void setChildren(TreeNode[] children) {
                           this.children = children;
                           }
                          
                          
                          
                           public TreeNode getParent() {
                           if(parent==null){
                           return null;
                           } else {
                           return parent;
                           }
                           }
                          
                           public void setParent(TreeNode parent) {
                           this.parent = parent;
                           }
                          
                           public String getState() {
                           return state;
                           }
                          
                           public void setState(String state) {
                           this.state = state;
                           }
                          
                          
                           }
                          


                          pls tell me if the performance problem is caused by me.

                          • 10. Re: RichFaces performance?
                            ilya_shaikovsky

                            put this to jira please.

                            • 11. Re: RichFaces performance?
                              mbi

                              me? sorry i dont know how :X

                              • 12. Re: RichFaces performance?
                                alsha

                                Hi!

                                Performance of rich:modalPanel is realy a problem.

                                Take a look at http://jboss.com/index.html?module=bb&op=viewtopic&t=133524


                                Just create a BIG data table and show modalPanel over it!

                                Here is some code to reproduce the issue:

                                xhtml:

                                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                                
                                <html xmlns="http://www.w3.org/1999/xhtml"
                                 xmlns:ui="http://java.sun.com/jsf/facelets"
                                 xmlns:h="http://java.sun.com/jsf/html"
                                 xmlns:f="http://java.sun.com/jsf/core"
                                 xmlns:rich="http://richfaces.ajax4jsf.org/rich" xml:lang="en" lang="en"
                                 xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
                                 >
                                
                                 <h:form>
                                 <rich:dataTable id="ll" value="#{myBean.model}" var="model">
                                 <rich:columns value="#{myBean.columns}" var="columns" index="ind" >
                                 <f:facet name="header">
                                 <h:outputText value="#{columns}" />
                                 </f:facet>
                                 <h:outputText value="#{model[ind]}" />
                                 </rich:columns>
                                 </rich:dataTable>
                                 <a4j:commandButton id="buttonExport" value="modal panel" onclick="javascript:Richfaces.showModalPanel('tableExportPanel')"/>
                                 </h:form>
                                 <rich:modalPanel id="tableExportPanel" height="400" width="400" autosized="true" resizeable="false" zindex="2000">
                                 <a4j:commandButton id="closeButton" value="close" onclick="javascript:Richfaces.hideModalPanel('tableExportPanel')"/>
                                 </rich:modalPanel>
                                </html>
                                


                                MyBean.java:

                                import java.util.ArrayList;
                                
                                public class MyBean {
                                 private int cols = 600;
                                 private int records = 15;
                                 private ArrayList<Object[]> model = new ArrayList<Object[]>();
                                 private Object[] columns = new Object[cols];
                                
                                 public MyBean() {
                                 super();
                                 createColumns();
                                 createModel();
                                
                                 }
                                
                                 public ArrayList<Object[]> getModel() {
                                
                                 return model;
                                 }
                                
                                 public Object[] getColumns() {
                                 return columns;
                                 }
                                
                                 private void createColumns() {
                                 for (int i = 0; i < cols; i++) {
                                 columns = "header " + i;
                                 }
                                 }
                                
                                 private void createModel() {
                                 for (int i = 0; i < records; i++) {
                                 Object[] colArray = new Object[cols];
                                 for (int j = 0; j < colArray.length; j++) {
                                 colArray[j] = i + "_" + j;
                                 }
                                 this.model.add(colArray);
                                
                                 }
                                 }
                                
                                 public void setModel(ArrayList<Object[]> model) {
                                 this.model = model;
                                 }
                                
                                 public void setColumns(Object[] columns) {
                                 this.columns = columns;
                                 }
                                
                                 }
                                




                                • 13. Re: RichFaces performance?
                                  ilya_shaikovsky

                                  guys.. I'm trying to pay your attention again to my phrase "Concrete cases in jira" ;)

                                  So, Feel free to submit your samples to jira.

                                  • 14. Re: RichFaces performance?
                                    alsha

                                    Ilya: could you please explain, how can i submit it in jira?

                                    Thanks!

                                    1 2 Previous Next