(二)Linux查看系统负载

一、查看系统负载

方法一: 查看系统负载

命令:uptime
20:32:10 up  9:22,  4 users,  load average: 0.00, 0.00, 0.00
注:load average: 0.00, 0.00, 0.00

方法二:查看系统负载

命令:w
20:31:05 up  9:21,  4 users,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     tty1     -                13:56   43:51   0.15s  0.15s -bash
root     pts/0    192.168.1.150    18:58    1:02m  0.10s  0.10s -bash
root     pts/1    192.168.1.150    19:47    0.00s  0.01s  0.00s w
root     pts/3    192.168.1.150    14:22    2:39m  0.01s  0.01s -bash

注: load average: 0.00, 0.00, 0.00

方法三:当前每隔10分钟打印一次系统负载

命令:sar –q –f /var/log/sa/sa*
19时17分26秒   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15
19时17分44秒         0       166      0.00      0.02      0.00

ldavg-1          # 系统1分钟前负载
ldavg-5          # 系统 5分钟前负载
ldavg-15         # 系统 15分钟前负载

方法四:查看系统负载

• 命令:top
• # 查看CPU个数
• 命令:top
• 终端:1
Tasks:  80 total,   1 running,  79 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:    508960k total,   475576k used,    33384k free,    14392k buffers
Swap:  2064376k total,   141052k used,  1923324k free,   127476k cached

注:0.0%hi,  0.0%si,  0.0%st

方法五:查看CPU每十分钟刷新一次

命令:sar
Linux 2.6.32-431.el6.i686 (localhost.localdomain)     2018年01月22日     _i686_    (1 CPU)

19时17分26秒     CPU     %user     %nice   %system   %iowait    %steal     %idle
19时17分44秒     all      0.00      0.00      0.17      0.06      0.00     99.77
平均时间:     all      0.00      0.00      0.17      0.06      0.00     99.77

CPU:all表示统计信息为所有 CPU的平均值。
%user:显示在用户级别(application)运行使用 CPU 总时间的百分比。
%nice:显示在用户级别,用于nice操作,所占用 CPU总时间的百分比。
%system:在核心级别(kernel)运行所使用 CPU总时间的百分比。
%iowait:显示用于等待I/O操作占用 CPU总时间的百分比。
%steal:管理程序(hypervisor)为另一个虚拟进程提供服务而等待虚拟 CPU 的百分比。
%idle:显示 CPU空闲时间占用 CPU总时间的百分比。

1.若 %iowait的值过高,表示硬盘存在I/O瓶颈
2.若 %idle的值高但系统响应慢时,有可能是 CPU等待分配内存,此时应加大内存容量
3.若 %idle的值持续低于1,则系统的 CPU处理能力相对较低,表明系统中最需要解决的资源是 CPU。
注:三个数值:1分钟内,5分钟内,15分钟内平均负载。
    • 注:1分钟内平均有多少个进程占用了cpu。
    • 负载低:负载值/CPU个数=小于1
    • 负载高:负载值/CPU个数=大于1
    • 注:查看cpu个数cat /proc/cpuinfo
processor    : 0#cpu 个数 0代表1
vendor_id    : GenuineIntel
cpu family    : 6
model        : 60
model name    : Intel(R) Core(TM) i5-4200M CPU @ 2.50GHz
stepping    : 3
cpu MHz        : 2494.299
cache size    : 3072 KB
fdiv_bug    : no
hlt_bug        : no
f00f_bug    : no
coma_bug    : no
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss nx pdpe1gb rdtscp lm constant_tsc up arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm ida arat epb xsaveopt pln pts dts fsgsbase smep
bogomips    : 4988.59
clflush size    : 64
cache_alignment    : 64
address sizes    : 40 bits physical, 48 bits virtual
power management:
posted @ 2022-06-07 16:36  比特边界  阅读(416)  评论(0编辑  收藏  举报