linux 可观测性
名称:
vmstat - 报告虚拟内存(statistics)统计数据
命令语法:
vmstat [options] [delay [count]]
命令描述:
报告进程、内存、分页、块IO、traps、磁盘和cpu活动的信息。命令的第一行展示了自最后一次启动以来指标的平均值
参数:
[delay] 更新指标的间隔时长(秒)
[count] 总过更新的次数。如果指定了[delay] 而不指定[count]则表示无限次
-a 展示活跃和非活跃的内存 举例: vmstat -a
-m 展示slatinfo信息 举例:vmstat -m
[root@ecs-ali ~]# vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
1 0 0 91848 119812 1080588 0 0 1553 931 10 8 5 3 88 4 0
Procs
r: The number of runnable processes (running or waiting for run time).
b: 在等待i/o完成的进程数
Memory
swpd: 交换分区的使用量
free: 空闲物理内存量
buff: buffer使用量
cache: cache使用量
inact: 非活跃的内存量. (-a option)
active: 活跃内存量. (-a option)
Swap
si: 从磁盘交换出的内存量 (/s).
so: 交换到磁盘的内存量(/s).
IO
bi: Blocks received from a block device (blocks/s).
bo: Blocks sent to a block device (blocks/s).
System
in: The number of interrupts per second, including the clock.
cs: The number of context switches per second.
CPU
These are percentages of total CPU time.
us: Time spent running non-kernel code. (user time, including nice time)
sy: Time spent running kernel code. (system time)
id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time.
wa: Time spent waiting for IO. Prior to Linux 2.5.41, included in idle.
st: Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown.
对于内存应该关注si
和 so
,正常情况下物理内存应该可以容纳进程所需数据,因此不存在数据在交换分区的换入换出。
/proc/meminfo
/proc/stat
/proc/*/stat
磁盘调度
[root@ceph-mon2 docker]# cat /sys/block/sda/queue/scheduler
noop [deadline] cfq