Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSF Richfaces frontend performance tuning

I've developed a web application using MyFaces 1.2.6 and Richfaces 3.3.1GA (just upgrated). Despite the ease of use, I found out that Richfaces components are very slow.

I also found out that they didn't really take advantage of the browser caching mechanism, they keep sending some lousy JS file every request and other things. I really would like to apply some rules described in the "High PErformance WEbsites" book, but I can't change de generated js and HTML code.

Does anyone have some tips for frontend performance tuning using Richfaces?

Thanks.

like image 372
razenha Avatar asked Dec 18 '22 07:12

razenha


1 Answers

Have a read of this article.

Are you using Firebug + YSlow to check what is being stored in the cache? Using the web.xml org.richfaces.LoadScriptStrategy setting, you can tell Richfaces to either:

  • Load all script in one file.
  • Load no scripts (you do it yourself instead - eg. in the manner prescribed by your book).
  • Load scripts when needed (the default).

But some basic principles :

  • Never put logic into your getters. They are called multiple times and should only return something already populated by another method. For example if you are chaining drop-downs together use an a4j:support tag on the first one with an action attribute that loads the data which is then retrieved when you reRender the second one.

  • Use the ajaxSingle="true" unless you actually want to send the whole form back to the server.

  • Don't use a rich component if you only need a normal one. For example don't use rich:dataTable unless you are making use of some of the features that it has over and above h:dataTable.

like image 90
Damo Avatar answered Dec 25 '22 10:12

Damo