简体   繁体   English

生产服务器中tomcat超出了GC开销限制

[英]GC overhead limit exceeded in tomcat in production server

In the server, we have >4GB free RAM but instead we have facing the following error code on that server. 在服务器中,我们有> 4GB的可用RAM,但相反,我们在该服务器上遇到以下错误代码。 And also I knew the error means that the GC(Garbage Collector) tried to free memory but was pretty much unable to get anything done. 而且我也知道该错误意味着GC(垃圾收集器)试图释放内存,但几乎无法完成任何事情。 By default it happens when the JVM spends more than 98% of total time in GC and when after GC less that 2% of the heap is recovered. 默认情况下,当JVM在GC上花费了总时间的98%以上,并且在GC之后恢复了不到2%的堆时,就会发生这种情况。

So, how can we handle with the issue on the server or may be Tomcat server. 因此,我们如何处理服务器上的问题,或者可能是Tomcat服务器。 Please suggest me. 请给我建议。 Thanks 谢谢

Status Code: 500
Message: Handler processing failed; nested exception is java.lang.OutOfMemoryError: GC overhead limit exceeded
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/8.0.7 Safari/600.7.12
Exception: java.lang.OutOfMemoryError: GC overhead limit exceeded

As you rightly pointed out that Garbage collector is spending 98% of time and GC and able to recover only (or less) 2% of the heap space. 正如您正确指出的那样,垃圾收集器正在花费98%的时间和GC,并且仅能(或减少)2%的堆空间。 This looks to be case of objects are getting allocated on the heap very fast. 这似乎是在非常快地在堆上分配对象的情况下。 You can take a heap dump and analyze using EclipseMemoryAnalyzer to check what objects are getting allocated on the heap. 您可以进行堆转储并使用EclipseMemoryAnalyzer进行分析,以检查正在堆上分配了哪些对象。 This should be a problem in the code rather than with Tomcat (or your application needs more heap size). 这应该是代码中的问题,而不是Tomcat(或者您的应用程序需要更大的堆大小)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM