Beaware!!! with NewRatio while using Concurrent Mark Sweep GC as Garbage Collector


In Sun JDK there were few bugs previously with subject “JDK-6872335 : NewRatio ignored when UseConcMarkSweepGC set”.


Although these bugs are fixed, but IMO the bug still exists for default settings of NewRatio when UseConcMarkSweepGC is used.


We still have the bug where the default NewRatio=2 is not considered along with UseConcMarkSweepGC

Option #1 : Default GC (-XX:+UseParallelGC) : PSYoungGen      total 1835008K = 1.75GB (As it considered the default NewRatio=2)
# /usr/bin/java -server -Xms6144m -Xmx6144m -XX:MaxMetaspaceSize=256m -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -version
-XX:InitialHeapSize=6442450944 -XX:MaxHeapSize=6442450944 -XX:MaxMetaspaceSize=268435456 -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
Heap
PSYoungGen      total 1835008K, used 94372K [0x0000000740000000, 0x00000007c0000000, 0x00000007c0000000)
  eden space 1572864K, 6% used [0x0000000740000000,0x0000000745c29180,0x00000007a0000000)
  from space 262144K, 0% used [0x00000007b0000000,0x00000007b0000000,0x00000007c0000000)
  to   space 262144K, 0% used [0x00000007a0000000,0x00000007a0000000,0x00000007b0000000)
ParOldGen       total 4194304K, used 0K [0x0000000640000000, 0x0000000740000000, 0x0000000740000000)
  object space 4194304K, 0% used [0x0000000640000000,0x0000000640000000,0x0000000740000000)
Metaspace       used 2189K, capacity 4480K, committed 4480K, reserved 1056768K
  class space    used 240K, capacity 384K, committed 384K, reserved 1048576K
[root@vl-aus-sln-pt39 ~]#

Option #2 : UseConcMarkSweepGC only (-XX:+ UseConcMarkSweepGC) : par new generation   total 153344K = 149.75 MB (Here –XX:NewRatio=2 is ignored which is set by default)

# /usr/bin/java -server -Xms6144m -Xmx6144m -XX:MaxMetaspaceSize=256m -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:+UseConcMarkSweepGC -version
-XX:InitialHeapSize=6442450944 -XX:MaxHeapSize=6442450944 -XX:MaxMetaspaceSize=268435456 -XX:MaxNewSize=174485504 -XX:MaxTenuringThreshold=6 -XX:NewSize=174485504 -XX:OldPLABSize=16 -XX:OldSize=348971008 -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseConcMarkSweepGC -XX:+UseParNewGC
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
Heap
par new generation   total 153344K, used 8179K [0x0000000640000000, 0x000000064a660000, 0x000000064a660000)
  eden space 136320K,   6% used [0x0000000640000000, 0x00000006407fcf00, 0x0000000648520000)
  from space 17024K,   0% used [0x0000000648520000, 0x0000000648520000, 0x00000006495c0000)
  to   space 17024K,   0% used [0x00000006495c0000, 0x00000006495c0000, 0x000000064a660000)
concurrent mark-sweep generation total 6121088K, used 0K [0x000000064a660000, 0x00000007c0000000, 0x00000007c0000000)
Metaspace       used 2190K, capacity 4480K, committed 4480K, reserved 1056768K
  class space    used 240K, capacity 384K, committed 384K, reserved 1048576K
[root@vl-aus-sln-pt39 ~]#

Option #3 : UseConcMarkSweepGC along with NewRatio=2 (-XX:+ UseConcMarkSweepGC –XX:NewRatio=2) : par new generation   total 1887488K = 1.8 GB (Here –XX:NewRatio=2 is considered when set explicitly)

# /usr/bin/java -server -Xms6144m -Xmx6144m -XX:MaxMetaspaceSize=256m -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:+UseConcMarkSweepGC -XX:NewRatio=2 -version
-XX:InitialHeapSize=6442450944 -XX:MaxHeapSize=6442450944 -XX:MaxMetaspaceSize=268435456 -XX:MaxTenuringThreshold=6 -XX:NewRatio=2 -XX:OldPLABSize=16 -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseConcMarkSweepGC -XX:+UseParNewGC
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
Heap
par new generation   total 1887488K, used 100669K [0x0000000640000000, 0x00000006c0000000, 0x00000006c0000000)
  eden space 1677824K,   6% used [0x0000000640000000, 0x000000064624f7f0, 0x00000006a6680000)
  from space 209664K,   0% used [0x00000006a6680000, 0x00000006a6680000, 0x00000006b3340000)
  to   space 209664K,   0% used [0x00000006b3340000, 0x00000006b3340000, 0x00000006c0000000)
concurrent mark-sweep generation total 4194304K, used 0K [0x00000006c0000000, 0x00000007c0000000, 0x00000007c0000000)
Metaspace       used 2189K, capacity 4480K, committed 4480K, reserved 1056768K
  class space    used 240K, capacity 384K, committed 384K, reserved 1048576K
[root@vl-aus-sln-pt39 ~]#


Set the New Ratio explicitly if we are using ConcMarkSweepGC  . 

Comments

Post a Comment

Popular posts from this blog

How to use a value between two different threads in Jmeter

Steps to Analyze AWR Report in Oracle

Correlation and checking in Results