JAVA GC:ParNew(升级失败),并发模式失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12323124/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 08:26:30  来源:igfitidea点击:

JAVA GC : ParNew (promotion failed) , concurrent mode failure

javajakarta-eememorygarbage-collection

提问by VJS

I have seen sudden spike in my application / platform memory utilization.In the GC verbose logs I have seen below :

我看到我的应用程序/平台内存利用率突然飙升。在 GC 详细日志中,我看到了以下内容:

1285.946: [GC 1285.946: [**ParNew (promotion failed)**: 353920K-353920K(353920K), 0.8003983 secs]1286.747: [CMS1287.338:
[CMS-con current-sweep: 7.902/9.624 secs] [Times: user=96.62 sys=2.35,
real=9.62 secs]  (**concurrent mode failure**):
2531317K->1161025K(2752512K), 24.8330303 secs]
2860005K->1161025K(3106432K), [CMS Perm : 37117K->3 6905K(62368K)],
25.6341706 secs] [Times: user=26.41 sys=0.05, real=25.63 secs] [ POA RootPOA - rid: 17 oid: 00 17 2E 29 23 33 49 34 25 3E  opname: ping -
process request ]
1312.367: [GC 1312.367: [ParNew: 314624K->30240K(353920K), 0.0188874 secs] 1475649K->1191266K(3106432K), 0.0194380 secs] [Time s: user=0.40
sys=0.00, real=0.02 secs]
1313.249: [GC 1313.249: [ParNew: 344864K->39296K(353920K), 0.0300220 secs] 1505890K->1201198K(3106432K), 0.0305488 secs]

ParNew (promotion failed ),concurrent mode failure :

ParNew (promotion failed ),concurrent mode failure :

I believe the sudden spike in the memory is visible because of GC failure. Explain and How to resolve this.

我相信由于 GC 失败,内存中的突然峰值是可见的。解释和如何解决这个问题。

采纳答案by Fabian Lange

From the lines visible, I would assume that your application code creates too much garbage objects. The CMS failure Full GC was able to collect 1.4GB of garbage. So it is not a fragmentation issue, but an issue with the CMS not catching up. The [CMS perm] makes me curious what your GC settings are. Perhaps you could give CMS more CPUs to run? Or you could enlarge the New Space to avoid premature promotion to old.

从可见的行来看,我假设您的应用程序代码创建了太多垃圾对象。CMS 失败 Full GC 能够收集 1.4GB 的垃圾。所以这不是碎片问题,而是 CMS 没有赶上的问题。[CMS perm] 让我很好奇你的 GC 设置是什么。也许您可以为 CMS 提供更多 CPU 来运行?或者您可以扩大新空间以避免过早升级到旧空间。

But chances are, that you run inefficient code. I would attach a profiler to it and look for garbage allocation hot spots.

但很有可能,您运行的代码效率低下。我会给它附加一个分析器并寻找垃圾分配热点。

回答by Leon Chen

"ParNew (promotion failed)" means, there are some objects from young generation will be promoted to old generation, but there is not enough space. Maybe the old space is almost full, or maybe a promoted object is too huge, and there is not enough continue space.

“ParNew(promotion failed)”的意思是,有一些年轻代的对象会被提升到老年代,但是空间不够。可能是旧空间快满了,也可能是提升对象太大,没有足够的继续空间。

The simple solution, that is try to increase the size of old generation. Or you may try to use G1 algorithm, it may reduce the fragment problem of old generation.

简单的解决方案,就是尝试增加老年代的大小。或者你可以尝试使用G1算法,它可以减少老年代的碎片问题。

If both methods can't solve your problem, you may need to review your code, to reduce the size of a single object.

如果这两种方法都不能解决您的问题,您可能需要检查您的代码,以减少单个对象的大小。

Just my 2 cents,

只是我的 2 美分,

Best Regards, Leon

最好的问候, 里昂