02 say Basics: in the end should be how to understand the "load average"

Study notes:
First, what is the average load
correctly defined: the unit of time, the system is in a running state and the average number of processes that can not be interrupted state.
Error Definitions: cpu usage per unit time.
It can be a process running state: is being used or is waiting cpu cpu process, i.e., the command ps aux STAT process state in the R
non-process interruption state: in the process of the key processes in the kernel mode, and can not be interrupted, such as waiting hardware IO response, ps command process D state of
the ideal state: there is an active process on each cpu, that is, the average number of load equal to the number of cpu
overload experience: the average load is higher than 70% of the number of cpu time

Second, the relevant command
cpu Audit: lscpu, grep 'model name' / proc / cpuinfo | wc -l
show average load: uptime, top, shows the most recent order of 1 minute, 5 minutes, 15 minutes, can be seen from the trend of the average load
watch - d uptime: -d highlights the changing regional
strees: pressure measurement command, - cpu cpu pressure measurement option, -i io pressure measurement options, -c number of process pressure measurement options, - timeout execution time
mpstat: multi-core cpu performance analysis tool, -P ALL monitor all cpu
pidstat: process performance analysis tool, -u displays cpu utilization

Third, the average difference between the load and cpu usage
CPU usage: statistical unit of time cpu busy situation
situation 1: CPU-intensive processes, CPU usage and load averages are basically the same
situation 2: IO-intensive process, increase average load, CPU usage does not necessarily increase
Case 3: a large number of processes waiting for the CPU scheduler, the average increase in load, CPU usage also increased

Fourth, the average load is too high, how to tune
tool: stress, sysstat, yum to install
1. CPU-intensive process of case:

watch -d uptime: look at the average load, dynamic display load

mpstat -P ALL 5: -P ALL represent monitor all CPU, 5 represents a data refresh every five seconds to see if there is a cpu% usr will be high, but it should be low iowait

pidstat -u 5 1: output a set of data every five seconds, which process observation% cpu high, but the% wait is very low, very likely that this process leads to high cpu Biao
2. IO-intensive process of case:

watch -d uptime: Look at the average load, dynamic display the load
mpstat -P ALL 5:% iowait see if there is a high cpu, but also a higher% usr
pidstat -u 5 1: which process high observation% wait , but also a high% CPU
3. process a large number of case:

watch -d uptime: Look at the average load, dynamic display the load
pidstat -u 5 1:% wait to see if that process has a lot higher

Guess you like

Origin www.cnblogs.com/xiaobao2/p/11592270.html