2

We have issue with performance of our application. We are using client STATE_SAVING_METHOD. I made some test on playground project and found the root cause are composite components witch we are using heavily.

Let me introduce my test case:

<h:form>
    <p:outputLabel value="Test input"/>
    <p:inputText id="testInputTextId"
                 value="#{customerController.someTestValue}">
        <p:ajax event="click" update="testInputTextId" listener="#{customerController.increaseValue()}"
                process="@this" partialSubmit="true"/>
    </p:inputText>
</h:form>
 <h:form>
    <c:forEach begin="0" end="5000" varStatus="loop">
        <!-- specific code -->
    </c:forEach>
</h:form>

CustomerController has just int member with method to increase its value. I've used c:forEach tag to simulate big view.

First example (without composite component) works as expected, just replace comment by:

<p:panelGrid>
    <p:row>
        <p:column>
            <p:outputLabel value="Label(A) #{loop.index}"/>
        </p:column>
        <p:column>
            <p:inputText value="Value #{loop.index}"/>
        </p:column>
    </p:row>
</p:panelGrid>

Second example is the same but mentioned code is in the composite component:

<ui:component xmlns="http://www.w3.org/1999/xhtml"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:p="http://primefaces.org/ui"
          xmlns:composite="http://java.sun.com/jsf/composite">

    <composite:interface>
        <composite:attribute name="label" required="true" type="java.lang.String"/>
    </composite:interface>

    <composite:implementation>
        <p:panelGrid>
            <p:row>
                <p:column>
                    <p:outputLabel value="Label(B) #{cc.attrs.label}"/>
                </p:column>
                <p:column>
                    <p:inputText value="Value #{cc.attrs.label}"/>
                </p:column>
            </p:row>
        </p:panelGrid>
    </composite:implementation>
</ui:component>

so replace comment by

<cc:testInputCompositeComponent label="#{loop.index}"/>

And now the test results:

Tomee 1.5.2 (JSF 2.1.29-03, PrimeFaces 5.2.3, JDK 64 1.7.0_67)

simple page:

  • load page: 3,3 MB/12s
  • paritalSubmit: 1,6 KB/400ms

with composite component:

  • load page: 3,7 MB/16s
  • paritalSubmit: 91 KB/1s

with facelet tag file:

  • load page: 3,3 MB/16s
  • paritalSubmit: 1,6 KB/10s

Tomee 1.7.1 (JSF 2.1.29-03, JSF 2.2.11, PrimeFaces 5.2.3, JDK 64 1.7.0_67)

simple page:

  • load page: 3,3 MB/12s
  • paritalSubmit: 1,5 KB/300ms

with composite component:

  • load page: 3,7 MB/16s
  • paritalSubmit: 90 KB/1s

with facelet tag file:

  • load page: 3,3 MB/16s
  • paritalSubmit: 1,6 KB/500ms

GlassFish 4.1 (JSF 2.2.11, PrimeFaces 5.2.3, JDK 64 1.8.0_45)

simple page:

  • load page: 3,3 MB/14s
  • paritalSubmit: 1,6 KB/4s

with composite component:

  • load page: 3,7 MB/16s
  • paritalSubmit: 90 KB/5s

with facelet tag file:

  • load page: 3,3 MB/16s
  • paritalSubmit: 1,6 KB/ 4s

So traffic is more then 50 times bigger when composite component is used. On local ENV it is not big issue but in the real world, where clients and server are far away, it causes that user needs wait 3-5 seconds for very simple operation where just one component should be updated based on user action. Notice that I'm basically do nothing with second form, just want to update component in first one.

Please, does anybody know if it is known issue? Or do I have something wrong? Thank you.

[Updated] Based on BalusC comment I made test also with Facelet Tag files and added results to original post.

Used latest browsers to measure: Opera, Firefox

There are some interesting numbers:

  1. Traffic of facelet tag is low on Tomee 1.5.2, but time is 10s (We are forced to use TomEE 1.5.2 because of additional dependencies)
  2. I've tested both JSF 2.1 and 2.2 on TomEE 1.7.1 and there were minor differences
  3. GlassFish & JSF 2.2 & Facelet tag takes 4s, why so long. Tomee 1.5 is old, but GF is new with new libraries?
  4. Question is why even if traffic is low, time is high (e.g. TomEE 1.5.2, & Facelet tag)
sasynkamil
  • 859
  • 2
  • 12
  • 23
  • 2
    Can you see what is in the partial submit **request** that makes it bigger? Or is the **response** of the submit 50 time larger with a custom component – Kukeltje May 19 '15 at 18:57
  • and does it make a difference if you make it a custom tag instead of a composite component? https://blog.oio.de/2012/05/23/custom-tags-as-an-alternative-to-composite-components-in-jsf/ – Kukeltje May 19 '15 at 19:09
  • Related: http://stackoverflow.com/q/6822000 This particular composite component should rather be a tagfile. Nevertheless an interesting measure. Composites were indeed state saving monsters, but I wouldn't expect to still see that in current Mojarra versions. – BalusC May 19 '15 at 19:27
  • @BalusC: so you think it is a huge client-side state saving that causes the difference in size? The much longer response time of GF also stands out – Kukeltje May 19 '15 at 22:38
  • See my initial comment (in combination with myast comment) – Kukeltje May 20 '15 at 06:47
  • @Kukeltje I can see that javax.faces.ViewState contains 534b for simple and 26Kb for cc. Request for simple has 1,4Kb and for cc 96Kb. – sasynkamil May 20 '15 at 07:21
  • 2
    So you use client-side state saving? Does using server-side state saving make a difference in performance in tomee1.5 – Kukeltje May 20 '15 at 07:32
  • @Kukeltje Yes, sorry, I should put this information in original question - it is very important statement. If I switch to the server state saving, then cc works as expected: 1KB/500ms. Maybe this is short term solution. I need run stress tests after this change. Interesting is that MyFaces wiki mentioned this behavior as needed/requested: https://myfaces.apache.org/wiki/core/user-guide/configuration-of-special-features/update-all-form-javax.faces.viewstate-hidden-fields-between-ajax-requests.html – sasynkamil May 20 '15 at 08:11
  • Still it is better to make it a custom tag instead of cc as BalusC stated – Kukeltje May 20 '15 at 08:42
  • Yes, facelet tag file (FTF) should fix this traffic problem. We are using composite components because we like that it looks like normal JSF/PF component. It has just one file per CC and everything, specially interface part (type, mandatory, default value, etc.), you can define in it. And user of that component can very easilly work wit it speically in IntelliJ Idea IDE. Based on BalusC http://stackoverflow.com/questions/6822000/when-to-use-uiinclude-tag-files-composite-components-and-or-custom-componen I don't see really big difference in CC & FTF (except the traffic issue). – sasynkamil May 20 '15 at 10:44

0 Answers0