Seeing as there are no replies on this topic yet, I assume it isn't easy to add functionality like this.
Still, I would like to see a discussion about this.
Am I the only one with a large rich application, that takes up quite a few MB of memory during the RESTORE_VIEW phase?
Would you like to see functionality that allows you to restore only a part of the view to save memory useage?
Does anyone think this would be a great improvement to JSF in general?
Is there any work-around to get funcionality like this?
This particular issue is becoming a bottleneck to our application, so some feedback would be great :)
Sorry, but a4j:region has no relations to the JSF view state saving and restoring, but view processing only.
Are you sure about view tree size at the request processing phase ? Most common memory consumption problem is a size of saved views history. You can reduce that size using some optimization tricks:
1) With the server-side view saving, reduce number of stored views by the "com.sun.faces.numberOfViewsInSession" and "com.sun.faces.numberOfLogicalViews" initialization parameters ( see http://wiki.glassfish.java.net/Wiki.jsp?page=JavaServerFacesRI for a reference ).
2) Mark output-only JSF components as "transient" where possible. In the Facelets environment, you can even mark as transient entire <f:view> and set "facelets.BUILD_BEFORE_RESTORE" init parameter to "true" ( Warning: that change could significant affect JSF behaviour, thus it not always applicable ).
3) Use client-side view state saving. It will reduce memory consumption but significant increase a network traffic at the same time.
alexsmirnov, thank you for your reply!
I'm sure the memory spikes occur during the JSF LifeCycle. When the state is serialized, it doesn't use much memory, only when the view is active as java objects.
Regarding point one; Our application uses only one view per client, everything 'happens' in one page. The components are built dynamic, so there is no need to have more than one page, except for a login page. The amount of views per client is already set to one.
Regarding point three; This is not an option due to the traffic. And as I mentioned a bit earlier in this post, the serialized view is not a problem.
Regarding point two; This is definately something I will look into, thanks for this suggestion. However, I doubt this will affect the memory consumption of a restored view.
I see that there is no default method to omit part of the view. Does anyone know if there is a work-around possible to omit parts of the view during the first JSF Phase, or where I could find information about this?