[英]Sudden Java Heap Space errors on Tomcat 5.5
We have a Spring 2.0.8 application in production, running on Tomcat 5.5.x and JRE 1.5.x (yeah, I know, we should upgrade, that's not the point now), with Oracle 11g as our choice of DB. 我们在生产环境中有一个Spring 2.0.8应用程序,它在Tomcat 5.5.x和JRE 1.5.x上运行(是的,我知道,我们应该升级,现在不重要了),并选择Oracle 11g作为数据库。
We have upgraded the application some months ago (I'd say July) and have switched from Oracle 10g to Oracle 11g in the past month or so (also changing the Oracle JDBC driver to match the database version). 我们已经在几个月前(我说是七月)升级了该应用程序,并且在过去一个月左右的时间里已从Oracle 10g切换到Oracle 11g(还更改了Oracle JDBC驱动程序以匹配数据库版本)。
We've been having serious and unexpected problems in production. 我们在生产中遇到了严重而出乎意料的问题。 As of a day ago, there have been heap space OutOfMemory errors several hours apart.
截至一天前,堆空间OutOfMemory错误相隔数小时。 This in turn either slows down response time by about a 100 times, or the users can't connect.
反过来,这可能会使响应时间降低大约100倍,或者用户无法连接。
Our setup is: 我们的设置是:
Since noticing this error, this is what we tried: 既然注意到了这个错误,这就是我们尝试的方法:
I'm looking out for ideas on what else to do. 我正在寻找其他方法的想法。 We have this same setup in 5 different productions in total, this problematic one being with the smallest number of users and data.
我们总共有5种不同产品的相同设置,而有问题的是用户和数据最少。
Now that you have figured it out, I recommend that you add the following to the list of things to do REAL SOON: 现在您已经弄清楚了,我建议您将以下内容添加到要做REAL SOON的事情列表中:
Upgrade your JVM to Java 7. Java 5 has been "end-of-lifed" which means that you won't be getting any more security patches ... unless you are on an Oracle Java support contract. 将JVM升级到Java7。Java5已“报废”,这意味着您将不再获得任何安全补丁……除非您与Oracle Java支持合同签订。
If you can't upgrade to Java 7 ... or Java 6, then at least upgrade to the most recent patch release for Java 5 that you can get hold of. 如果您不能升级到Java 7 ...或Java 6,则至少要升级到可以掌握的Java 5最新补丁程序版本。
Upgrade to Tomcat 6 or 7, or at least to the most recent Tomcat 5.5. 升级到Tomcat 6或7,或者至少升级到最新的Tomcat 5.5。
To head off problems where OutOfMemoryError
causes severe slowdowns, make sure that you have the -XX:+UseGCOverheadLimit
option on your JVM command line. 要避免
OutOfMemoryError
导致严重减速的问题,请确保在JVM命令行上具有-XX:+UseGCOverheadLimit
选项。
And, if you plan to do any significant development work on that system, consider upgrading it to Spring 3.x. 而且,如果您打算在该系统上进行任何重要的开发工作,请考虑将其升级到Spring3.x。
Ok, we figured this one out. 好的,我们知道了这一点。 It turns out it was a badly written SQL query which was scarcely used.
事实证明,这是一个很少使用的,写得不好的SQL查询。 Analyzing the heapdump helped find the objects that were taking up a lot of memory, and we went from there.
分析堆转储有助于找到占用大量内存的对象,我们从那里开始。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.