JVM-3-JVM调优

2019-09-30  本文已影响0人  宠辱不惊的咸鱼

问题

堆大小设置

-Xms3550M -Xmx3550M -Xmn2G -Xss128K 
-XX:NewRatio=4 -XX:SurvivorRatio=8 -XX:PermSize=16M -XX:MaxPermSize=16M -XX:MaxTenuringThreshold=0

收集器选择

-XX:+UseParallelGC -XX:+UseParallelOldGC -XX:ParallelGCThreads=20
-XX:MaxGCPauseMillis=100 -XX:GCTimeRatio=n -XX:+UseAdaptiveSizePolicy
-XX:ParallelGCThreads=20 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC
-XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=5 -XX:+CMSIncrementalMode

G1

-XX:+UseG1GC # G1

辅助信息

-XX:+PrintGC
[GC 118250K->113543K(130112K), 0.0094143 secs]
[Full GC 121376K->10414K(130112K), 0.0650971 secs]
-XX:+PrintGCDetails
[GC (System.gc()) [PSYoungGen: 3722K->904K(35840K)] 3722K->912K(117760K), 0.0033150 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 904K->0K(35840K)] [ParOldGen: 8K->860K(81920K)] 912K->860K(117760K), [Metaspace: 3476K->3476K(1056768K)], 0.0091323 secs] [Times: user=0.00 sys=0.00, real=0.01 secs] 
Heap
 PSYoungGen      total 35840K, used 307K [0x00000000d8600000, 0x00000000dae00000, 0x0000000100000000)
  eden space 30720K, 1% used [0x00000000d8600000,0x00000000d864ce40,0x00000000da400000)
  from space 5120K, 0% used [0x00000000da400000,0x00000000da400000,0x00000000da900000)
  to   space 5120K, 0% used [0x00000000da900000,0x00000000da900000,0x00000000dae00000)
 ParOldGen       total 81920K, used 860K [0x0000000089200000, 0x000000008e200000, 0x00000000d8600000)
  object space 81920K, 1% used [0x0000000089200000,0x00000000892d73e8,0x000000008e200000)
 Metaspace       used 3483K, capacity 4496K, committed 4864K, reserved 1056768K
  class space    used 381K, capacity 388K, committed 512K, reserved 1048576K
-XX:+PrintGCTimeStamps

-输出

11.851: [GC 98328K->93620K(130112K), 0.0082960 secs]
-XX:+PrintGCApplicationConcurrentTime # 每次垃圾回收前,程序未中断的执行时间
Application time: 0.5291524 seconds
-XX:+PrintGCApplicationStoppedTime # 垃圾回收期间程序暂停的时间
Total time for which application threads were stopped: 0.0468229 seconds
-XX:+PrintHeapAtGC # 打印GC前后的详细堆栈信息
{Heap before GC invocations=1 (full 0):
 PSYoungGen      total 35840K, used 3722K [0x00000000d8600000, 0x00000000dae00000, 0x0000000100000000)
  eden space 30720K, 12% used [0x00000000d8600000,0x00000000d89a2908,0x00000000da400000)
  from space 5120K, 0% used [0x00000000da900000,0x00000000da900000,0x00000000dae00000)
  to   space 5120K, 0% used [0x00000000da400000,0x00000000da400000,0x00000000da900000)
 ParOldGen       total 81920K, used 0K [0x0000000089200000, 0x000000008e200000, 0x00000000d8600000)
  object space 81920K, 0% used [0x0000000089200000,0x0000000089200000,0x000000008e200000)
 Metaspace       used 3477K, capacity 4496K, committed 4864K, reserved 1056768K
  class space    used 380K, capacity 388K, committed 512K, reserved 1048576K
Heap after GC invocations=1 (full 0):
 PSYoungGen      total 35840K, used 936K [0x00000000d8600000, 0x00000000dae00000, 0x0000000100000000)
  eden space 30720K, 0% used [0x00000000d8600000,0x00000000d8600000,0x00000000da400000)
  from space 5120K, 18% used [0x00000000da400000,0x00000000da4ea020,0x00000000da900000)
  to   space 5120K, 0% used [0x00000000da900000,0x00000000da900000,0x00000000dae00000)
 ParOldGen       total 81920K, used 8K [0x0000000089200000, 0x000000008e200000, 0x00000000d8600000)
  object space 81920K, 0% used [0x0000000089200000,0x0000000089202000,0x000000008e200000)
 Metaspace       used 3477K, capacity 4496K, committed 4864K, reserved 1056768K
  class space    used 380K, capacity 388K, committed 512K, reserved 1048576K
}
{Heap before GC invocations=2 (full 1):
 PSYoungGen      total 35840K, used 936K [0x00000000d8600000, 0x00000000dae00000, 0x0000000100000000)
  eden space 30720K, 0% used [0x00000000d8600000,0x00000000d8600000,0x00000000da400000)
  from space 5120K, 18% used [0x00000000da400000,0x00000000da4ea020,0x00000000da900000)
  to   space 5120K, 0% used [0x00000000da900000,0x00000000da900000,0x00000000dae00000)
 ParOldGen       total 81920K, used 8K [0x0000000089200000, 0x000000008e200000, 0x00000000d8600000)
  object space 81920K, 0% used [0x0000000089200000,0x0000000089202000,0x000000008e200000)
 Metaspace       used 3477K, capacity 4496K, committed 4864K, reserved 1056768K
  class space    used 380K, capacity 388K, committed 512K, reserved 1048576K
Heap after GC invocations=2 (full 1):
 PSYoungGen      total 35840K, used 0K [0x00000000d8600000, 0x00000000dae00000, 0x0000000100000000)
  eden space 30720K, 0% used [0x00000000d8600000,0x00000000d8600000,0x00000000da400000)
  from space 5120K, 0% used [0x00000000da400000,0x00000000da400000,0x00000000da900000)
  to   space 5120K, 0% used [0x00000000da900000,0x00000000da900000,0x00000000dae00000)
 ParOldGen       total 81920K, used 860K [0x0000000089200000, 0x000000008e200000, 0x00000000d8600000)
  object space 81920K, 1% used [0x0000000089200000,0x00000000892d73e8,0x000000008e200000)
 Metaspace       used 3477K, capacity 4496K, committed 4864K, reserved 1056768K
  class space    used 380K, capacity 388K, committed 512K, reserved 1048576K
}
-Xloggc:filename # 记录日志到文件

调优总结

上一篇 下一篇

猜你喜欢

热点阅读