Linux users can use the following steps to determine which of their Java threads is consuming the most CPU.
From your computer terminal:
1. First, find the Java process ID.
ps -ef |grep java
2. Use the Java process ID (PID) to pull the lightweight processes into a file named
ps -eLo pid,lwp,nlwp,pcpu,etime,args|grep <pid> > lwp.txt
3. Use the PID to generate a Java thread dump.
kill -3 <pid>
4. Choose the lightweight process (LWP) that is consuming the most CPU from the lwp.txt file created in step 2, and convert the LWP ID from decimal to hexadecimal using the tool of your choice (for example, binaryhexconverter.com).
Example: Convert LWP DEC 4235 to HEX 108B.
5. Search the thread dump created in step 3 for the hexadecimal LWP ID to find the Java thread that is consuming the most CPU.
6. If the problematic Java thread is part of AppDynamics, contact support for further assistance. If it is an application thread, contact your development/application team to debug the issue further.