The solution to excessive occupation of cpu by tomcat
Tomcat CPU usage is often encountered at work, and the following solutions are available for this situation.
jps --> View Java's progress
top -Hp pid --> According to the process number (pid) obtained by jps, view all threads of java process, and you can see all threads occupying CPU, -H is used to display all threads of a certain process.
printf "%x\n" 9733 --> Convert the thread number found in step 2 to hexadecimal for easy jstack viewing
jstack pid |grep 2605 --> 2605 is the number after converting 9733 to hexadecimal in step 3, because the thread number displayed by jstack is expressed in hexadecimal!
jstack is used to display all Java threads running, jstack pid| grep 2605 means to display only the running information of a java thread. In this way, you can display the method that this thread is running and leave it to the developer