G1GC用初始标记长时间暂停 [英] G1GC long pause with initial-mark

查看:173
本文介绍了G1GC用初始标记长时间暂停的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用j7u5,G1GC



- Xms3200m -Xmx3200m -XX:+ UseG1GC -XX:ParallelGCThreads = 14 -XX:ConcGCThreads = 4 -XX:MaxGCPauseMillis = 40 -XX:NewRatio = 2 -XX:SurvivorRatio = 10 -XX:+ PrintGC -XX:+ PrintGCDateStamps



对于给定的性能测试,我的应用程序在可预测的5小时运行后会停顿很长时间。除了这个大的(并且只有)之外,还有很小的初始标记阶段。



任何有关这个长时间停顿以及如何调整它的建议避免这种影响延迟目标的长时间停顿(百分比98%,99.999%)?

  2012-12-22T09:48:57.966 + 0000:[GC暂停(年轻)2436M-> 1460M(3200M),0.0627090秒] 
2012-12-22T09:49:07.295 +0000:[GC暂停(年轻)2458M-> 1481M(3200M),0.0871760秒]
2012-12-22T09:49:18.905 + 0000:[GC暂停(年轻)2479M-> 1503M(3200M ),0.0930280秒]
2012-12-22T09:49:32.366 + 0000:[GC暂停(年轻)2501M-> 1524M(3200M),0.0827900秒]
2012-12-22T09:49 :44.576 + 0000:[GC暂停(年轻)(初始标记)2522M-> 1546M(3200M),3.4979530秒]
2012-12-22T09:49:48.074 + 0000:[GC concurrent-root- region-scan-start]
2012-12-22T09:49:48.079 + 0000:[GC concurrent-root-region-scan-end,0.0056590]
2012-12-22T09:49:48.080+ 0000:[GC concurrent-mar k-start]
2012-12-22T09:49:48.173 + 0000:[GC并发标记结束,0.0932560秒]
2012-12-22T09:49:48.180 + 0000:[GC备注,0.0470160秒]
2012-12-22T09:49:48.232 + 0000:[GC清除1585M-> 944M(3200M),0.0180490秒]
2012-12-22T09:49:48.251 + 0000 :[GC concurrent-cleanup-start]
2012-12-22T09:49:48.255 + 0000:[GC concurrent-cleanup-end,0.0047270]

解决方案

对于日志记录,请使用 -XX:+ PrintGCTimeStamps -XX:+ PrintGCApplicationStoppedTime -XX:+ PrintGCApplicationConcurrentTime 以更好地理解问题和瓶颈



建议使用 -XX:+ UnlockExperimentalVMOptions -XX:+ AggressiveOpts - XX:使用G1GC + DoEscapeAnalysis -XX:+ UseCompressedOops 选项(如果本机/服务器& JDK版本)



请同时使用 -XX:GCPauseIntervalMillis = VALUE c $ c> -XX:MaxGCPauseMillis = VALUE (它会控制你的暂停,最好通过做一些R& D来获得两个参数的最佳拟合值的组合) 顺便说一句,我们正在成功使用值的组合作为-XX:MaxGCPauseMillis = 400 -XX:GCPauseIntervalMillis = 8000

-XX:NewRatio param的默认值是40,所以最好是40或40以上 -XX:NewRatio = 50


With j7u5, G1GC

"-Xms3200m -Xmx3200m -XX:+UseG1GC -XX:ParallelGCThreads=14 -XX:ConcGCThreads=4 -XX:MaxGCPauseMillis=40 -XX:NewRatio=2 -XX:SurvivorRatio=10 -XX:+PrintGC -XX:+PrintGCDateStamps"

for a given performance test, my application hits a long pause after 5-hour run predictably. Except this big one (and only), there are small initial-mark phases.

Any suggestions to figure out what is happening to this long pause and how to tune it to avoid such a long pause which affects the latency targets (percentiles 98%, 99.999%)?

2012-12-22T09:48:57.966+0000: [GC pause (young) 2436M->1460M(3200M), 0.0627090 secs]
2012-12-22T09:49:07.295+0000: [GC pause (young) 2458M->1481M(3200M), 0.0871760 secs]
2012-12-22T09:49:18.905+0000: [GC pause (young) 2479M->1503M(3200M), 0.0930280 secs]
2012-12-22T09:49:32.366+0000: [GC pause (young) 2501M->1524M(3200M), 0.0827900 secs]
2012-12-22T09:49:44.576+0000: [GC pause (young) (initial-mark) 2522M->1546M(3200M), 3.4979530 secs]
2012-12-22T09:49:48.074+0000: [GC concurrent-root-region-scan-start]
2012-12-22T09:49:48.079+0000: [GC concurrent-root-region-scan-end, 0.0056590]
2012-12-22T09:49:48.080+0000: [GC concurrent-mark-start]
2012-12-22T09:49:48.173+0000: [GC concurrent-mark-end, 0.0932560 sec]
2012-12-22T09:49:48.180+0000: [GC remark, 0.0470160 secs]
2012-12-22T09:49:48.232+0000: [GC cleanup 1585M->944M(3200M), 0.0180490 secs]
2012-12-22T09:49:48.251+0000: [GC concurrent-cleanup-start]
2012-12-22T09:49:48.255+0000: [GC concurrent-cleanup-end, 0.0047270]

解决方案

for logging, use -XX:+PrintGCTimeStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime for better understanding of the problem and bottlenecks

Its recommended to use -XX:+UnlockExperimentalVMOptions -XX:+AggressiveOpts -XX:+DoEscapeAnalysis -XX:+UseCompressedOops options with G1GC (if these are supported by native machine/server & JDK version)

Also please use -XX:GCPauseIntervalMillis=VALUE with the combination of -XX:MaxGCPauseMillis=VALUE (It'll control your pauses, better to get combination of best fit values of both params by doing some R&D) BTW we are successfully using combination of values as -XX:MaxGCPauseMillis=400 -XX:GCPauseIntervalMillis=8000

The default value of -XX:NewRatio param is 40, so its better to have it either 40 or more than 40 e.g. -XX:NewRatio=50

这篇关于G1GC用初始标记长时间暂停的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆