1, check the system CPU load and utilization of the command is: Top Vmstat
Top command: View CPU usage at the process level.
Vmstat command: View system-level CPU usage.
The following is a detailed illustration to analyze:
The 1.1 Top command can view the CPU, memory, and other resources used by the process.
During the top command, you can control the display by using the internal commands of top.
1-turn on or off show all CPU usage details
L-Turn off or turn on the representation of the first line top information in the first section
T-turn off or turn on the second line of the first section Cpus information representation of the Tasks and the third row
M-Turn off or turn on the first part of the four-line Mem and fifth line Swap information representation
N-the list of processes in the order of the PID size (the third part is described later)
P-List of processes in the Order of CPU Utilization (third part)
M-Arrange the list of processes in the Order of Memory occupancy (Part III)
H-Show help
N-Set the number of processes displayed in the process list
Q-Exit Top
S-Change the screen update frequency (input number)
1.2 Vmstat command to see the overall system of the CPU, the use of memory
R: Represents the thread that the CPU in the system waits to process. Because the CPU can only process one thread at a time, the larger the value, the more often it indicates that the system is running slower.
US: Percentage of CPU time consumed by user mode. When the value is high, the user process consumes more CPU time, for example, if the value exceeds 50% over a long period, the program algorithm or code needs to be optimized.
Sy: Percentage of CPU time consumed by kernel mode.
Wa:io the percentage of CPU time that is waiting to be consumed. When this value is high, the IO wait is more serious, which may be caused by a large number of disks for random access, or it may be a bottleneck in disk performance.
ID: Percentage of CPU time in idle state. If the value continues to be 0 and the SY is twice times that of us, it usually indicates that the system is facing a shortage of CPU resources.
2. Detailed operation process consumes high CPU and high CPU load
2.1 Use top to directly terminate CPU-intensive processes:
The top command looks at processes that are CPU intensive, enters "K" directly, and then enters the PID number of the corresponding process to terminate the process.
2.2 With top view CPU is idle, but the load is relatively high situation:
Load average is an evaluation of the CPU load, the higher the value, the longer the task queue, the more tasks waiting to be performed.
When this happens, it may be caused by a zombie process. You can see if the D-state process exists through the directive PS-AXJF.
The D state refers to the non-interruptible sleep state. The process of this state cannot be killed, nor can it exit itself. It can only be resolved by restoring its dependent resources or rebooting the system.
Processing ideas for high CPU usage or high load on Linux