Troubleshooting Java Daily 1

Source: Internet
Author: User

Issues with high CPU usage

Master some common commands jstack Jmap jps ps-ef et cetera

Top command View CPU usage PID as process number

Executive Ps-ef | grep 18201 finds a specific process

The company picture can not be disclosed, in order to replace this machine any process, this command will appear two results, the second is just executed "Ps-ef | grep 18201 "produces a

View all containers sudo docker ps-a

Enter the container sudo docker exec-it container ID bash

Use the top command again

Jstack Printing Stack Information

Sudo-u admin/xxx/java/bin/jstack-l >/localhost/stack.log

or Sudo-u admin/xxx/java/bin/jstack ' JPS |grep Bootstrap |awk ' {print $} ' >/localhost/stack.log

Note: 1. jstack requires absolute path

2.jstack is Jstack is a Java Virtual machine comes with a stack trace tool, be sure to go to the Java/bin directory to use the command

Analyze Jstack Logs

Execute TOP-H p process ID to get the specific thread ID

The thread ID is converted to 16, and the corresponding Nid is found in the Jstack log, for example nid=0x70, the thread is currently waiting on condition, and the stack information is the question of which line of code is found

    1. Deadlock,Deadlock (focus on)
    2. In execution,Runnable
    3. Waiting for resources,waiting on condition (focus)
    4. Waiting to get the monitor,waiting on Monitor entry (focus)
    5. Pause,Suspended
    6. Object Waits,object.wait () or timed_waiting
    7. Blocking,Blocked (Focus)
    8. Stop,parked .



Troubleshooting Java Daily 1

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.