• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why JSF 2.2 takes more time partial rendering an ajax request compared to JSF 1.2?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am working on migrating a project from (JSF 1.2, Richfaces 3.3.4 running on JBoss 4.2.3) to (JSF 2.2, Richfaces 4.5 running on Wildfly 8.1.0). After partially migrating some views I found that the performance of the application using JSF 2 is terrible.

I noticed this issue when an ajax request is sent, JSF 2 is rendering the whole view although the render attribute is pointing to one outputText

Example

In my example I will use the same code sample for both JSF 1.2 and 2.2. Afterwards I will click on the ajax button multiple times and measure the response time for each request using chrome inspection tool.

Given the following index1.XHTML using JSF 1.2 and Richfaces 3.3.4


Clicking on "TestBtn" multiple times, the average time is 15ms:



Given the following index2.XHTML using JSF 2.2 and Richfaces 4.5.0


Clicking on "TestBtn" multiple times, the average time is 18ms:



Well, so far so good. Now the performance issue comes when I add the following outputText elements


I added these element 300 times in both index1.xhtml and index2.xhtml and repeated the same tests

The results using index1.xhtml (JSF 1.2), I got average time of 19ms



The results using index2.xhtml (JSF 2.2), I got average time of 150ms (!!!)



Which is 8 times slower than JSF 1.2

Could someone explain please why JSF 2 is slower than JSF 1? and how can I improve the performance for this example?

Thanks in Advance,
Tefa
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JSF version 1 didn't support AJAX at all. You were getting the AJAX functionality from the a4j extension tagset's commandButton control. A4J was originally more or less an independent extension tag library, but it became part of the RichFaces version 3 tag set.

I have a severe complaint about RichFaces 4 and that's that their migration path from RichFaces 3 is the worst I've seen since Microsoft replaced VB6 with Visual Basic .Net. It's an all-or-nothing task with significant re-writing involved, not the usual deprecations and migrations that Java is known for.

In particular, the a:commandButton tag shouldn't be working at all, I don't think, because it's replaced by the JSF2 standard f:ajax tag's function.

Your horrible performance probably is resulting from having RichFaces3 code (a4j) mixed in with RichFaces 4 code. And they are mutually exclusive.
 
Ranch Hand
Posts: 99
MyEclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should not use RF3 with RF4. RF4 fully supports JSF2 and thus you should use only RF4 and JSF2 namespaces.

P.S. Anyways, RF4 sucks IMHO. I highly recommend using PrimeFaces.
 
Tefa Elgen
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your answers :)

I finally found out why the ajax response with Wildfly is slow for me only.

It turns out that this performance issue has nothing to do with JSF version or mojarra version. It is actually related to Wildfly configuration (Weld to be specific)

"org.jboss.as.weld" was disabled in my wildfly server. By default, when you download wildfly it is enabled. That's why no one was getting any performance issues.

To enable/disable weld in Wildfly just add/remove the following 2 lines from the standalone.xml found in "{JBOSS_HOME}/standalone/configuration" (the extension and the subsystem):

If you remove weld and try out the example I mentioned in my question, you should have a delay in ajax responses

I don't know why disabling weld causing this issue.

So basically, in wildfly 8.x or even in jboss 7.x, disabling weld results in a really slow performance in JSF.

Could someone please explain to me how does disabling weld affect the performance even if I don't need it?

You can download my example from HERE
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Tefa Elgen ,

I have found a solution for minimize data transfer size . see the last comment .

use primeface and context.addCallbackParam("isValid", true); into your save() method.


https://coderanch.com/t/645141/JSF/java/Java-Response#2972633

reply
    Bookmark Topic Watch Topic
  • New Topic