system metrics

有时候你会用top/htop查看一下当前系统的负载,会用 free -m查看下内存的容量,抑或 cat /proc/xxxx 查看详细的记录,但这些metrics总搞不太明白,查了一下,记载这里。

  • top
    image.png

  • free -m
    image.png

load

如图中显示:load average: 2.16, 2.22, 2.14 三个值:average: 1min,5min,15min

load 表示当前cpu的负载,以某一时刻为例,单cpu(逻辑核)上运行态进程数为1,等待队列里的就绪态进程数为2,则当前该cpu负载为:1+2=3;

但由于cpu上进程状态转换很快,load 便用了统计平均值。统计时间为过去的1min,5min,15min。

参考:Understanding system load and load averages

cpu

如图中所示:%Cpu(s): 13.2 us, 6.8 sy, 0.0 ni, 79.5 id, 0.3 wa, 0.0 hi, 0.2 si, 0.0 st
数据格式:百分比,表示占用cpu时间的百分比

  • us: user 用户进程;
  • sy: system 内核进程;
  • ni: nice 一个可以用于设置运行优先级的程序;
  • id: idle 空闲;
  • wa: wait 等待I/O;
  • hi: hardware interrupt 硬件中断;
  • si: software interrupt 软件中断;
  • st: steal Steal time is the percentage of time a virtual CPU waits for a real CPU while the hypervisor is servicing another virtual processor. 详见

参考:Understanding CPU statistics

mem

如图所示:total used free shared buff/cache available

  • total: 总的内存量(由于系统内核及其它占用导致少于实际物理内存量);
  • used: 已经被占用的内存量;
  • free: 处于完全 free 的内存量;与 buff/cache 相比
  • buff/cache: 为disk block分配的读写缓冲区,可被其它程序利用;

buffer用于缓冲硬盘文件块的一些元数据,Cache则仅能缓冲数据

  • available: 处于可用状态的内存;
    它们的关系实际是:total = used + free + buff/cache;free+buff/cache中包含了 available

  • Swap: 属于硬盘空间,用于在mem不足时,进行交换;

参考:

更多内容可关注本人博客:老香椿(https://laoxiangchun.cn/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值