性能问答>G1 XX:MaxGCPauseMillis 貌似没有起作用>
2回复
1年前

G1 XX:MaxGCPauseMillis 貌似没有起作用



待检查的参数

-Xmx1536m
-Xms1536m
-Xss256k
-XX:+UnlockExperimentalVMOptions
-XX:G1NewSizePercent=40
-XX:G1MaxNewSizePercent=60
-XX:MetaspaceSize=256m
-XX:MaxMetaspaceSize=512m
-XX:+UseG1GC
-XX:G1HeapRegionSize=16m
-XX:G1ReservePercent=10
-XX:MaxTenuringThreshold=6
-XX:SurvivorRatio=5
-XX:+ParallelRefProcEnabled
-XX:-OmitStackTraceInFastThrow
-XX:+AlwaysPreTouch
-XX:InitiatingHeapOccupancyPercent=70
-XX:MaxGCPauseMillis=30
-XX:ParallelGCThreads=4
-XX:ConcGCThreads=4
-XX:ReservedCodeCacheSize=256m
-XX:+PrintGCApplicationStoppedTime
-XX:+PrintGCDetails
-XX:+PrintHeapAtGC
-XX:+PrintGCDateStamps
-XX:+HeapDumpOnOutOfMemoryError

58.300s][info][gc,start ] GC(9) Pause Young (Concurrent Start) (G1 Evacuation Pause)
[58.300s][info][gc,task ] GC(9) Using 4 workers of 4 for evacuation
[58.352s][info][gc,mmu ] GC(9) MMU target violated: 31.0ms (30.0ms/31.0ms)
[58.352s][info][gc,phases ] GC(9) Pre Evacuate Collection Set: 0.3ms
[58.352s][info][gc,phases ] GC(9) Evacuate Collection Set: 49.9ms
[58.352s][info][gc,phases ] GC(9) Post Evacuate Collection Set: 1.2ms
[58.352s][info][gc,phases ] GC(9) Other: 0.2ms
[58.352s][info][gc,heap ] GC(9) Eden regions: 35->0(34)
[58.352s][info][gc,heap ] GC(9) Survivor regions: 3->4(8)
[58.352s][info][gc,heap ] GC(9) Old regions: 12->12
[58.352s][info][gc,heap ] GC(9) Humongous regions: 9->4
[58.352s][info][gc,metaspace ] GC(9) Metaspace: 256244K->256244K(749568K)
[58.352s][info][gc ] GC(9) Pause Young (Concurrent Start) (G1 Evacuation Pause) 929M->292M(1536M) 51.706ms
[58.352s][info][gc,cpu ] GC(9) User=0.13s Sys=0.03s Real=0.05s

几乎每一次都会产mmu,重新分配内存大小

2370 阅读
请先登录,再评论

MaxGCPauseMillis只是一个期望值,具体要根据程序来决定的,如果这个值太小,导致分配速度大于垃圾清理速度,最终还有可能直接暂停应用,采用单线程进行标记、清理和压缩整理

1年前
回复 小邋遢:

就是每一次都mmu说明动态调整是有问题的

1年前回复