Correlating CPU usage from top output to a particular thread in the Java™ virtual machine (JVM™)

Technote (FAQ)
Problem
How to correlate a process ID (PID) from top output, to a thread in your javacore.txt file. Your javacore files provide only information about the state of a specific thread in the JVM. Therefore, correlating a PID from top output to a specific thread is very important in determining processing hangs or performance degradation.
Cause
When debugging CPU utilization problems on Linux systems, information from top output and ajavacore file provide valuable information about your problem.
Solution
This document provides information about correlating a PID from top output to a thread in a javacore file.

The following sample top output is for a high CPU condition:

PID
USER
PRI
NI
SIZE
RSS
SHARE
STAT
%CPU
%MEM
TIME
COMMAND
19099
root
25
0
433M
433M
48484
R
99.9
12.3
20:07
/opt/Web...
19440
root
15
0
2160
2156
1500
R
1.9
0.0
0:00
top
1
root
15
0
512
512
444
S
0.0
0.0
0:04
init

From the sample top output, you can see that PID 19099 is utilizing 99.9% of the CPU. Locate the javacore file that was generated at the same time asyour top output. To find the thread, perform a search within the javacore file for the PID showing high utilization of the CPU. In this example it would be PID 19099.

Following is an extraction example from the javacore file that was collected at the same time as the topoutput:

"Thread-1161" (TID:0x16510C18, sys_thread_t:0x51E78568, state:R, native ID:0x51B437) prio=5
at java.io.RandomAccessFile.read
at java.io.RandomAccessFile.readInt
at jet.connect.DbStringColumnBuffer.readValueFromFile
at jet.connect.DbColumnBuffer.readFromFile
at jet.connect.DbPage.read
at jet.connect.DbPage.readFromFile
at jet.connect.DbBuffer.$GQ
at jet.connect.DbBuffer.getPageOfTheRow
at jet.connect.DbBuffer.refreshRecord
at jet.connect.DbRecord.refresh
at jet.connect.jdbms.JDbResultSet.nextRecord
at
jet.server.schedule.CompletedTable.getCompletedTaskRecordsByTaskID

at
jet.server.jrserver.JRCompletedTaskTable.getCompletedTaskRecordsByTaskID

at cats.rpt.JREntThread.updateTaskStatus
at cats.rpt.JREntThread.run

Native Stack of ""Thread-1161"" PID 19099
-------------------------
pthread_sigmask at 4002A136 in libpthread.so.0
sysRead at 4038F041 in libhpi.so
JVM_Read at 4024EBBE in libjvm.so
readSingle at 403C614D in libjava.so
Java_java_io_RandomAccessFile_read at 403C5678 in libjava.so
457214B5

From this extraction, it is evident that "Thread-1161" is the cause for high CPU. You can now review the stack for the previous thread to find the cause of the problem.












Document Information

Product categories: Software, Application Servers, Distributed Application & Web Servers, WebSphere Application Server, Java SDK
Operating system(s): Linux
Software version: 3.5, 4.0, 5.0, 5.1, 6.0
Software edition: Edition Independent
Reference #: 1158192
IBM Group: Software Group
Modified date: 2004-02-04