Get the App
SLTechnology News&Howtos  ›  Network Security  › 

The solution to excessive occupation of cpu by tomcat

Shulou Source: shulou.com Published: 2022-06-01 02:23:50 10月04日 Update

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

Tags: Thread process situation binary run method current method high level function information meaning number this method processing work development Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Linux Microsoft Huawei Shulou Technology