Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
donino pienni
Excessive memory usage with Liferay stripFilter
28. September 2012 03:52
Antwort

donino pienni

Rang: Junior Member

Nachrichten: 82

Eintrittsdatum: 2. Juli 2011

Neue Beiträge

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
28. September 2012 04:51
Antwort

Manish Kumar Jaiswal

Rang: Regular Member

Nachrichten: 133

Eintrittsdatum: 25. November 2008

Neue Beiträge

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
28. September 2012 11:53
Antwort

donino pienni

Rang: Junior Member

Nachrichten: 82

Eintrittsdatum: 2. Juli 2011

Neue Beiträge

Thank you for your feedback with this issue Manish
regards
Sampsa Sohlman
RE: Excessive memory usage with Liferay stripFilter
28. September 2012 14:50
Antwort

Sampsa Sohlman

LIFERAY STAFF

Rang: Regular Member

Nachrichten: 225

Eintrittsdatum: 27. September 2007

Neue Beiträge

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
29. September 2012 02:56
Antwort

donino pienni

Rang: Junior Member

Nachrichten: 82

Eintrittsdatum: 2. Juli 2011

Neue Beiträge

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
7. November 2012 06:16
Antwort

Manish Kumar Jaiswal

Rang: Regular Member

Nachrichten: 133

Eintrittsdatum: 25. November 2008

Neue Beiträge

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