Why JSF 2.2 takes more time partial rendering an ajax request on Wildfly

对着背影说爱祢 提交于 2019-12-04 09:11:35

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):

<extensions>
    ..............
    <extension module="org.jboss.as.weld"/>
    ..............
</extensions>
<profile>
     ..............
    <subsystem xmlns="urn:jboss:domain:weld:2.0"/>
</profile>

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 but this is different question not related to this current question.

Hope this might help someone

I ran your example without Richfaces using an h:commandButton and 300 outputTexts that bind to a bean property, wrapped with a panelGroup. While there was a difference, it's not earth chattering. It may, however, be worthwhile to create a JIRA issue for the Mojarra team to look into it.

Here are my results. I threw away the first request to rule out any initialization effect. Perhaps the most visible difference is with the last 5 requests average since the response time stopped fluctuating by that time (perhaps some optimization kicked in).

Using Mojarra 2.2.6:

Sample size: 20
Total time:  2111 ms
Average time: 105.55 ms
STDDEV: 22.01
Last 5 average: 85.40 ms

Using Mojarra 2.1.28:

Sample size: 20
Total time:  1331 ms
Average time: 66.55 ms
STDDEV: 29.94
Last 5 average: 39.60 ms

I tested your example but using well-known Primefaces instead of Richfaces. It came up with 12ms for response time for every button click. I doubt that there might be something wrong with Richfaces command button javascript code. You may download Primefaces, carrying out the same test then come back here to tell me whether it's faster or slower.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!