Minifying JSF ViewState for a large page
I am currently developing a JSF application with design with one page per application , for example in desktop applications. sections are placed in tabs, and each auxiliary operation, such as editing or pasting an item, is displayed in a dialog box.
What becomes a problem is both the size of the ViewState and the processing time for each request. At the moment, the initial size of the ViewState in POST is 200kb (and compression is enabled). The request takes 200 to 400ms (on my machine, no users other than me).
Configuring persistence per session significantly reduces the request, but significantly increases the processing time - now it is between 350 and 600 ms. Since this is an intranet app, net transfer is cheap, so it's better to send more of this process longer.
I don't know how to deal with this problem. Is it possible to reduce the space consumed by JSF components? Most of them don't change on every click, but they seem to be deserialized and processed. Or should I dump all data (like dictionaries for dropdowns) from JSF beans and use heavy caching in the service layer? Or are there other options / tricks / enhancements that I could use?
source to share
As you can imagine, the view state of the entire form is serialized on every anonymous post so that the server and client can stay in sync. ASP.NET works in much the same way.
The Primefaces team has added functionality to many of the Ajax enabled components that allow messages to be sent on a partial page.
http://blog.primefaces.org/?p=1842
The property partialSubmit
will serialize the form elements specified in the process
component attribute or <p:ajax>
. Of course, this is only a solution for Primefaces components, but it reduced the request size significantly on some of my larger JSF pages.
source to share