KB Article #163027
Find High CPU Using Threads
Problem
-- What is needed for a root cause analysis prior to restarting the application if a high CPU usage is seen?
Resolution
1) Capture all Interchange logs. If logs are saved in the default location, use the diagnose tool found at [installDir]/Interchange/tools to create a zip containing the basic information (bin, conf, logs and site folder).
2) Find the java thread that causes the high CPU utilization, this differs between the OS Java is running on:
- Find the process ID that has the high CPU utilization, via top command
- Solaris:
- Issue "prstat -L -p [PID] 1 1" and capture the output
- PROCESS/LWPID correcsponds to Light Weight Process ID (Java thread ID)
- Issue "pstack" command and capture the output
- Generate thread dumps of all java processes of the Interchange application by using the "kill -3 [PID] command. Take three thread dumps for each process, each one minute apart
- Convert the Java Thread ID from decimal to Hexadecimal
- Search the thread dump for a corresponding nid = [Java Thread ID in HEX]
- issue "top -Hc"
- This will not only show Java processes, but also all Java threads
- Capture the output at least three times after the top refreshed the screen
- Generate thread dumps of all java processes of the Interchange application by using the "kill -3 [PID] command. Take three thread dumps for each process, each one minute apart
- It is important that each set of screenshots and thread dumps are taken at the same time
- Convert the [pid] of the thread with the highest CPU utilization from decimal to hexadecimal
- Search the thread dump for a corresponding nid = [PID in HEX]
- Issue "ps -mp [Java PID] -o THREAD" and capture the output
- Find TID of the thread with the highest CP value
- Generate thread dumps of all java processes of the Interchange application by using the "kill -3 [PID] command. Take three thread dumps for each process, each one minute apart
- Convert the TID decimal value to hexadecimal
- Search the thread dump for a corresponding nid = [TID in HEX]
- Download and install Microsoft's "Process Explorer": http://technet.microsoft.com/en-us/sysinternals/bb...
- For Interchange 5.10.0 and later, download and install the JDK corresponding to the JRE used by Interchange (for 5.10.x that is 1.6)
- Use ProcessExplorer to find the java.exe with the highest CPU
- Right-click on the Java.exe and select "Properties"
- Go to the "threads" tab and order by CPU, capture the output
- Generate thread dumps of all java processes of the Interchange application by using the Java JDK's "jstack [pid] >> PID[pid].dmp" command. Take three thread dumps for each process, each one minute apart. Please note that if you logged in via RDP, you might need to connect using mstsc /admin or mstsc /console (depending on OS version). The jstack needs to be issued by the same user that started the Java process, the Microsoft tool PsExec might be needed to accomplish this. Downloadable at http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx.
- Search the thread dump for the TID captured in the ProcessExplorer