Check the cup memory io usage under Linux, and the CPU usage is too high. The solution is mainly to analyze the slowdown of the project in our actual environment.

Insert picture description here

Top

Execute the top command to view the system performance of the whole machine, which is mainly the execution of cpu and memory.
Insert picture description here
Load average in the upper right corner (system load balancing) If the addition of the three values ​​divided by 100 is greater than 60%, it means that the system is under high pressure.

uptime

Insert picture description here

vmstat -n 2 3

View the execution status of the cup View a sample every two seconds View
Insert picture description here
Insert picture description here
all cpu core information: mpstart -P ALL 2 (sample every two s)
View the usage breakdown information of a single process using the cup: pidstat -u 1 -p 5101

Insert picture description here

free -m (check the system's memory in megabytes)

Insert picture description here

Insert picture description here
View the memory usage of a given process: pidstat -p process number -r sampling interval in seconds
Insert picture description here

Check the hard disk df -h -> (disk free h-> humans can understand)

Insert picture description here

View disk IO: iostat -xdk 2 3

Mainly look at the circled area

Insert picture description here
Disk IO of a single process
Insert picture description here

Analyze the problem of excessive CUP occupation

  1. First use the top command to find out which cup takes the highest. Found that it is our java program
  2. ps -ef or jps -l to further locate our pid
  3. Locate the specific thread or code ps -mp process number -o THREAD, tid, time.

Find the specific corresponding thread
Insert picture description here
4.jstack process ID | grep thread id (hexadecimal lowercase)-A60
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_36905956/article/details/105961709