-XX:SurvivorRatio |
---|
-XXSurvivorRatio = eden :from = eden :to |
默认-XXSurvivorRatio=8 ,即 Eden : s0 : s1 = 8 : 1 : 1,Eden占了年轻代的8/10,不建议修改 |
case1: -XX:NewRatio=4 -XX:SurvivorRatio=8
启动参数 |
---|
-Xmx200m -Xms100m -XX:NewRatio=4 -XX:SurvivorRatio=8 -XX:+PrintCommandLineFlags |
启动日志 |
-XX:ConcGCThreads=3 -XX:G1ConcRefinementThreads=13 -XX:GCDrainStackTargetSize=64 -XX:InitialHeapSize=104857600 -XX:MarkStackSize=4194304 -XX:MaxHeapSize=209715200 -XX:MinHeapSize=104857600 -XX:NewRatio=4 -XX:+PrintCommandLineFlags -XX:ReservedCodeCacheSize=251658240 -XX:+SegmentedCodeCache -XX:SurvivorRatio=8 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseG1GC -XX:-UseLargePagesIndividualAllocation |
JPS+jhsdb jmap --heap --pid 进程ID |
Heap Configuration: MinHeapFreeRatio = 40 MaxHeapFreeRatio = 70 MaxHeapSize = 209715200 (200.0MB) NewSize = 1363144 (1.2999954223632812MB) MaxNewSize = 41943040 (40.0MB) OldSize = 5452592 (5.1999969482421875MB) NewRatio = 4 SurvivorRatio = 8 MetaspaceSize = 22020096 (21.0MB) CompressedClassSpaceSize = 1073741824 (1024.0MB) MaxMetaspaceSize = 17592186044415 MB G1HeapRegionSize = 1048576 (1.0MB) |
case 2 : -Xmn80m -XX:SurvivorRatio=8
启动参数 |
---|
-Xmx200m -Xms100m -Xmn80m -XX:SurvivorRatio=8 -XX:+PrintCommandLineFlags |
启动日志 |
-XX:ConcGCThreads=3 -XX:G1ConcRefinementThreads=13 -XX:GCDrainStackTargetSize=64 -XX:InitialHeapSize=104857600 -XX:MarkStackSize=4194304 -XX:MaxHeapSize=209715200 -XX:MaxNewSize=83886080 -XX:MinHeapSize=104857600 -XX:NewSize=83886080 -XX:+PrintCommandLineFlags -XX:ReservedCodeCacheSize=251658240 -XX:+SegmentedCodeCache -XX:SurvivorRatio=8 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseG1GC -XX:-UseLargePagesIndividualAllocation |
JPS+jhsdb jmap --heap --pid 进程ID |
Heap Configuration: MinHeapFreeRatio = 40 MaxHeapFreeRatio = 70 MaxHeapSize = 209715200 (200.0MB) NewSize = 83886080 (80.0MB) MaxNewSize = 83886080 (80.0MB) OldSize = 5452592 (5.1999969482421875MB) NewRatio = 2 SurvivorRatio = 8 MetaspaceSize = 22020096 (21.0MB) CompressedClassSpaceSize = 1073741824 (1024.0MB) MaxMetaspaceSize = 17592186044415 MB G1HeapRegionSize = 1048576 (1.0MB) |
(好早以前验证截图,删除可惜保留参考)
case1: -XX:NewRatio=4 -XX:SurvivorRatio=8
//JVM 启动参数
-Xmx40m -Xms20m -XX:NewRatio=4 -XX:SurvivorRatio=8 -XX:+PrintGCDetails -XX:+PrintCommandLineFlags
//运行结果:
-XX:InitialHeapSize=20971520 -XX:MaxHeapSize=41943040 -XX:NewRatio=4 -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:SurvivorRatio=8 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:-UseLargePagesIndividualAllocation -XX:+UseParallelGC
case 2 : -Xmn80m -XX:SurvivorRatio=8
//JVM 启动参数
-Xmx400m -Xms200m -Xmn100m -XX:SurvivorRatio=8 -XX:+PrintGCDetails -XX:+PrintCommandLineFlags
//运行结果:
-XX:InitialHeapSize=20,971,520 -XX:MaxHeapSize=41,943,040
-XX:MaxNewSize=104,857,600 -XX:NewSize=104,857,600 -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:SurvivorRatio=8 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:-UseLargePagesIndividualAllocation -XX:+UseParallelGC
case 3 : -Xmn + -XX:SurvivorRatio & -Xmn > -Xmx
//JVM 启动参数
-Xmx40m -Xms20m -Xmn100m -XX:SurvivorRatio=8 -XX:+PrintGCDetails -XX:+PrintCommandLineFlags
//运行结果:
-XX:InitialHeapSize=20,971,520 -XX:MaxHeapSize=41,943,040
-XX:MaxNewSize=104,857,600 -XX:NewSize=104,857,600 -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:SurvivorRatio=8 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:-UseLargePagesIndividualAllocation -XX:+UseParallelGC