Tomcat+java Web program continues to account for CPU problem debugging

Source: Internet
Author: User

Original source:Http://www.blogjava.net/hankchen

Phenomenon:

Deploying Java Web Applications in Tomcat, the Java process that appeared after Tomcat for a period of time continued to consume up to 100% of the CPU, causing Web program access to be blocked.

Possible cause Analysis:

It is possible that the program is actually doing data calculations, or the program enters a dead loop;

Workaround:

1. First, use top to view the process ID that consumes the CPU

2. Re-use Ps-ef | grep PID locates the specific process body, such as whether it is a tomcat-initiated Java program

3, with PS-MP pid-o thread,tid,time print out the process of the thread consumption of CPU

Found the most time-consuming thread 28802, taking up CPU time two hours faster!

4. Next, convert the required thread ID to 16 binary format:

printf "%x\n" tid

5. Finally, the stack information of the print thread:

Jstack PID |grep tid-a 30

Locate the code that has the problem and analyze the code snippet in the specific function for possible dead loops.

Typically, the problem occurs in a loop code fragment, such as while.

Tomcat+java Web program continues to account for CPU problem debugging

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.