Reputation: 11
Some question about HotSpot JVM Garbage Collection.
We have a java process running and the opts are:
-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps
-Xloggc:/mnt/dfs/0/hdfs/logs/namenode.gc.log -XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=1 -XX:GCLogFileSize=512M -XX:+UseParNewGC -XX:+UseConcMarkSweepGC
-XX:+CMSParallelRemarkEnabled -XX:-DisableExplicitGC -XX:+UseCMSCompactAtFullCollection
-XX:+CMSClassUnloadingEnabled -XX:+UseCMSInitiatingOccupancyOnly -server -Xmx92160m -Xms92160m
-Xss256k -XX:MaxPermSize=256m -XX:MaxTenuringThreshold=15 -XX:+PrintTenuringDistribution
as you see, the max heap size is about 90G.
According to this article, NewRatio=2 and SurvivorRatio=8 in default. So the Eden size should be 90G*1/3*8/10=24G, and survivor size should be 90G*1/3*1/10=3G.
But in fact, when I use jstat:
sudo jstat -gcnew 37082
S0C S1C S0U S1U TT MTT DSS EC EU YGC YGCT
48960.0 48960.0 0.0 5981.3 15 15 24480.0 391936.0 82332.7 13351 1379.450
Eden size is only about 390MB, and survivor size only 48MB. This causes a lot of young gc.
Can anyone tell me the reason why Eden size is so small?
Upvotes: 1
Views: 1342
Reputation: 1844
From here this this Oracle docs!
I could understand that When the heap grows or shrinks, the JVM must recalculate the old and new generation sizes to maintain a predefined NewRatio.,
The NewSize and MaxNewSize parameters control the new generation’s minimum and maximum size.
The size of the young generation relative to the old generation is controlled by NewRatio. For example, setting -XX:NewRatio=3 means that the ratio between the old and young generation is 1:3, the combined size of eden and the survivor spaces will be fourth of the heap.
To size the Java heap:
Make plenty of memory available to the young generation. The default is calculated from NewRatio and the -Xmx setting.
Can you try setting a value for NewSize and see if that makes a difference?
Upvotes: 2
Reputation: 8958
Eden size is only as large as it needs to be. The NewSize will be larger if you generate more short lived garbage.
Upvotes: 2