Monitor Linux command
Four main indicators are monitored: cpu mem io load average (load)
1. Cpu
Use the sar-u or sar-u 55 commands to view CPU: (yum install sysstat needs to be installed)
User
System
If iowait is persistently high, there is a bottleneck in disk io. Solution: 1. Replace a better disk 2. The procedure is not handled properly and needs to be investigated
2. Load average (load)
Use the top command to view:
The sum of processes being processed by cpu + waiting for cpu processing over a period of time
1 minute, 5 minutes, 10 minutes
Generally focus on 5 minutes, 10 minutes.
Ideal laod average
< cpu个数 * 核数 * 0.7 cpu个数:grep 'physical id ' /proc/cpuinfo | sort -u 核数:grep 'core id ' /proc/cpuinfo | sort -u | wc -l 按住键盘上的数字1,可以看到cpu0、cpu1、cpu2的资源占用(0,1,2表示有3个cpu) 几个cpu一般来说比较均衡,cpu0相当于是带头大哥,如果它占的很高,这是个问题,需要解决 3. mem 使用 sar -r 或者 sar -r 5 5 命令查看内存 linux潜在规则:尽可能的使用内存来提高io的效率 free used cache buffer 总的物理内存=used+free 实际可用的物理内存=free+buffer+cache 实际使用的物理内存=used-buffer-cache %memused:可以直接看出用了多少,还剩多少 如果剩余的内存不多,那么需要加内存,或者程序问题(比如内存泄漏等) 4. io 使用 sar -d 或者 sar -d 5 5 命令查看io avgqu-sz:io队列的长度,队列越长,io压力越大 await: io操作的等待时间 ms -- 了解? svctm: 被服务的时间 越接近await,等待的时间越少,io效果越好 -- 了解? util: io繁忙程度 持续>80%, need to be investigated because of what is busy