ICEfaces
  1. ICEfaces
  2. ICE-3980

Improve ICEfaces state saving memory footprint

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8DR#2
    • Fix Version/s: 1.8RC1, 1.8
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      ICEfaces+ state saving

      Description

      QA has reported that a server with 3 instances of component-showcase runs out of heap space (with 64M configured) with 3 clients running with state saving turned on. This doesn't happen with state saving turned off.

      There are a couple of implementation details that can account for this.

      One, JSF stores state in a two stage map structure with one Map (referred to as the actualMap in JSF source) containing the tree structure and state for a View, one entry per render, default capacity of 15. This is used in JSF's support of the back/forward key with 15 steps allowed before any given capture is released from the map. The other map (the logicalMap) holds the actual Maps for all of the Views supported for a client.

      ICEfaces doesn't really need either of these concepts. ICEfaces doesn't support the back button so essentially all the the duplicate copies in the actual map are wastage. Also the notion of having a Map that holds all the actual Maps for a view is also wastage and an unnecessary limitation on the number of views available to ICEfaces. On a page reload, a fresh entry is created in this outer logical map despite the viewId still being the same.

      Theoretically, it's easy to create a new StateManager implementation that better reflects the needs of ICEfaces. In practice, the StateManager is one of the underlying-technology-aware components available from the RenderKit API. We could:

      - Copy the StateManagerImpl code and create our own RenderKit implementations for ResponseStateManager, RequestStateManager, etc., and fully flesh out the RenderKit API. This is the 'right' thing to do, but has some time and testing risks.

      - Copy the StateManagerImpl code and replace any use of the RenderKit API. I think our implementation of the DOMResponseWriter is something like this, since it's supposed to be another technology aware part of the RenderKit idea. We can probably do this, with more work to be redone later.

      - We can't use the JSF implementations since they're in the RI, and including them in the compilation unit would break Myfaces, and would require rejigging the build environment.

      - Just turn it off. Use the existing state preservation in ICEfaces.

      - Clients who have special restrictions can minimize the impact of the JSF implementation using configuration parameters. You can dial down the number of logical maps if your application supports a restricted number of physical Views. Also, you can configure down the size of the ActualMap to 2 or 3. The client should be aware of a race condition if the size of the actualMap is set to 1. In this case, it's easy to have server push generate a new render (with subsequent entry in the state map) with UI coming from the client referring to the map entry that had generated the view. The key coming from the client will then correspond to no entry in the actual map, and a ViewExpired exception will be thrown. This minimizes the impact of the memory consumption.

      The other part of the problem is the inefficiency in the state saving itself. We create Object[] to accomodate the largest number of Effects, when most of the values are null. The API doesn't specify what the components are to put in the Object[], so it's possible to easily create a Map containing Effects objects only if they exist, keyed by a simple string identifying which is which. The amount of memory savings in this case is still to be determined.



        Activity

        Repository Revision Date User Message
        ICEsoft Public SVN Repository #18285 Tue Feb 03 15:19:34 MST 2009 greg.dick ICE-3980 refactoring
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/application/state/Util.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #18284 Tue Feb 03 14:51:58 MST 2009 greg.dick ICE-3980 Clean up code
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/application/SingleCopyStateManagerImpl.java
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/application/ViewRootStateManagerImpl.java
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/application/state/Util.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #18252 Thu Jan 29 11:32:37 MST 2009 greg.dick ICE-3980 Moved StateSaving support flags to ImplementationUtil
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/util/CoreUtils.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #18251 Thu Jan 29 11:32:02 MST 2009 greg.dick ICE-3980 Restored conditional State Saving code for JSF1.1
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/xmlhttp/PersistentFacesState.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #18250 Thu Jan 29 11:31:42 MST 2009 greg.dick ICE-3980 Restored conditional State Saving code for JSF1.1
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/renderkit/dom_html_basic/FormRenderer.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #18249 Thu Jan 29 11:31:04 MST 2009 greg.dick ICE-3980 Restored conditional State Saving code for JSF1.1
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/BridgeFacesContext.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #18248 Thu Jan 29 11:30:21 MST 2009 greg.dick ICE-3980 Removed client side state saving warning
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/async/render/RenderManager.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #18247 Thu Jan 29 11:29:34 MST 2009 greg.dick ICE-3980 Restored state saving conditional code to support JSF1.1
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/application/D2DViewHandler.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #18246 Thu Jan 29 11:28:29 MST 2009 greg.dick ICE-3980 Moved JSF state saving flag support to this class as a better fit
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/parser/ImplementationUtil.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #18234 Tue Jan 27 11:17:01 MST 2009 greg.dick ICE-3980 If JSF 1.1 is detected, use our state saving.
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/application/D2DViewHandler.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #18221 Fri Jan 23 14:58:56 MST 2009 greg.dick ICE-3980 removed references to obsolete doJSFStateManagement flags
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/async/render/RenderManager.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #18220 Fri Jan 23 14:58:10 MST 2009 greg.dick ICE-3980 removed references to obsolete doJSFStateManagement flags
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/renderkit/dom_html_basic/FormRenderer.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #18219 Fri Jan 23 14:56:38 MST 2009 greg.dick ICE-3980 removed references to obsolete doJSFStateManagement flags
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/xmlhttp/PersistentFacesState.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #18218 Fri Jan 23 14:55:14 MST 2009 greg.dick ICE-3980 removed references to obsolete doJSFStateManagement flags
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/BridgeFacesContext.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #18217 Fri Jan 23 14:54:55 MST 2009 greg.dick ICE-3980 remove stateSaving entries from session Map on View disposal
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/View.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #18216 Fri Jan 23 14:50:38 MST 2009 greg.dick ICE-3980 added two StateManager implementations and removed use of obsolete parameters
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/application/SettableLocaleViewRoot.java
        Commit graph ADD /icefaces/trunk/icefaces/core/src/com/icesoft/faces/application/strategy
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/application/D2DViewHandler.java
        Commit graph ADD /icefaces/trunk/icefaces/core/src/com/icesoft/faces/application/SingleCopyStateManagerImpl.java
        Commit graph ADD /icefaces/trunk/icefaces/core/src/com/icesoft/faces/application/ViewRootStateManagerImpl.java
        Commit graph ADD /icefaces/trunk/icefaces/core/src/com/icesoft/faces/application/state
        Commit graph ADD /icefaces/trunk/icefaces/core/src/com/icesoft/faces/application/state/Util.java

          People

          • Assignee:
            Unassigned
            Reporter:
            Greg Dick
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: