性能问答>YoungGC暂停长达28s,求大佬帮忙看看怎么回事>
9回复

YoungGC暂停长达28s,求大佬帮忙看看怎么回事



JVM参数:

CommandLine flags: -XX:CICompilerCount=4 -XX:CompressedClassSpaceSize=260046848 -XX:ConcGCThreads=8 -XX:G1MixedGCCountTarget=16 -XX:GCLogFileSize=33554432 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/logs/100016706 -XX:InitialHeapSize=12884901888 -XX:+ManagementServer -XX:MaxGCPauseMillis=1000 -XX:MaxHeapFreeRatio=50 -XX:MaxHeapSize=12884901888 -XX:MaxMetaspaceSize=268435456 -XX:MetaspaceSize=134217728 -XX:MinHeapFreeRatio=30 -XX:NumberOfGCLogFiles=5 -XX:-OmitStackTraceInFastThrow -XX:ParallelGCThreads=8 -XX:+ParallelRefProcEnabled -XX:+PreserveFramePointer -XX:+PrintGC -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:-ResizePLAB -XX:SoftRefLRUPolicyMSPerMB=0 -XX:ThreadStackSize=512 -XX:+UnlockExperimentalVMOptions -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseG1GC -XX:+UseGCLogFileRotation

GC日志:

2020-02-21T03:34:36.241+0800: 645775.554: [GC pause (G1 Evacuation Pause) (young) (to-space exhausted), 28.5642889 secs]
   [Parallel Time: 26867.3 ms, GC Workers: 8]
      [GC Worker Start (ms): Min: 645775554.7, Avg: 645775554.7, Max: 645775554.7, Diff: 0.1]
      [Ext Root Scanning (ms): Min: 2.0, Avg: 2.1, Max: 2.3, Diff: 0.3, Sum: 16.6]
      [Update RS (ms): Min: 84.2, Avg: 84.4, Max: 84.5, Diff: 0.3, Sum: 675.0]
         [Processed Buffers: Min: 498, Avg: 508.8, Max: 520, Diff: 22, Sum: 4070]
      [Scan RS (ms): Min: 11.9, Avg: 12.0, Max: 12.0, Diff: 0.1, Sum: 95.8]
      [Code Root Scanning (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.1]
      [Object Copy (ms): Min: 26768.4, Avg: 26768.4, Max: 26768.6, Diff: 0.3, Sum: 214147.5]
      [Termination (ms): Min: 0.0, Avg: 0.2, Max: 0.2, Diff: 0.2, Sum: 1.5]
         [Termination Attempts: Min: 1, Avg: 188.9, Max: 245, Diff: 244, Sum: 1511]
      [GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.6]
      [GC Worker Total (ms): Min: 26867.1, Avg: 26867.1, Max: 26867.2, Diff: 0.1, Sum: 214937.0]
      [GC Worker End (ms): Min: 645802421.8, Avg: 645802421.8, Max: 645802421.9, Diff: 0.1]
   [Code Root Fixup: 0.0 ms]
   [Code Root Purge: 0.0 ms]
   [Clear CT: 0.6 ms]
   [Other: 1696.4 ms]
      [Evacuation Failure: 1671.9 ms]
      [Choose CSet: 0.0 ms]
      [Ref Proc: 11.2 ms]
      [Ref Enq: 0.2 ms]
      [Redirty Cards: 7.9 ms]
      [Humongous Register: 0.1 ms]
      [Humongous Reclaim: 1.7 ms]
      [Free CSet: 1.1 ms]
   [Eden: 6448.0M(6448.0M)->0.0B(2508.0M) Survivors: 924.0M->8192.0K Heap: 11.6G(12.0G)->8283.8M(12.0G)]
 [Times: user=30.75 sys=10.87, real=28.56 secs] 

貌似是to区不够,全部copy到old区了,Object Copy就花了26s,为什么拷贝会花那么久呢,这种一般怎么个优化法?

4740 阅读
请先登录,再评论

老哥 问题排查清楚了么?我的系统也出现这个问题,很好奇在to-space exhausted之前为啥没有发生mix gc

1年前

我遇到了和你类似的问题,YGC达到了10s,然后我打印了GC日志,发现在to-space exhausted日志上面执行了FullGC,而这次FullGC调用是由于我们代码中写了System.gc()引起的。去掉这个,GC就恢复正常了。不知道和你的情况是不是一样。

2年前

应该是物理内存不够了,可以看看swap在那会是否被使用了

2年前
回复 祝威廉:

gc并发线程数不建议调整过大 会影响应用线程的执行效率

2年前回复
回复 你假笨:

在年轻代回收的时候发现屋里内存不够,此时还没来得及触发mixed收集(或者concurent mark 还没来得及完成),那是不是可以通过调整 -XX:InitiatingHeapOccupancyPercent=35 (降低此值)来尽快触发mixed GC亦或是提升-XX:ConcGCThreads=16 来提升标记速度?

2年前回复
回复 没有蛀牙:

等有问题的时候top看看现场数据吧,看你swap是设置的空,也有点奇怪

2年前回复
查看更多