一次诡异的gc

最近在性能和压力测试对gc日志进行监控分析时,出现了诡异的现象:  Yong GC之后 Yong Gen占用空间变大了!

Host环境:
    OS: Linux 2.6.32-358.23.2.el6.x86_64
         CentOS release 6.4 (Final)  

    JVM:
         java version "1.7.0_76"
         Java(TM) SE Runtime Environment (build 1.7.0_76-b13)
         Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode)

    Tomcat JVM OPTIONS:
         -Xms6g -Xmx6g -Xmn4g -Xss256k -XX:SurvivorRatio=6 -XX:PermSize=256m -XX:MaxPermSize=256m -server -XX:MaxTenuringThreshold=15        -XX:+PrintTenuringDistribution -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:+CMSParallelRemarkEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=80 -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError



   异常的gc日志以及上下文:
         2017-01-23T10:28:07.600+0800: 861788.673: [GC2017-01-23T10:28:07.601+0800: 861788.673: [ParNew
Desired survivor size 268435456 bytes, new threshold 15 (max 15)
- age   1:    7995096 bytes,    7995096 total
- age   2:    1267624 bytes,    9262720 total
- age   3:     159120 bytes,    9421840 total
- age   4:      37384 bytes,    9459224 total
- age   5:      25336 bytes,    9484560 total
- age   6:       2336 bytes,    9486896 total
- age   7:     525656 bytes,   10012552 total
- age   8:       4000 bytes,   10016552 total
- age   9:    1049072 bytes,   11065624 total
- age  10:      95056 bytes,   11160680 total
- age  11:     527344 bytes,   11688024 total
- age  12:       1456 bytes,   11689480 total
- age  13:        936 bytes,   11690416 total
- age  14:        520 bytes,   11690936 total
- age  15:        376 bytes,   11691312 total
: 3159449K->12811K(3670016K), 0.0305460 secs] 3619391K->472754K(5767168K), 0.0312440 secs] [Times: user=0.05 sys=0.00, real=0.03 secs]
2017-01-23T10:29:17.094+0800: 861858.166: [GC2017-01-23T10:29:17.094+0800: 861858.167: [ParNew
Desired survivor size 268435456 bytes, new threshold 15 (max 15)
- age   1:    8014296 bytes,    8014296 total
- age   2:     642016 bytes,    8656312 total
- age   3:    1090696 bytes,    9747008 total
- age   4:      73152 bytes,    9820160 total
- age   5:       4520 bytes,    9824680 total
- age   6:       8456 bytes,    9833136 total
- age   7:       1960 bytes,    9835096 total
- age   8:     525656 bytes,   10360752 total
- age   9:       4000 bytes,   10364752 total
- age  10:    1049072 bytes,   11413824 total
- age  11:      95056 bytes,   11508880 total
- age  12:       3040 bytes,   11511920 total
- age  13:       1456 bytes,   11513376 total
- age  14:        936 bytes,   11514312 total
- age  15:        520 bytes,   11514832 total
: 3158539K->12184K(3670016K), 0.0306850 secs] 3618482K->472126K(5767168K), 0.0311270 secs] [Times: user=0.06 sys=0.00, real=0.03 secs]
2017-01-23T10:29:17.127+0800: 861858.200: [GC2017-01-23T10:29:17.127+0800: 861858.200: [ParNew
Desired survivor size 268435456 bytes, new threshold 15 (max 15)
- age   1:         64 bytes,         64 total
- age   2:    7982688 bytes,    7982752 total
- age   3:     642016 bytes,    8624768 total
- age   4:    1090696 bytes,    9715464 total
- age   5:      73152 bytes,    9788616 total
- age   6:       4520 bytes,    9793136 total
- age   7:       8456 bytes,    9801592 total
- age   8:       1960 bytes,    9803552 total
- age   9:     525656 bytes,   10329208 total
- age  10:       4000 bytes,   10333208 total
- age  11:    1049072 bytes,   11382280 total
- age  12:      95056 bytes,   11477336 total
- age  13:       3040 bytes,   11480376 total
- age  14:       1456 bytes,   11481832 total
- age  15:        936 bytes,   11482768 total
: 12243K->12689K(3670016K), 0.0168980 secs] 472186K->472632K(5767168K), 0.0172270 secs] [Times: user=0.05 sys=0.00, real=0.02 secs]
2017-01-23T10:30:37.850+0800: 861938.923: [GC2017-01-23T10:30:37.851+0800: 861938.923: [ParNew
Desired survivor size 268435456 bytes, new threshold 15 (max 15)
- age   1:   12861952 bytes,   12861952 total
- age   3:     300200 bytes,   13162152 total
- age   4:     108048 bytes,   13270200 total
- age   5:     546992 bytes,   13817192 total
- age   6:      55296 bytes,   13872488 total
- age   7:       4224 bytes,   13876712 total
- age   8:       7896 bytes,   13884608 total
- age   9:       1280 bytes,   13885888 total
- age  10:     525416 bytes,   14411304 total
- age  11:       4000 bytes,   14415304 total
- age  12:    1049072 bytes,   15464376 total
- age  13:      95056 bytes,   15559432 total
- age  14:       3040 bytes,   15562472 total
- age  15:       1456 bytes,   15563928 total
: 3158417K->18166K(3670016K), 0.0274050 secs] 3618360K->478110K(5767168K), 0.0277950 secs] [Times: user=0.06 sys=0.00, real=0.03 secs]
2017-01-23T10:32:01.871+0800: 862022.943: [GC2017-01-23T10:32:01.871+0800: 862022.944: [ParNew
Desired survivor size 268435456 bytes, new threshold 15 (max 15)
- age   1:   15536008 bytes,   15536008 total
- age   2:    2238464 bytes,   17774472 total
- age   4:     103056 bytes,   17877528 total
- age   5:      21992 bytes,   17899520 total
- age   6:     542584 bytes,   18442104 total
- age   7:       3448 bytes,   18445552 total
- age   8:       3848 bytes,   18449400 total
- age   9:       7896 bytes,   18457296 total
- age  10:        512 bytes,   18457808 total
- age  11:     525416 bytes,   18983224 total
- age  12:       4000 bytes,   18987224 total
- age  13:     524768 bytes,   19511992 total
- age  14:      95032 bytes,   19607024 total
- age  15:       3040 bytes,   19610064 total
: 3163894K->20556K(3670016K), 0.0347080 secs] 3623838K->480501K(5767168K), 0.0351120 secs] [Times: user=0.08 sys=0.01, real=0.03 secs]

注意上面的标红部分.


诡异点:
   1. 连着两次 yong gc 间隔极短: 33ms.
         2017-01-23T10:29:17.094+0800: 861858.166:
         2017-01-23T10:29:17.127+0800: 861858.200:
 
   2. Yong 区内存gc 之后占用反而增大!
         : 12243K->12689K(3670016K), 0.0168980 secs]

      而且gc前才占用12MB左右的占用量,Yong 区有3.5G的总大小。说明空闲内存是充足的,应该达不到yong gc 的触发条件。
    
      期间并未发生Old 区的gc (没有cms gc的日志)

      对这条gc数据做个计算:
           12243K->12689K(3670016K), 0.0168980 secs] 472186K->472632K(5767168K)

           Yong Gen: 12689K - 12243K = 446 K , gc后Yong Gen增长了 446K,
           Heap 区增长了: 472632K - 472186K = 446K.

下午与公司一些同事聊了下,都觉得诡异,没有搞清楚原因 。求大牛解析

问题已解决:
结论: jvm bug. 但是官方不再维护CMS GC 了, 有影响的切g1或者parallel。https://bugs.openjdk.java.net/browse/JDK-8048556

猜你喜欢

转载自liwenzhong1016-126-com.iteye.com/blog/2354635
今日推荐