JAVA和CentOS 6.3的高CPU负载

时间:2013-06-26 08:05:17

标签: java multithreading performance cpu centos6

我在运行java程序时看到了高CPU利用率。我发现jstack可以帮助调试卡住的东西并吃掉CPU。我用jstack得到了输出,发现很少有线程处于BLOCKED状态。

这里我使用了java 1.7并确认了我在同一操作系统(即CentOS 6.3)上用旧版本1.6替换java的加载问题,但问题仍然存在,因为已经测试了java 1.6(1.7以及)的组合centos 5.4,效果很好,使用较少的CPU。

除了操作系统6.3之外没有任何改变,只会出现负载问题。

如何找到将线程指向BLOCKED的相关代码到jstack输出中,以下是我的发现的输出

OS - CentOS 6.3 x86_64 (2.6.32-279.el6.x86_64)
CPU core - 8
Ram - 16GB
Java version - "1.7.0_17"

jstack输出:

Deadlock Detection:

No deadlocks found.

none
null_check
null_assert
range_check
class_check
array_check
intrinsic
bimorphic
unloaded
uninitialized
unreached
unhandled
constraint
div0_check
age
predicate
loop_limit_check
Thread 4514: (state = BLOCKED)

Locked ownable synchronizers:
    - None

Thread 4493: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - java.lang.ref.ReferenceQueue.remove(long) @bci=44, line=135 (Interpreted frame)
 - java.lang.ref.ReferenceQueue.remove() @bci=2, line=151 (Interpreted frame)
 - java.lang.ref.Finalizer$FinalizerThread.run() @bci=3, line=177 (Interpreted frame)

Locked ownable synchronizers:
    - None

Thread 4491: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - java.lang.Object.wait() @bci=2, line=503 (Interpreted frame)
 - java.lang.ref.Reference$ReferenceHandler.run() @bci=46, line=133 (Interpreted frame)

Locked ownable synchronizers:
    - None

Java信息输出:

Java System Properties:

java.runtime.name = Java(TM) SE Runtime Environment

java.vm.version = 23.7-b01

sun.boot.library.path = /usr/java/jdk1.7.0_17/jre/lib/amd64

hadoop.root.logger = INFO,console

java.vendor.url = http://java.oracle.com/

java.vm.vendor = Oracle Corporation

path.separator = :

file.encoding.pkg = sun.io

java.vm.name = Java HotSpot(TM) 64-Bit Server VM

sun.os.patch.level = unknown

sun.java.launcher = SUN_STANDARD

user.country = US

user.dir = /home/ravi

java.vm.specification.name = Java Virtual Machine Specification

java.runtime.version = 1.7.0_17-b02

java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment

os.arch = amd64

java.endorsed.dirs = /usr/java/jdk1.7.0_17/jre/lib/endorsed

line.separator =


VM Flags:

-Xmx4000m -Djava.net.preferIPv4Stack=true -Dhadoop.log.dir=//opt/cloudera/parcels/CDH-4.2.1-1.cdh4.2.1.p0.5/lib/hadoop/logs -Dhadoop.log.file=hadoop.log -Dhadoop.home.dir=//opt/cloudera/parcels/CDH-4.2.1-1.cdh4.2.1.p0.5/lib/hadoop -Dhadoop.id.str= -Dhadoop.root.logger=INFO,console -Djava.library.path=//opt/cloudera/parcels/CDH-4.2.1-1.cdh4.2.1.p0.5/lib/hadoop/lib/native -Dhadoop.policy.file=hadoop-policy.xml -Djava.net.preferIPv4Stack=true -Xms256m -Dhadoop.security.logger=INFO,NullAppender

0 个答案:

没有答案