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

Jvm GC期间面临应用程序停止,jvm,Jvm,需要一些建议: 我正在使用Linux操作系统 我的机器中有24 CPU Intel(R)Xeon(R)CPU X5650@2.67GHz 内存:24675112 kB JDK版本:java版本“1.6.0_32” 我的JVM设置: -Xmx12288m -Xms12288m -XX:MaxPermSize=1024m -XX:MaxNewSize=4096m -XX:InitialCodeCacheSize=128m -XX:ReservedCodeCacheSize=256m -X

需要一些建议:

我正在使用Linux操作系统 我的机器中有24 CPU Intel(R)Xeon(R)CPU X5650@2.67GHz 内存: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

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

这是一个老问题,但我将回答它,以便完成,因为其他建议/评论没有抓住要点

有问题的GC日志记录位于201564.214。 这是一个新的(年轻一代收集),升级失败(终身空间没有足够的容量接受升级的数据)。但我认为这不是真正的问题,而是另一个潜在问题的后果

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


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

由于垃圾收集器中断了您的应用程序,您如何确定您得到了它?您是否尝试过在没有所有“-XX”的情况下获得它?我的第一条建议是除去设置最大堆大小之外的所有配置标志。我还将使用分代收集器,而不是CMS。我还将使用Java 7,而不是6。每次用户出现“服务不可用”消息时,我们都会看到消息“应用程序线程停止的总时间:637.9820120秒(停止的时间大多大于5分钟)。