How to locate Java threads with high CPU usage
Tools:
1
Jstack:jstack is used to print the Java stack information for a given Java process ID or core file or remote Debugging service, if it is on a 64-bit machine, you need to specify the option "-j-d64", The Jstack usage of Windows only supports the following way.
pidstat : pidstat is primarily used to monitor all or specified processes that consume system resources, such as CPU, memory, device IO, task switching, threading, and so on. Pidstat displays statistics from the start of the system startup at the first run, and then runs Pidstat displays statistics from the last time the command was run. Users can obtain the required statistics by specifying the number and time of the statistics.
top: or JPS find the Java process PID, or or ps-lfp pid
Use%CPU and time to determine the consumed thread tid
Find the TID, convert it to 16 binary, and then search in the file above (Jstack process ID > Ps.txt) to export, you can navigate to the specific thread, class.
2, or:
Jstack-l pid >/home/1.tdump
Again by looking at threads: pidstat-p PID (Java process id)-u-d-t-w-H 1 1000
Find the TID, convert it to 16 binary, and then search in the file above (Jstack process ID > 1.tdump) to export, you can navigate to the specific thread, class.
3, can download 1.tdump to local search
How to locate Java threads with high CPU usage