I use Mojarra implementation of JSF (version 2.2.1). I have a big problem with performance during ajax requests.
My page has a lot of components so I understand why first rendering takes much time, but what with ajax requests?
They takes also a lot of time although they do almost nothing. Here is my simplified example:
In below example pressing "performance test" button takes several ms:
<?xml version="1.0" encoding="UTF-8"?>
<!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:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<h:body>
Hello World
<h:form>
<h:commandButton value="performance test">
<f:ajax execute="@this" render="@none" />
</h:commandButton>
</h:form>
</h:body>
</html>
But if add 1000 <h:inputText />
elements to the <h:form></h:form>
the same action takes
over 100ms !
I have checked that 80% of time is consumed in RESTORE_VIEW phase, 20 % in RENDER_RESPONSE phase, rest of phases do not take significant amount of time.
Is there any possibility to fix it?
I tried also to disable javax.faces.PARTIAL_STATE_SAVING (memory consumption is not the problem in my case) but also without any success.
EDIT:
A thousand of <h:inputText>
added to a <h:form>
was only a simplified example. I just wanted to emphasize the fact that big amount of components has significant influence on the ajax request (that does almost nothing) - which is a severe problem on my website.
In the reality, of course, I don't have 1000 inputs. I display very big table with a lot of data - if data is empty in any cell there should by an hyphen instead. I used composite component for that - where I had more than one ui:fragment
with render=true/false
Today I tried to use my own component instead of composite one - and response time and memory usage have decreased.
But I'm still not satisfied because my very simple ajax request on that page takes much more time than the same ajax request used on another - thinner page (i.e. with less number of components). Isn't it any JSF architecture issue?