1. ps -ef|grep java
查进程ID
root 8514 1 0 Mar04 ? 01:37:59 /usr/java/bin/java -Djava.util.logging.config.file=/data1/weibo_coral/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -server -Xms1000m -Xmx1000m -Xmn512m -Xss256m -DServer=mblog -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+UseParallelOldGC -XX:+UseAdaptiveSizePolicy -XX:ParallelGCThreads=10 -XX:+PrintFlagsFinal -XX:+PrintCommandLineFlags -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -Dconsole.port=999 -Xloggc:../gclogs/gc.log.20150304_194247 -agentlib:jdwp=transport=dt_socket,address=11789,server=y,suspend=n -Djava.endorsed.dirs=/data1/weibo_coral/endorsed -classpath /data1/weibo_coral/bin/bootstrap.jar:/data1/weibo_coral/bin/tomcat-juli.jar -Dcatalina.base=/data1/weibo_coral -Dcatalina.home=/data1/weibo_coral -Djava.io.tmpdir=/data1/weibo_coral/temp org.apache.catalina.startup.Bootstrap start
2. ps -mp 8514 -o THREAD,tid,time
查出进程下线程信息,可以查出%CPU高,TIME长的线程ID(tid)
root 0.0 19 - futex_ - - 8583 00:00:00
root 0.0 19 - futex_ - - 8591 00:00:24
root 0.0 19 - futex_ - - 8592 00:02:38
root 0.2 19 - futex_ - - 8593 00:28:46
3.printf "%x\n" 8593
tid(8593)转化为十六进制2191
简单的解释下,jstack下这一串线程信息内容:
800 nid=0x7d9b waiting on condition [0x0000000046f66000]
"DboServiceProcessor-4-thread-295" daemon prio=10 tid=0x00002aab047a9800 nid=0x7d9b waiting on condition [0x0000000046f66000]
nid:对应的linux操作系统下的tid,就是前面转化的16进制数字
查进程ID
root 8514 1 0 Mar04 ? 01:37:59 /usr/java/bin/java -Djava.util.logging.config.file=/data1/weibo_coral/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -server -Xms1000m -Xmx1000m -Xmn512m -Xss256m -DServer=mblog -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+UseParallelOldGC -XX:+UseAdaptiveSizePolicy -XX:ParallelGCThreads=10 -XX:+PrintFlagsFinal -XX:+PrintCommandLineFlags -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -Dconsole.port=999 -Xloggc:../gclogs/gc.log.20150304_194247 -agentlib:jdwp=transport=dt_socket,address=11789,server=y,suspend=n -Djava.endorsed.dirs=/data1/weibo_coral/endorsed -classpath /data1/weibo_coral/bin/bootstrap.jar:/data1/weibo_coral/bin/tomcat-juli.jar -Dcatalina.base=/data1/weibo_coral -Dcatalina.home=/data1/weibo_coral -Djava.io.tmpdir=/data1/weibo_coral/temp org.apache.catalina.startup.Bootstrap start
2. ps -mp 8514 -o THREAD,tid,time
查出进程下线程信息,可以查出%CPU高,TIME长的线程ID(tid)
root 0.0 19 - futex_ - - 8583 00:00:00
root 0.0 19 - futex_ - - 8591 00:00:24
root 0.0 19 - futex_ - - 8592 00:02:38
root 0.2 19 - futex_ - - 8593 00:28:46
3.printf "%x\n" 8593
tid(8593)转化为十六进制2191
4.jstack 8514|grep 2191
打印出堆栈信息
"pool-2-thread-1" prio=10 tid=0x00007f0e5c012800 nid=0x2191 runnable [0x00007f0e5bffe000]简单的解释下,jstack下这一串线程信息内容:
800 nid=0x7d9b waiting on condition [0x0000000046f66000]
"DboServiceProcessor-4-thread-295" daemon prio=10 tid=0x00002aab047a9800 nid=0x7d9b waiting on condition [0x0000000046f66000]
nid:对应的linux操作系统下的tid,就是前面转化的16进制数字