構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
donino pienni
Excessive memory usage with Liferay stripFilter
2012/09/28 3:52
答え

donino pienni

ランク: Junior Member

投稿: 80

参加年月日: 2011/07/02

最近の投稿

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
2012/09/28 4:51
答え

Manish Kumar Jaiswal

ランク: Regular Member

投稿: 133

参加年月日: 2008/11/25

最近の投稿

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
2012/09/28 11:53
答え

donino pienni

ランク: Junior Member

投稿: 80

参加年月日: 2011/07/02

最近の投稿

Thank you for your feedback with this issue Manish
regards
Sampsa Sohlman
RE: Excessive memory usage with Liferay stripFilter
2012/09/28 14:50
答え

Sampsa Sohlman

LIFERAY STAFF

ランク: Regular Member

投稿: 217

参加年月日: 2007/09/27

最近の投稿

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
2012/09/29 2:56
答え

donino pienni

ランク: Junior Member

投稿: 80

参加年月日: 2011/07/02

最近の投稿

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
2012/11/07 6:16
答え

Manish Kumar Jaiswal

ランク: Regular Member

投稿: 133

参加年月日: 2008/11/25

最近の投稿

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