The production of Java applications, CPU usage has been very high, often up to 100%, through the following steps to solve the perfect, share.
1.jps gets the PID of the Java process.
2.jstack PID >> java.txt Exports the thread stacks that the CPU consumes high processes.
3.top-h-P PID to see which thread of the corresponding process is consuming high CPU.
4.echo "OBASE=16; PID "| BC converts the PID of a thread to 16 binary.
5. In the second step of the exported Java.txt, look for the thread PID converted into 16 binary. Find the corresponding line stacks.
6. Analyze what is the business operation of high-load line stacks. Optimize the program and handle the problem.
This article is from the "Little Rookie" blog, please be sure to keep this source http://baishuchao.blog.51cto.com/12918589/1958965
Troubleshooting high CPU Usage for Java processes