ITPub博客

首页 > Linux操作系统 > Linux操作系统 > [20180109]使用vmstat监测性能的输出解析

[20180109]使用vmstat监测性能的输出解析

原创 Linux操作系统 作者:lfree 时间:2018-01-10 09:53:07 0 删除 编辑

[20180109]使用vmstat监测性能的输出解析.txt

在linux/unix下,常用vmstat作为系统性能监测工具。常用用法如下
# vmstat 1 100
--//我一般习惯使用-w参数,这样支持宽行显示.效果要好一些.
# vmstat -w 1 100
--//表示以1秒为间隔,做相关参数的采样,一共100次。输出范例如下:

# vmstat -w 1 100
procs -------------------memory------------------ ---swap-- -----io---- --system-- -----cpu-------
r  b       swpd       free       buff      cache   si   so    bi    bo   in   cs  us sy  id wa st
0  1        152      44424     255588    5322852    0    0     6    14    0    0   0  0  98  1  0
1  0        152      44440     255588    5322852    0    0     0     4 1192  228   0  0 100  0  0
0  0        152      44440     255588    5322852    0    0     0    36 1182  204   0  0  99  1  0
0  0        152      48456     255588    5318348    0    0     0    36 1220  269   1  0  97  1  0
0  0        152      48704     255588    5318244    0    0     0   172 1461  453   0  0  93  7  0
0  1        152      48704     255588    5318244    0    0     0    88 2800 1305   2  1  95  2  0
0  0        152      49108     255592    5318244    0    0     0    36 1189  217   0  0  99  1  0
0  0        152      48604     255592    5318244    0    0     0   108 1554  498   1  1  95  2  0
1  0        152      48604     255592    5318244    0    0     0    44 1243  281   0  0  98  2  0
0  0        152      48720     255592    5318244    0    0     0    60 1816  691   1  0  97  2  0
0  0        152      48712     255592    5318244    0    0     0   192 3094 1580   2  1  94  3  0
0  0        152      48712     255592    5318244    0    0     0    36 1337  321   0  0  99  1  0
0  0        152      48720     255592    5318244    0    0     0   116 1461  476   1  0  96  3  0
0  0        152      48720     255592    5318244    0    0     0    76 1315  321   0  0  98  2  0
0  0        152      48720     255592    5318244    0    0     0    44 2587 1235   2  1  96  1  0
1  0        152      47068     255592    5318244    0    0     0    76 3053 1576   3  2  93  2  0

--//注意第一行的输出,是系统启动至今总的统计的平均值(我的理解不知道是否正确)!!
--//其他列的解析:
procs 列
r: 当前在就绪队列中的进程,可以看做系统cpu资源利用饱和度的指标
b: The number of processes in uninterruptible sleep.

swap列
si(swapped in): 每秒交换进内存的内存大小
so(swapped out):每秒交换出磁盘的内存大小

--//如果这两项比较高,说明swap频繁,可能物理内存不足,或者一些进程占用内存异常.我遇到的多数情况没有使用hugepage.
--//或者开启了hugepage,但是数据库可能设置的原因.没有使用.导致浪费而出现的内存不足的情况.

io列
bi:每秒读入内存的数据量
bo:每秒写出到磁盘的数据量

--//如果这两项数值较高,说明磁盘IO的负载比较重.

System列
in: The number of interrupts per second, including the clock.
cs: 每秒上下文切换的次数

--//如果此数值较高,说明系统中上下文切换过于频繁,会导致系统性能下降。需要进一步确定造成的原因

CPU列
us: 运行非内核代码消耗的时间
sy: 运行内核代码消耗的时间
id: 系统空闲的时间
wa: IO等待消耗的时间

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.

--//充分了解这些细节,才能很好分析系统以及数据库问题.
--//实际以上内容来自网络,直接查询man vmstat也可以了解这方面内容。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-2149960/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    4006
  • 访问量
    7969672