Linux-tomcat Process CPU Usage 100% reason analysis __linux

Source: Internet
Author: User
Tags tomcat

When Tomcat starts in Linux, we simply check to see if the application is properly accessible to determine if Tomcat is booting properly. In general this is no problem, but sometimes we find that when Tomcat has been in use for a while, the CPU or memory surge begins to appear. At this point, looking at the Tomcat log may not be able to see the valid information, so it is necessary to understand the relevant tools provided by Linux and JDK.

1, view memory and CPU using a higher process information

Enter top and we can see the following information


2, if we want to see the PID 3583 process information, you can perform

Top-h-P 3582

Description: 3582 for the process ID, a process can have multiple threads. This basic knowledge of popular science to the small partners just getting started.

At this point, we can see the related thread information below process 3582. Threads that occupy more resources are ranked in the first few. OK, screenshot below.


3, since all found thread consumption information, but we have not found the reason. Don't worry, let's take a look at the stack information for a thread,

such as a thread with a PID of 3590. As for why to look at the stack of information, this does not need me to say more. If it is not clear, it is not expected to contact the Dongdong. OK, back to the point. To see the stack information for a Java thread, of course we have to use the Jstack tool that the JDK brings.

How to use:

Jstack [Process] | GREP-A 10 [Thread's 16-in-system]

-A 10 indicates that the following 10 lines of the row are found. 3590 Convert to 16 e06 with calculator, note that the letter is lowercase.

OK, let's execute the following command.

Jstack 3582|grep-a E06

After the execution, we will see the stack information as shown in the figure, at which point we will be able to make our own judgments with the information associated with thread prompts.



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.