1. View the uptime of the system load
Uptime highlights the change area watch -d uptim
2. CPU performance analysis tool mpstat
Field Meaning
- %user Indicates the CPU time (%) in user mode, excluding the nice value of negative process (usr/total)*100
- %nice In internal time, nice is the negative CPU time (%) (nice/total) x 100
- %sys Specifies the kernel time (%) (system/total)*100
- % ioWAIT Indicates the DISK I/O wait time (%) (iowait/total) x 100
- % irQ Specifies the hard interrupt duration (%) (IRQ /total)*100 in the internal time segment
- %soft Indicates the soft interrupt time (%) (softirq/total)*100
- % IDLE Indicates the time that the CPU is idle for any reason other than waiting for disk I/O operations. Idle Time (%) (idle/total)*100
Mpstat -p ALL 5 # -p ALL indicates that ALL cpus are monitored. The following number 5 indicates that a group of data is output after an interval of 5 seconds
3. Process performance analysis tool Pidstat
Common parameters:
- -u: displays CPU usage statistics of each process
- -r: displays the memory usage statistics of each process
- -d: displays THE I/O usage of each process
- -p: specifies the process NUMBER
- -w: displays the context switchover of each process
- -t: displays additional information in addition to the statistics of the thread that selects the task
- – T {TASK CHILD | | ALL} this option specifies the pidstat monitoring. TASK indicates an independent TASK. The CHILD keyword indicates statistics about all threads in the reporting process. ALL indicates reporting individual tasks and ALL threads under the task. Note: Global statistics for tasks and child threads are independent of the pidstat option. These statistics do not correspond to the current statistical interval and are collected only when the child thread kills or completes.
- -v: indicates the version number
- -h: Shows all activities on one line so that other programs can easily parse them.
- -i: indicates the CPU usage/number of cores of a task in the SMP environment
- -l: displays the command name and all parameters
Pidstat -u 5 1 # Output a group of data after an interval of 5 seconds
Pidstat -w 5 # Displays context switching for each process
Field description: CSWCH/S: indicates the voluntary context switchover times per second. NVCSWCH/S: indicates the involuntary context switchover times
4. Use the statistical tool VMstat for the overall situation of the system
Parameter description: Procs: r: number of processes in the running queue B: number of processes waiting for I/OS Memory: SWPD: used virtual Memory size Free: available Memory size buff: used Memory size for buffering cache: So: size of memory written to the Swap area per second IO: (the block size of current Linux versions is 1024bytes) bi: number of blocks read per second bo: number of blocks written per second system: in: Interrupts per second, including clock interrupts. 【 Interrupt 】 cs: number of context switches per second Sy: indicates the system time. Id: indicates the idle time (including the I/O wait time), which is the idle time of the CPU. Expressed as a percentage. Wa: waiting I/O time Note: If r is always greater than 4 and ID is always less than 40, the CPU is heavily loaded. If bi and BO are not equal to 0 for a long time, the memory is insufficient. If disk is not always equal to 0 and the queue in B is greater than 3, I/O performance is poor.