在GC期间面临应用程序停止

时间:2013-08-28 02:48:27

标签: jvm

需要一些建议:

我正在使用Linux操作系统 我的机器上有24个CPU(英特尔)Xeon(R)CPU X5650 @ 2.67GHz RAM:24675112 kB JDK版本:java版“1.6.0_32”

我的JVM设置:

-Xmx12288m 
-Xms12288m 
-XX:MaxPermSize=1024m 
-XX:MaxNewSize=4096m 
-XX:InitialCodeCacheSize=128m 
-XX:ReservedCodeCacheSize=256m 
-XX:+UseCodeCacheFlushing 
-XX:+UseParNewGC 
-XX:+UseConcMarkSweepGC 
-XX:+CMSParallelRemarkEnabled 
-XX:+CMSClassUnloadingEnabled 
-XX:+UseCodeCacheFlushing 
-XX:+OptimizeStringConcat 
-XX:+UseTLAB 
-XX:+ResizeTLAB 
-XX:TLABSize=512k 
-XX:+PrintGC 
-XX:+DisableExplicitGC 
-XX:+PrintGCDetails 
-XX:-PrintConcurrentLocks 
-XX:+PrintGCDateStamps 
-XX:+PrintGCTimeStamps 
-XX:+PrintReferenceGC 
-XX:+PrintJNIGCStalls 
-XX:+PrintGCApplicationStoppedTime 
-XX:+CMSScavengeBeforeRemark 
-XX:ConcGCThreads=12 
-XX:ParallelGCThreads=12

我的GC日志:

2013-08-27T16:59:34.584-0500: 201544.846: [GC [1 CMS-initial-mark: 7548665K(8388608K)] 7973934K(12163520K), 0.5412390 secs] [Times: user=0.54 sys=0.00, real=0.54 secs]
Total time for which application threads were stopped: 0.5427300 seconds
2013-08-27T16:59:35.125-0500: 201545.387: [CMS-concurrent-mark-start]
Total time for which application threads were stopped: 0.0018140 seconds
Total time for which application threads were stopped: 0.0012720 seconds
Total time for which application threads were stopped: 0.0005850 seconds
Total time for which application threads were stopped: 0.0016750 seconds
Total time for which application threads were stopped: 0.0013800 seconds
Total time for which application threads were stopped: 0.0004860 seconds
Total time for which application threads were stopped: 0.0010740 seconds
Total time for which application threads were stopped: 0.0015250 seconds
Total time for which application threads were stopped: 0.0012570 seconds
Total time for which application threads were stopped: 0.0001500 seconds
Total time for which application threads were stopped: 0.0012430 seconds
2013-08-27T16:59:48.240-0500: 201558.502: [CMS-concurrent-mark: 13.095/13.114 secs] [Times: user=72.62 sys=4.61, real=13.12 secs]
2013-08-27T16:59:48.240-0500: 201558.502: [CMS-concurrent-preclean-start]
201558.502: [Preclean SoftReferences, 0.0003750 secs]201558.502: [Preclean WeakReferences, 0.0006710 secs]201558.503: [Preclean FinalReferences, 0.0001780 secs]201558.503: [Preclean PhantomReferenc
es, 0.0000170 secs]2013-08-27T16:59:48.265-0500: 201558.527: [CMS-concurrent-preclean: 0.025/0.025 secs] [Times: user=0.02 sys=0.00, real=0.02 secs]
2013-08-27T16:59:48.265-0500: 201558.527: [CMS-concurrent-abortable-preclean-start]
2013-08-27T16:59:53.952-0500: 201564.214: [GC 201564.214: [ParNew202182.528: [SoftReference, 0 refs, 0.0000110 secs]202182.528: [WeakReference, 1015 refs, 0.0001720 secs]202182.528: [FinalReference, 1625 refs, 0.0025210 secs]202182.531: [PhantomReference, 1 refs, 0.0000050 secs]202182.531: [JNI Weak Reference, 0.0000100 secs] (promotion failed): 3774912K->3774912K(3774912K), 619.3859950 secs]202183.600: [CMS CMS: abort preclean due to time 2013-08-27T17:10:14.937-0500: 202185.199: [CMS-concurrent-abortable-preclean: 7.271/626.671 secs] [Times: user=699.20 sys=98.95, real=626.55 secs]
 (concurrent mode failure)202189.179: [SoftReference, 614 refs, 0.0000710 secs]202189.179: [WeakReference, 5743 refs, 0.0007600 secs]202189.180: [FinalReference, 3380 refs, 0.0004430 secs]202189.180: [PhantomReference, 212 refs, 0.0000260 secs]202189.180: [JNI Weak Reference, 0.0000180 secs]: 8328471K->4813636K(8388608K), 18.5940310 secs] 11323577K->4813636K(12163520K), [CMS Perm : 208169K->208091K(346920K)], 637.9802050 secs] [Times: user=705.47 sys=98.79, real=637.85 secs]
**Total time for which application threads were stopped: 637.9820120 seconds**
Total time for which application threads were stopped: 0.0047480 seconds
Total time for which application threads were stopped: 0.0006330 seconds
Total time for which application threads were stopped: 0.0052820 seconds
Total time for which application threads were stopped: 0.0008540 seconds
Total time for which application threads were stopped: 0.0008090 seconds
Total time for which application threads were stopped: 0.0002400 seconds
Total time for which application threads were stopped: 0.0058850 seconds
Total time for which application threads were stopped: 0.0008530 seconds
Total time for which application threads were stopped: 0.0010900 seconds
Total time for which application threads were stopped: 0.0006730 seconds
Total time for which application threads were stopped: 0.0006930 seconds
Total time for which application threads were stopped: 0.0012200 seconds
Total time for which application threads were stopped: 0.0016290 seconds
Total time for which application threads were stopped: 0.0007660 seconds
Total time for which application threads were stopped: 0.0005650 seconds
Total time for which application threads were stopped: 0.0002880 seconds
Total time for which application threads were stopped: 0.0005440 seconds
Total time for which application threads were stopped: 0.0006790 seconds
Total time for which application threads were stopped: 0.0007510 seconds
Total time for which application threads were stopped: 0.0003870 seconds
Total time for which application threads were stopped: 0.0007190 seconds
Total time for which application threads were stopped: 0.0016670 seconds
Total time for which application threads were stopped: 0.0007340 seconds
Total time for which application threads were stopped: 0.0014800 seconds
Total time for which application threads were stopped: 0.0019800 seconds
Total time for which application threads were stopped: 0.0009810 seconds
Total time for which application threads were stopped: 0.0010530 seconds
Total time for which application threads were stopped: 0.0006650 seconds
Total time for which application threads were stopped: 0.0009600 seconds
Total time for which application threads were stopped: 0.0007110 seconds
Total time for which application threads were stopped: 0.0011330 seconds
Total time for which application threads were stopped: 0.0006940 seconds
Total time for which application threads were stopped: 0.0008220 seconds
Total time for which application threads were stopped: 0.0015080 seconds
Total time for which application threads were stopped: 0.0007340 seconds
Total time for which application threads were stopped: 0.0003830 seconds
Total time for which application threads were stopped: 0.0005620 seconds
2013-08-27T17:10:39.422-0500: 202209.684: [GC 202209.685: [ParNew202210.354: [SoftReference, 0 refs, 0.0000130 secs]202210.355: [WeakReference, 3827 refs, 0.0003690 secs]202210.355: [FinalReference, 3925 refs, 0.0024380 secs]202210.357: [PhantomReference, 99 refs, 0.0000220 secs]202210.357: [JNI Weak Reference, 0.0000090 secs]: 3355520K->419392K(3774912K), 0.6728950 secs] 8169156K->5597366K(12163520K), 0.6730540 secs] [Times: user=7.13 sys=0.00, real=0.68 secs]
Total time for which application threads were stopped: 0.6743080 seconds
Total time for which application threads were stopped: 0.0013680 seconds
Total time for which application threads were stopped: 0.0004720 seconds
Total time for which application threads were stopped: 0.0006960 seconds
Total time for which application threads were stopped: 0.0015600 seconds

我的应用程序运行正在“服务暂时不可用”

1 个答案:

答案 0 :(得分:0)

这是一个老问题,但我要回答完成,因为其他建议/意见错过了重点。

有问题的GC日志记录位于201564.214。 这是一个ParNew(年轻一代的集合),它受到促销失败的影响(终身空间没有足够的能力接受推广的数据)。但我不认为这是真正的问题,而是另一个潜在问题的后果。

这里奇怪的是预扫描阶段收集了98.95秒的系统时间 Full GC(并发模式故障)报告98.79秒的系统时间。这些数字表明,底层问题不在于GC,而在于JVM如何与操作系统进行交互。垃圾收集器在用户空间中运行,不应累积系统时间。

可能导致此问题的一个原因是操作系统需要执行多少工作来管理内存。如果系统处于低内存条件,则操作系统可能花费批次来管理它。竞争/繁重的I / O操作或在Linux中使用透明大页面可能会进一步加剧这种情况。没有进一步的数据,很难说。也就是说,在这种情况下,您需要查看正在运行的系统,以便更好地处理正在发生的事情。