1 Reply Latest reply on Jul 10, 2008 7:45 AM by Dmitri Voronov

    AjaxStateHolder session size

    gejzir Newbie

      Hi All,

      We're writing a JSF web application which in parts using Ajax4JSF on a few pages. We've noticed that a session size for a user is quite big.

      I've written a session test page, where I'm serializing the session's objects to a memory buffer, and measuring the buffer size after every object. At the bottom there is the output. I've noticed, that the size of AjaxStateHolder is quite big, more than a megabyte.

      Is it normal that this object in the session is so big? Where can I configure the size or behavior of this object?

      Thank you in advance:
      Gejzir

      SessionTest

      Session list: javax.faces.request.charset Serializable:true Session serialized size: 12
      PriceBean Serializable:true Session serialized size: 9093
      UserBean Serializable:true Session serialized size: 309504
      LocaleBean Serializable:true Session serialized size: 309638
      org.ajax4jsf.application.AjaxStateHolder Serializable:true Session serialized size: 1413317
      MenuBean Serializable:true Session serialized size: 1413401
      .
      .
      .
      Full session serialized size: 1431303



        • 1. Re: AjaxStateHolder session size
          Dmitri Voronov Novice

          Hi gejzir,

          we are facing the same issue in our seam application. I noticed that the heap size grows after every view; even if I jump between the same two views. On debbuging I found out that AjaxStateHolder caches the shown view in its LRUMap attribute. But the same view can occur several time in this "cache"; the views from this "cache" are not reused and just fill the session. If an application has many large views and deals with many concurrent sessions, the heap can easily grow up to Gigabytes(!)
          As workaround you can define the size of the LRUMap in the web.xml:

           <context-param>
           <description>
           </description>
           <param-name>com.sun.faces.numberOfViewsInSession</param-name>
           <param-value>1</param-value>
           </context-param>
           <context-param>
           <description>
           </description>
           <param-name>com.sun.faces.numberOfLogicalViews</param-name>
           <param-value>1</param-value>
          </context-param>

          But it's just a workaround.
          From my point of view this is an issue and should reported in JIRA.

          Kind regards.