Java垃圾回收-OutOfMemory快速失败

时间:2018-08-02 08:24:47

标签: java garbage-collection

我想知道是否有一种方法可以将JVM配置为快速失败并比正常情况更早抛出OutOfMemoryException

我受内存限制,无法根据输入来预测内存需求。如果分配的内存太小,我可以简单地限制输入并重试。

我知道UseGCOverheadLimit并已将其激活,但是从开始 futile 内存回收过程开始,有时仍然需要3个小时才能获得OOME。

它也不总是以java.lang.OutOfMemoryError: GC overhead limit exceeded结尾。

...
2018-07-31T14:46:35.170+0200: 413562.828: [Full GC (Allocation Failure) 2018-07-31T14:46:35.170+0200: 413562.828: [CMS: 3311231K->3311231K(3311232K), 5.8388402 secs] 3464575K->3464566K(3464576K), [Metaspace: 44119K->44119K(1091584K)], 5.8389548 secs] [Times: user=5.84 sys=0.00, real=5.84 secs]
2018-07-31T14:46:41.009+0200: 413568.668: [Full GC (Allocation Failure) 2018-07-31T14:46:41.009+0200: 413568.668: [CMS: 3311231K->3311231K(3311232K), 5.8330374 secs] 3464575K->3464574K(3464576K), [Metaspace: 44119K->44119K(1091584K)], 5.8331435 secs] [Times: user=5.83 sys=0.00, real=5.83 secs]
2018-07-31T14:46:46.843+0200: 413574.502: [Full GC (Allocation Failure) 2018-07-31T14:46:46.843+0200: 413574.502: [CMS: 3311231K->3311231K(3311232K), 5.8418791 secs] 3464575K->3464575K(3464576K), [Metaspace: 44119K->44119K(1091584K)], 5.8419772 secs] [Times: user=5.85 sys=0.00, real=5.85 secs]
2018-07-31T14:46:52.685+0200: 413580.344: [Full GC (Allocation Failure) 2018-07-31T14:46:52.685+0200: 413580.344: [CMS: 3311231K->3311231K(3311232K), 5.8021946 secs] 3464575K->3464574K(3464576K), [Metaspace: 44119K->44119K(1091584K)], 5.8023009 secs] [Times: user=5.80 sys=0.00, real=5.80 secs]
2018-07-31T14:46:58.488+0200: 413586.147: [Full GC (Allocation Failure) 2018-07-31T14:46:58.488+0200: 413586.147: [CMS: 3311231K->3311231K(3311232K), 5.8218239 secs] 3464575K->3464572K(3464576K), [Metaspace: 44119K->44119K(1091584K)], 5.8219475 secs] [Times: user=5.83 sys=0.00, real=5.82 secs]
2018-07-31T14:47:04.310+0200: 413591.969: [Full GC (Allocation Failure) 2018-07-31T14:47:04.310+0200: 413591.969: [CMS: 3311231K->3311231K(3311232K), 5.8301615 secs] 3464575K->3464572K(3464576K), [Metaspace: 44119K->44119K(1091584K)], 5.8302739 secs] [Times: user=5.83 sys=0.00, real=5.83 secs]
2018-07-31T14:47:10.142+0200: 413597.801: [GC (CMS Initial Mark) [1 CMS-initial-mark: 3311231K(3311232K)] 3464573K(3464576K), 0.1434106 secs] [Times: user=0.17 sys=0.00, real=0.15 secs]
...
2018-07-31T14:55:18.240+0200: 414085.899: [Full GC (Allocation Failure) 2018-07-31T14:55:18.240+0200: 414085.899: [CMS: 3311231K->3311232K(3311232K), 7.0031551 secs] 3464575K->3464572K(3464576K), [Metaspace: 44122K->44122K(1091584K)], 7.0032665 secs] [Times: user=7.01 sys=0.00, real=7.00 secs]
2018-07-31T14:55:25.244+0200: 414092.903: [Full GC (Allocation Failure) 2018-07-31T14:55:25.244+0200: 414092.903: [CMS: 3311232K->3311232K(3311232K), 5.8499334 secs] 3464575K->3464573K(3464576K), [Metaspace: 44122K->44122K(1091584K)], 5.8500445 secs] [Times: user=5.85 sys=0.00, real=5.85 secs]

...

我正在使用openjdk-8和CMS收集器。

0 个答案:

没有答案