Combination View Flat View Tree View
Threads [ Previous | Next ]
donino pienni
Excessive memory usage with Liferay stripFilter
September 28, 2012 3:52 AM
Answer

donino pienni

Rank: Junior Member

Posts: 80

Join Date: July 2, 2011

Recent Posts

Hi,

I use Liferay 6.1.1.GA2 with tomcat 7

I encounter memory issues in my context, the main is due to JRuby and is described in a separate thread. Here is another one with the Liferay Class StripFilter. A heap dump processed in a memory profiler shows it retains more than 60 Mb memory, and keeps growing.



I disabled this StripFilter in portal-ext.properties and it fixed this issue. Please could anyone tell me if this memory usage seems normal for the StripFilter, or if i should log a JIRA issue?

Thanks
Manish Kumar Jaiswal
RE: Excessive memory usage with Liferay stripFilter
September 28, 2012 4:51 AM
Answer

Manish Kumar Jaiswal

Rank: Regular Member

Posts: 133

Join Date: November 25, 2008

Recent Posts

I too faced some issues with stripfilter . It was causing constant rise of memory usage . I think there is something wrong in stripfilter.

Regards
Manish
donino pienni
RE: Excessive memory usage with Liferay stripFilter
September 28, 2012 11:53 AM
Answer

donino pienni

Rank: Junior Member

Posts: 80

Join Date: July 2, 2011

Recent Posts

Thank you for your feedback with this issue Manish
regards
Sampsa Sohlman
RE: Excessive memory usage with Liferay stripFilter
September 28, 2012 2:50 PM
Answer

Sampsa Sohlman

LIFERAY STAFF

Rank: Regular Member

Posts: 218

Join Date: September 27, 2007

Recent Posts

Hi donino,

donino donino:
Please could anyone tell me if this memory usage seems normal for the StripFilter, or if i should log a JIRA issue?


Just by quickly looking the code of StripFilter it contains cache and that probably explain the memory usage.

That cache is controlled by portal-ext.properties.

1    #
2    # The strip filter will attempt to cache inline minified CSS and JavaScript
3    # content. Set this property configure the maximum pieces of cached content.
4    # Set this property to 0 to disable caching of inline minified content.
5    #
6    minifier.inline.content.cache.size=10000


So if you adjust that number do you see changes on your tests?
donino pienni
RE: Excessive memory usage with Liferay stripFilter
September 29, 2012 2:56 AM
Answer

donino pienni

Rank: Junior Member

Posts: 80

Join Date: July 2, 2011

Recent Posts

Thank you for your response Sampsa.

I did not realize the StripFilter was caching inline javascript fragments. By looking at the code i now understand why some projects encounter this issue. I think it may be a "dangerous" feature because inline javascript is often dynamic, for example developpers and some frameworks may want to send resource & action URL to the client-side code. Also for WSRP compatility, some projects have to include dynamic javascript content directly in the html markup.

In my context i send a pretty large JSON object (7-8k) as a javascript parameter. This object is different for each portlet session, and may change within a session depending on user actions. I see in the StripFilter code that a javascript fragment is used both as key and as content for each cache entry: that means i potentially loose 15kb memory on a page refresh, at least 50k per user session. It probably explains everything! To fix it i will wrap this JSON object in an ajax call. Pending this, setting the cache parameter to 0 should do the job:

1minifier.inline.content.cache.size=0
(in my opinion it could be the default value)

Thanks!
Manish Kumar Jaiswal
RE: Excessive memory usage with Liferay stripFilter
November 7, 2012 6:16 AM
Answer

Manish Kumar Jaiswal

Rank: Regular Member

Posts: 133

Join Date: November 25, 2008

Recent Posts

yes you are correct also we can also skip some javascript or CSS contents by referring in these properties


minifier.inline.content.cache.skip.css=
minifier.inline.content.cache.skip.javascript=getSessionId,encryptedUserId

Regards
Manish