Why doesn't the garbage collector do more aggressive garbage collection before a one-time bunch of free%?

These are my Java Hotspot 1.6 JVM heap settings in WebLogic 11g:

-Xms10g -Xmx10g -XX:MaxPermSize=256m -XX:+UseParNewGC -XX:ParallelGCThreads=2 -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:ConcGCThreads=2 

What I see on the JVM chart is heap free% for 24 hours, mostly without a heap% decreases at a low speed until we reach 9% (takes about 24 hours). Then the system works, which looks like full gc, and returns to 97%.

Is there any tweak I have to add / change that tells the JVM to make this full GC sooner than when we get below 10% of the heap? for example, some relationship?

This does not cause the problems that he is waiting for until we get to 9% for free, but it makes monitoring / notification difficult. Ideally, we want to stay higher than saying 30% for free at any time, so that if we go down to these numbers, we know that there is some kind of problem, for example. memory leak.

+4
source share
2 answers

Found the answer using a combination of other stackoverflow articles.

 -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=N 

where N roughly corresponds to the percent occupied, the full GC is called. The default is ~ 92, so I see the full GC at 9% for free. Switching to 65 for my use. Full GC gets ~ 35% for free.

+2
source

How about deleting: -Xms10g and then tracking the total heap size? This will also cause gc to work more often.

If your application really only uses 300 MB of RAM (3%), then it seems extremely important to start with a 10 GB allocation.

0
source

Source: https://habr.com/ru/post/1439196/


All Articles