掲示板

[Resolved] Liferay 6.2 ga6 Out of Memory caused by Ehcache?

7年前 に Riccardo Saponi によって更新されました。

[Resolved] Liferay 6.2 ga6 Out of Memory caused by Ehcache?

New Member 投稿: 15 参加年月日: 15/11/18 最新の投稿
Hi

I ask a little help for a very strange problem.

I have a site made with the bundle Liferay 6.2 ga6, Windows Server 2012, Sql Server 2008. Tomcat starts with a 2.5 GB RAM. There is also an Apache Proxy 2.4.23 with Https on a Centos 7.

The site went online three months ago, and since 3th september every performance was good (25k visitors by day, 160k pages seen by day, ttfb very low)

From few day i have noticed some slowdowns of the duration about 20 seconds.
During these slowdowns i have seen that the process of Tomcat on the server occupies 90% of the CPU.

However, during the analysys i HAD THE PROBLEM. An Out of Memory of the JVM.

Analysing the dump of JVM i have noticed a very strange thing.

The Ehcache of Liferay occupies 600 M of the JVM and almost all the objects are very similar.
Example: there are hundreds entries of a javascript file, where the values of the cache are always the same and the keys (the ehcache stores in maps) are equals except for a number.
So i have analysed the source code and this number seems to be the hash of the user-agent.
The question is: why liferay uses the cache with the user agent?
The number of hits in the cache is always 0 and the value of lastAccessTime is always the value of firstAccessTime. So, the cache is useless and abnormous...

I attach some images of the analysis.


Does anyone has ever experienced this issue.

I have found also this issue on jira:

https://issues.liferay.com/browse/LPS-60638
thumbnail
7年前 に Neil Jin によって更新されました。

RE: Liferay 6.2 ga6 Out of Memory caused by Ehcache?

New Member 投稿: 17 参加年月日: 11/03/24 最新の投稿
It looks some thing in you theme or jsp that generates dynamic js code, for the same page the actual js on the page are different by chances.
7年前 に Riccardo Saponi によって更新されました。

RE: Liferay 6.2 ga6 Out of Memory caused by Ehcache?

New Member 投稿: 15 参加年月日: 15/11/18 最新の投稿
Hi Neil,

the point is that we haven't nothing that generates dynamic js. Only standard library as jQuery.

But in cache we have thousands entries of jQery-ui.js, that is always the same file. This file is in the theme. So I would expect to find the file only once.
Why put it in the cache with the user-agent? Is useless.
But, according to the source code of CacheFilter, this is "normal" (lines 140 -146).

Why Liferay uses the user agent in the cache. It is really correct?

If the user agent is not present,the cache would weight 500M less..
7年前 に Riccardo Saponi によって更新されました。

RE: Liferay 6.2 ga6 Out of Memory caused by Ehcache?

New Member 投稿: 15 参加年月日: 15/11/18 最新の投稿
We solved the problem by changing the CacheFilter class, removing the part of User-Agent. 500M Ram memory less.
Still I do not understand the logic that liferay uses with cache and user-agent.
Thank you all
thumbnail
7年前 に Juan Gonzalez によって更新されました。

RE: Liferay 6.2 ga6 Out of Memory caused by Ehcache?

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
Riccardo Saponi:
We solved the problem by changing the CacheFilter class, removing the part of User-Agent. 500M Ram memory less.
Still I do not understand the logic that liferay uses with cache and user-agent.
Thank you all


Hi Ricardo.

Thanks for your feedback. I've been talking to other engineering colleagues and, if we don't find any usage that makes sense for user-agent, we are going to remove it from Cache key. Seems user-agent was needed (this part of code was implemented in 2009) to differentiate between IE and other browsers, but now it isn't needed anymore.

Stay tuned, hope to create an LPS very soon.

Thanks again.
thumbnail
7年前 に Juan Gonzalez によって更新されました。

RE: Liferay 6.2 ga6 Out of Memory caused by Ehcache?

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
Riccardo Saponi:
We solved the problem by changing the CacheFilter class, removing the part of User-Agent. 500M Ram memory less.
Still I do not understand the logic that liferay uses with cache and user-agent.
Thank you all


Hi Riccardo.

FYI, this issue should be fixed under this ticket (you can "watch" the ticket to get notifications): https://issues.liferay.com/browse/LPS-68125

I want to say a big THANK YOU for making this kind of research on the product, and say out loud so we can improve Liferay.

Thanks!
7年前 に Riccardo Saponi によって更新されました。

RE: Liferay 6.2 ga6 Out of Memory caused by Ehcache?

New Member 投稿: 15 参加年月日: 15/11/18 最新の投稿
Great job guys!
We are very proud to help you improve Liferay!

We allowed ourselves to publish this news on our social channels. emoticon

Our next steps will be the Italy Liferay Symposium and a deep immersion in Liferay 7!emoticon

Bye!
thumbnail
7年前 に Juan Gonzalez によって更新されました。

RE: Liferay 6.2 ga6 Out of Memory caused by Ehcache?

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
Hi Riccardo.

We are still discussing about the best way for improving this while keeping features that are using user-agent header for different things.

Do you remember which user-agent strings were in those 500MB of cache? Were they actual allowed user-agents or were like random ones?

Thanks.