Fórum

High memory usage

thumbnail
omid ahmadi, modificado 9 Anos atrás.

High memory usage

Junior Member Postagens: 37 Data de Entrada: 27/08/13 Postagens Recentes
hellow
I am using liferay CE GA2
my problem is on high memory usage even when no visitor and no request on my portal server.
this issue reduce speed and makes a serious problem.

here is some snapshot from server management page in control panel and also the out put of "top" command on my centos 6.5 64 bit virtual machine

virtual machine feature:
8 G RAM
2 core of cpu
and 11 G for root partition
thumbnail
Olaf Kock, modificado 9 Anos atrás.

RE: High memory usage

Liferay Legend Postagens: 6403 Data de Entrada: 23/09/08 Postagens Recentes
Issue number 1: Do not run as root. Fix this first - it's really important.

For the actual memory consumption: Java typically holds on to the memory it once allocates. Check if you had high traffic earlier. Also, check what kind of plugins you've deployed. You might want to do a heapdump analysis or connect to the server through JMX (see jconsole) to identify if you have high cache utilization.

The key is to figure out where/when the memory has been allocated or what it's used for. Unfortunately your screenshots don't help with this. If you keep an eye on memory consumption in jconsole, you might find out that you have a memory leak somewhere. After all, your server is obviously running for a while already (judging from your top output)
thumbnail
omid ahmadi, modificado 9 Anos atrás.

RE: High memory usage

Junior Member Postagens: 37 Data de Entrada: 27/08/13 Postagens Recentes
Hi friends.
Tank alot Olaf Kock .
I am trying to connent to portal server by jconsole to monitor memory usage for liferay process.

But more than 90% of memory is used for buffers/cache , i got it by "free -m" command and attached screen shut to this post.
Dose "Clear content cached by this VM" bottom in Server Administration in control panel help me to free up more memory??
thumbnail
Suresh Nimmakayala, modificado 9 Anos atrás.

RE: High memory usage

Liferay Master Postagens: 690 Data de Entrada: 18/08/04 Postagens Recentes
no it doesn't clear when you click on "Clear content cached by this VM"
thumbnail
Olaf Kock, modificado 9 Anos atrás.

RE: High memory usage

Liferay Legend Postagens: 6403 Data de Entrada: 23/09/08 Postagens Recentes
As Suresh says, it won't help: You're monitoring the OS side of memory. Once any Java process has allocated memory from the OS, it keeps it. AFAIK there's no case where JVM memory is actually released back to the OS.

You'll need to tune your Liferay to use less memory - e.g. the -Xmx parameter seems to be around 4G, so that you allow Java to allocate 4G. If you just set this to 2G, Liferay can't take 4G - which might solve your problem already. Now if you've set the maximum memory this high because Liferay required more memory (e.g. it ran out of memory before) you'll have to check what kind of memory this is - or what load you get. An out-of-the-box Liferay installation won't require 4G unless it's under high load. Your custom plugins however might. Based on the data that you give, there's no way to judge for anyone on this forum.

You might want to check a profiler, or examine the memory usage pattern in jconsole. If the median consumed memory only goes up, but never down (apart from some garbage collection times, but it never gets lower than it was at the time of the previous garbage collection) this points to a memory leak that you'll have to find - most likely in your custom code.
thumbnail
omid ahmadi, modificado 9 Anos atrás.

RE: High memory usage

Junior Member Postagens: 37 Data de Entrada: 27/08/13 Postagens Recentes
Hi friends.
Tanks alot Olaf Kock ,
about one years ago when i start liferay i had a serious problem with lake of heap stack memory and post it in this post , java.lang.StackOverflowError at java.util.regex.Pattern$ i increased both of Xmx - Xms and Xss size ,
and also i think increasing Xmx and Xms result in increasing speed of liferay

Totally i have had a general problem about "How determine optimom size for Xms and Xmx parameter and other parameter in setenv.sh file"!!??
This is my setenv.sh file , of course i decreased Xmx-Xms to 4G(i have 8G of ram on my machine and just one instance of liferay and one Mysql) and increased Xss to 6m

CATALINA_OPTS="$CATALINA_OPTS -Dfile.encoding=UTF8 -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT -XX:NewSize=700m -XX:MaxNewSize=700m -Xms6144m
-Xmx6144m -Xss4m -XX:MaxPermSize=512m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC
-XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=20
-XX:ParallelGCThreads=8  -Dexternal-properties=portal-developer.properties -Djava.awt.headless=true -server -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=7091 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=localhost "




Another problem is that even after i shutdown liferay , 4G of buffere/catche memory dont free up !!??
There is an command that i cant manually free up this memory??
Tanks alot for your helpe ....
i attanched free -m output command here :
thumbnail
Olaf Kock, modificado 9 Anos atrás.

RE: High memory usage

Liferay Legend Postagens: 6403 Data de Entrada: 23/09/08 Postagens Recentes
You're mixing up quite a lot of things here. Xmx and Xms have no effect on StackoverflowErrors - Xss has.

As of your options and how to find the optimum: You'll have to run Liferay and monitor it. If it runs into GC very frequently, adding a bit more memory will help. If it rarely gets to GC, you might be able to go with less - provided that you measured under full load.

One of the very effective ways to accellerate Liferay is to not have portal-developer.properties in that list - this will prohibit CSS&JS minification, CSS sprites etc., resulting in a huge number of individual requests to the portal for every single page.

I'm not sure about the buffers - start other (large) programs, restart Liferay - it might be that this is just temprarily used by the OS and made available when necessary.

Keep an eye on virtual memory use: If you want highest performance, it might even be advisable to completely disable swap space on disk, as it will only slow you down severely.
thumbnail
Suresh Nimmakayala, modificado 9 Anos atrás.

RE: High memory usage

Liferay Master Postagens: 690 Data de Entrada: 18/08/04 Postagens Recentes
as olaf said os will release when application needs,check also developer properties...

try a command killall -9 java command just in case we can check it is java in that buffers/cache used

just check mysql restart and see buffers/cache values

one more thing you said you have 2 cores of cpu , so i guess -XX: ParallelGCThreads=4 is right option
Kolcza Gyozo, modificado 9 Anos atrás.

RE: High memory usage

New Member Postagens: 7 Data de Entrada: 10/01/11 Postagens Recentes
I have the same problem. See here what is the problem : https://www.liferay.com/community/forums/-/message_boards/message/47537214?_19_redirect=http%253A%252F%252Fwww.liferay.com%252Fcommunity%252Fforums%252F-%252Fmessage_boards%252Fsearch%253F_19_keywords%253Dmemory%252Bleak%2526_19_searchCategoryId%253D0%2526_19_breadcrumbsCategoryId%253D0%2526_19_redirect%253Dhttp%25253A%25252F%25252Fwww.liferay.com%25252Fcommunity%25252Fforums%25253Fp_p_id%25253D19%252526p_p_lifecycle%25253D0%252526p_p_state%25253Dnormal%252526p_p_mode%25253Dview%252526p_p_col_id%25253Dcolumn-1%252526p_p_col_count%25253D1%2526_19_formDate%253D1421092514248

But the bad news is I do not know how can I resolve this issue, It's a liferay bug.

Best Regards,
Gyozo