0

I have a JSF 2.3.9 application from Glassfish Running on Tomcat 9 and Java 8

My JSF configuration is as follows:

<context-param>
  <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
  <param-value>client</param-value>
 </context-param>

<context-param>
  <param-name>javax.faces.FACELETS_BUFFER_SIZE</param-name>
  <param-value>100000000</param-value>
 </context-param>

<context-param>
  <param-name>com.sun.faces.numberOfViewsInSession</param-name>
  <param-value>5</param-value>
 </context-param>

<context-param>
  <param-name>com.sun.faces.numberOfLogicalViews</param-name>
  <param-value>5</param-value>
 </context-param>

On production environment I got OutOfMemory and when analyzing the heap dump using JProfiler I found that I have lots of javax.faces.ViewState inputs each one consumes 200 MB as follows:

enter image description here

My question is why javax.faces.ViewState can consume this much memory although the state saving method is set to client ! also how to minimize the size of javax.faces.ViewState ?

Mahmoud Saleh
  • 33,303
  • 119
  • 337
  • 498
  • 1
    Most common causes of the described issue are using `binding` with a bean property in a view or session scoped bean and having a copy of some big database table in a view or session scoped bean. Make sure the app doesn't have any of these mistakes. See also bottom part of top rated answer of https://stackoverflow.com/q/5474316 – BalusC Mar 28 '23 at 10:58

0 Answers0