Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
donino pienni
Excessive memory usage with Liferay stripFilter
28 de septiembre de 2012 3:52
Respuesta

donino pienni

Ranking: Junior Member

Mensajes: 80

Fecha de incorporación: 2 de julio de 2011

Mensajes recientes

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 de septiembre de 2012 4:51
Respuesta

Manish Kumar Jaiswal

Ranking: Regular Member

Mensajes: 133

Fecha de incorporación: 25 de noviembre de 2008

Mensajes recientes

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 de septiembre de 2012 11:53
Respuesta

donino pienni

Ranking: Junior Member

Mensajes: 80

Fecha de incorporación: 2 de julio de 2011

Mensajes recientes

Thank you for your feedback with this issue Manish
regards
Sampsa Sohlman
RE: Excessive memory usage with Liferay stripFilter
28 de septiembre de 2012 14:50
Respuesta

Sampsa Sohlman

LIFERAY STAFF

Ranking: Regular Member

Mensajes: 217

Fecha de incorporación: 27 de septiembre de 2007

Mensajes recientes

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 de septiembre de 2012 2:56
Respuesta

donino pienni

Ranking: Junior Member

Mensajes: 80

Fecha de incorporación: 2 de julio de 2011

Mensajes recientes

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 de noviembre de 2012 6:16
Respuesta

Manish Kumar Jaiswal

Ranking: Regular Member

Mensajes: 133

Fecha de incorporación: 25 de noviembre de 2008

Mensajes recientes

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