AJAX4JSF/AjaxStateHolder | Session Memory Leak
I am working on the performance tuning of an enterprise web application with about 300 simultaneous user. I have noticed from the GC log that the application heap is always growing and objects are always accumulating even after Full GC. I've acquired a production heap dump and I was surprised that the session objects are occupying more than 90% of the heap size! That's all because of the AjaxStateHolderObject.
The application is runing on JSF 1.X and RichFaces 3.3.0.
Before starting this discussion I tried the following:
- Added the following code to web.xml
<context-param>
<param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
<param-value>1</param-value>
</context-param>
- Added the following code to web.xml
<context-param>
<param-name>com.sun.faces.numberOfViewsInSession</param-name>
<param-value>1</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.numberOfLogicalViews</param-name>
<param-value>1</param-value>
</context-param>
- Upgraded from RichFaces 3.3.0 to 3.3.3
All the above attempts failed to solve the memory leakage problem.
Updates
*A single user sessio开发者_开发问答n can consume up to 25 MB because of the AjaxStateHolder huge size.
*Most of the managed beans of the application are request scope and there is no unused referenced objects in session, the only problem concerning memory is the ajaxStateHolder.
Thanks in advance for any guidance.
Any kind of help will be appreciated because I didn't find anything concerning this issue on the web.
It seems that you have run into the JSF/a4j session memory leak defect. See link below for more description on the matter:
https://issues.jboss.org/browse/RF-3878
It appears as if the view state is being cached in session and not cleaned up. It is a bug with a4j and cannot be fixed, just worked around. The configurations you added to web.xml
are the only suggested workaround but apparently this does not help too much.
It seems a4j is not very scalable so perhaps the best long term solution is to slowly refactor the a4j components out of the application and replace them with a different component framework? Sorry I could not be more of a help and I wish you luck.
精彩评论