即使有足够的java内存 – 为什么重复java垃圾收集

前端之家收集整理的这篇文章主要介绍了即使有足够的java内存 – 为什么重复java垃圾收集前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我们的 java进程占用了大量的cpu,并且日志显示它经常执行GC,即使已使用的内存大约为5GB(取自JMX控制台),而Min和Max内存为10GB.

我们的JVM args是:JVM_GC =“ – verbose:gc -Xnoclassgc -XX:PrintGCDetails -XX:UseParNewGC -XX:NewSize = 3GB -XX:ParallelGCThreads = 8 -XX:MaxTenuringThreshold = 15 -XX:UseConcMarkSweepGC”

和MinHeap = MaxHeap = 10GB

什么可能触发GC?为什么它经常发生并且太快?
除了通过JMX获取一些设置之外,我们无法将任何类型的分析工具连接为其生产框…
谢谢
….. GC日志….

@ 2011-07-20 02:10:46 [Full GC(System)[CMS:3333423K-> 4019122K(7340032K),13.4979250 secs] 4876606K-> 4019122K(10171200K),[CMS Perm:21656K-> 21608K (21824K)],13.4980930秒
s] [时间:用户= 12.99 sys = 0.50,真实= 13.50秒]
[GC [1 CMS-initial-mark:4019122K(7340032K)] 4041525K(10171200K),0.0009110 secs] [次:用户= 0.00 sys = 0.00,real = 0.00 secs] @ 2011-07-20 02:11:10 [ CMS并发标记:10.322 / 10.753秒] [时间:用户= 21.55 sys = 0.22,实际= 10.75秒]
[CMS-concurrent-preclean:0.035 / 0.036 secs] [次:用户= 0.04 sys = 0.00,real = 0.04 secs] @ 2011-07-20 02:11:15
CMS:因时间而中止预扫[CMS-concurrent-abortable-preclean:1.083 / 5.063 secs] [次:用户= 1.08 sys = 0.00,real = 5.06 secs]
[GC [YG占有率:282204 K(2831168 K)] [重新扫描(平行),0.0402030秒] [弱参考处理,0.0010550秒] [1 CMS-备注:4019122K(7340032K)] 4301
326K(10171200K),0.0413630秒] [次:用户= 0.07 sys = 0.01,real = 0.04 secs] @ 2011-07-20 02:11:16
[CMS-concurrent-sweep:2.627 / 2.627 secs] [时间:用户= 2.63 sys = 0.00,真实= 2.63秒]
[CMS-concurrent-reset:0.039 / 0.039 secs] [次:用户= 0.04 sys = 0.00,real = 0.04 secs] @ 2011-07-20 02:11:20
[GC [1 CMS-initial-mark:4019034K(7340032K)] 4301238K(10171200K),0.0308450 secs] [次:用户= 0.03 sys = 0.00,real = 0.03 secs] @ 2011-07-20 02:11:30
[CMS-concurrent-mark:10.304 / 10.307 secs] [时间:用户= 20.48 sys = 0.11,真实= 10.31秒]
[CMS-concurrent-preclean:0.018 / 0.019 secs] [次:用户= 0.02 sys = 0.00,real = 0.01 secs] @ 2011-07-20 02:11:35
CMS:因时间而中止预扫[CMS-并发 – 流产 – 预清洁:1.043 / 5.048秒]时间:用户= 1.03 sys = 0.00,实际= 5.05秒]
[GC [YG占有率:282204 K(2831168 K)] [重新扫描(平行),0.0419560秒] [弱参考处理,0.0010880秒] [1 CMS-备注:4019034K(7340032K)] 4301
238K(10171200K),0.0431480秒] [时间:用户= 0.07 sys = 0.01,实际= 0.05秒] @ 2011-07-20 02:11:38
[CMS-concurrent-sweep:2.622 / 2.622 secs] [时间:用户= 2.63 sys = 0.00,真实= 2.62秒]
[CMS-concurrent-reset:0.039 / 0.039 secs] [次:用户= 0.04 sys = 0.00,real = 0.04 secs]

解决方法

尝试使用UseCMSInitiatingOccupancyOnly& CMSInitiatingOccupancyFraction标志.使用这些标志启动CMS集合将根据占用率触发. 此外,可能有增加终身代的规模的意义.
原文链接:https://www.f2er.com/java/130203.html

猜你在找的Java相关文章