简体   繁体   English

在CentOS 6中,JVM总是超过100%的CPU使用率

[英]JVM always beyond 100% CPU usage in CentOS 6

Good afternoon. 下午好。 I'm having a really baffling issue with the Java VM on my CentOS 6 (64bit) server. 我的CentOS 6(64位)服务器上的Java VM问题非常令人困惑。 It's a server with a quad-core CPU (with hyperthreading), 16GB of RAM and 2TB hard drive space (on software RAID1). 它是一个具有四核CPU(具有超线程),16GB RAM和2TB硬盘空间(在软件RAID1上)的服务器。 I figured I'd ask here because, according to the FAQ, questions about "common tools" used by developers are appropriate. 我想我会在这里问一下,因为根据FAQ,关于开发人员使用的“常用工具”的问题是合适的。 Hopefully someone can shed some light on the issue. 希望有人能够对这个问题有所了解。

I run a piece of Java software on the server, 24h/day. 我在服务器上运行一个Java软件,每天24小时。 Earlier today (detected a few hours after midnight on the server's locale, which is notable because it's the first day of the month) I received reports by users connecting to this software as clients about it suddenly having become unusable. 今天早些时候(在服务器的区域设置午夜后几小时检测到,这是值得注意的,因为它是一个月的第一天)我收到连接到该软件的用户的报告,因为客户端突然变得无法使用。 The JVM was never interrupted or restarted. JVM从未中断或重新启动。 It had been last restarted only a few days ago, and it had been running normally since then (using about 5% or less CPU, which is normal). 它仅在几天前重新启动,并且从那时起它一直正常运行(使用大约5%或更少的CPU,这是正常的)。

This time, when I checked the process, it was essentially gobbling up all the CPU time it could wrestle from the other applications running on the server (as reported by top), or, way over 100% (as reported by ps). 这一次,当我检查过程时,它实际上吞噬了它可能从服务器上运行的其他应用程序(如上面报告的)所花费的所有CPU时间,或者,超过100%(由ps报告)。 I tried stopping and restarting the application, but as soon as it was running, CPU usage would immediately shoot up to above 100% again. 我尝试停止并重新启动应用程序,但一旦运行,CPU使用率将立即再次高达100%以上。 Memory usage is normal. 内存使用情况正常。 I experimented with different JVM flags, to no avail. 我尝试了不同的JVM标志,但无济于事。 I tried downloading the latest version of the software and making a fresh install, but this didn't help either. 我尝试下载最新版本的软件并进行全新安装,但这也无济于事。 Finally, I tried downloading another , completely distinct piece of Java software, but when I ran it on the server, it suffered from the same problem. 最后,我尝试下载另一个完全不同的Java软件,但是当我在服务器上运行它时,它遇到了同样的问题。

When I downloaded the software and ran it on my computer, CPU usage was normal. 当我下载软件并在我的计算机上运行时,CPU使用率正常。 Therefore, I am assuming is wrong in the server, but I can't imagine what it could possibly be. 因此,我假设服务器中存在错误,但我无法想象它可能是什么。 The server's JVM is up to date, from a standard, repository package (no customization whatsoever). 服务器的JVM是最新的,来自标准的存储库包(无需任何自定义)。

From java -version: 来自java -version:

java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.3) (rhel-1.48.1.11.3.el6_2-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

From uname -a: 来自uname -a:

2.6.32-131.21.1.el6.x86_64 #1 SMP Tue Nov 22 19:48:09 GMT 2011 x86_64 x86_64 x86_64 GNU/Linux

From centos-release/redhat-release/system-release: 从centos-release / redhat-release / system-release:

CentOS release 6.2 (Final)

free reports about 14.5gb free RAM. 关于14.5gb免费RAM的免费报告。 df reports about 1.4tb free disk space in the /home partition (where the software in question and all their files were located). df报告/ home分区中有1.4tb可用磁盘空间(有问题的软件及其所有文件所在的位置)。

Any ideas? 有任何想法吗? Please ask if you need more data, and feel free to suggest procedures for me to try out/check. 请询问您是否需要更多数据,并随时建议我试用/检查程序。 When looking up the problem, I found several instances of people having trouble with JVM stealing all the CPU on CentOS, but none of them seemed to match my problem. 在查找问题时,我发现有几个人在JVM上窃取CentOS上的所有CPU时出现问题但是没有一个人能够解决我的问题。

You probably want to try the following commands 您可能想尝试以下命令

# service ntpd stop; date -s "`date`";service ntpd start;

I have CentOS6 with kernel 2.6.32-220.el6.x86_64 and jdk1.7.0_04, high CPU was observed and resolved by above command. 我有内核2.6.32-220.el6.x86_64和jdk1.7.0_04的CentOS6,通过上面的命令观察并解析了高CPU。 no need of restart OS. 无需重启OS。

This appears to be a bug with the linux kernel as described at https://access.redhat.com/knowledge/solutions/154793 . 这似乎是linux内核的一个错误,如https://access.redhat.com/knowledge/solutions/154793所述 The above fix is described at http://blog.wpkg.org/2012/07/01/java-leap-second-bug-30-june-1-july-2012-fix/ 以上修复程序在http://blog.wpkg.org/2012/07/01/java-leap-second-bug-30-june-1-july-2012-fix/中描述。

I can also confirm the issue present in RHEL 6, Tomcat 7, and Sun/Oracle Java 7 & Java 6. 我还可以确认RHEL 6,Tomcat 7和Sun / Oracle Java 7和Java 6中存在的问题。

ntpd stop; date; ntpd start ntpd stop; date; ntpd start command worked. ntpd stop; date; ntpd start命令工作。

uname:
2.6.32-220.2.1.el6.x86_64 #1 SMP Fri Dec 23 02:21:33 CST 2011 x86_64 x86_64 x86_64 GNU/Linux

I can confirm this issue is present on Fedora 14, Tomcat 6 and OpenJDK 1.6. 我可以确认Fedora 14,Tomcat 6和OpenJDK 1.6上存在此问题。 Mysticial's solution worked for me as well. Mysticial的解决方案也适用于我。

uname -ar: uname -ar:

2.6.35.14-103.fc14.x86_64 #1 SMP Thu Oct 27 15:41:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

java -version: java -version:

java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.10) (fedora-55.1.9.10.fc14-x86_64)
OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)

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

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