Find out how a process in a Tomcat program consumes high CPU

Source: Internet
Author: User
Tags tomcat
First, the problem found

In a test or production environment, when the Tomcat CPU is found to remain at a certain high level, the program processing is definitely out of the question, the next step is to find out why. The following figure shows that tomcat with a process ID of 8051 occupies a high CPU.

second, positioning problems

Use the command ps-mp 8051-o thread,tid,time to see which threads in this process use a higher CPU, and browse to view thread 8327 that is taking up more CPU.

Convert the required thread ID to 16 binary format

Use the command printf "%x\n" tid, as shown below

Print thread stack information

Using the command jstack PID |grep tid-a 60, view the stack information as shown in the location of the program


4. Modify the program, test and re-release it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.