3
votes

I am working on a JSF application which is supposed to support a big scale of users logged in at the same time. And when we tried with our stress testing, we have observed that a large portion of CPU time is spent on rebuilding and traversing through the component tree.

My first thought was to try to make specific parts of the page stateless and thus be excluded from the component tree. But if I wrap a form element with the f:view being marked as transient:

<f:view transient="true">
    <h:form>
        ....
    </h:form>
</f:view>

, all my other forms on the page are also stateless (the hidden input field that is supposed to hold the state has for 'value' attribute value 'stateless': ).

Is there a way to make only specific forms on the page stateless, or the whole page can be either stateless or stateful?

Thanks for any kind of help!

EDIT:

For implementation we are using Mojarra 2.2.7, along with Primefaces 4.0 as a component library and Omnifaces 1.7 for some utility functionalities.

1
Which JSF implementation are you using? which JSF component libraries are you using?lu4242
I have added it in an edit to the initial question. Thanks!Nikola
I ignore how Mojarra works, but some tests I did some time ago shows that use f:view transient="true" has an effect. With MyFaces the algorithm has been designed in a way that state saving is really fast, so there is no difference between mark the whole view as stateless or not. Instead, from performance perspective, EL Caching, Html space compression and other improvements available in MyFaces are more effective. Try use MyFaces 2.2.4 and you'll see a big performance improvement, which is what you are looking for.lu4242
Take a look at this article that can help you with your stress tests: Understanding JSF 2.0 Performance – Part 3. The code is in Github if you want to take a look.lu4242

1 Answers

0
votes

Based on what Balusc has said on this link, applying the transient on a view tag will make the entire view (i.e page) stateless which makes sense because setting transient to true calls the setTransient() on the UIViewRoot object. This can not be accomplished with your current setup. I'm not sure if there is a hack or work around to achieve a single page with multiple states some alternative way.