如何防止ParNew停止应用几分钟

时间:2021-11-20 05:33:20

One day my application got stuck for a ~5 min. I believe it happened because of ParNew GC. I don't have GC logs but the internal tool shows that ParNew consumed ~35% CPU at that time. Now I wonder how to prevent that in future.

有一天,我的申请被卡住了约5分钟。我相信这是因为ParNew GC。我没有GC日志,但内部工具显示ParNew当时消耗了大约35%的CPU。现在我想知道将来如何防止这种情况。

The application runs with JDK 1.8 and 2.5G heap. The GC options are XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode.

该应用程序使用JDK 1.8和2.5G堆运行。 GC选项为XX:+ UseConcMarkSweepGC -XX:+ CMSIncrementalMode。

I know I can use XX:MaxGCPauseMillis and XX:GCTimeRatio. What else would you propose to prevent ParNew from stopping the application for a few minutes ?

我知道我可以使用XX:MaxGCPauseMillis和XX:GCTimeRatio。你还有什么建议阻止ParNew停止申请几分钟?

1 个解决方案

#1


GC is optimized not to eat your cpu time, being stuck for 5 minutes is far from normal, either you released millions of objects or most likely your allocated almost (if not all) your heap space, forcing the GC to retrieve every piece of memory it could find. I would also check for memory leaks.

GC被优化为不占用您的CPU时间,被卡住5分钟远离正常,要么您释放了数百万个对象,要么很可能是您分配的几乎(如果不是全部)堆空间,迫使GC检索每一块内存它可以找到。我还会检查内存泄漏。

#1


GC is optimized not to eat your cpu time, being stuck for 5 minutes is far from normal, either you released millions of objects or most likely your allocated almost (if not all) your heap space, forcing the GC to retrieve every piece of memory it could find. I would also check for memory leaks.

GC被优化为不占用您的CPU时间,被卡住5分钟远离正常,要么您释放了数百万个对象,要么很可能是您分配的几乎(如果不是全部)堆空间,迫使GC检索每一块内存它可以找到。我还会检查内存泄漏。