日期:2014-05-16  浏览次数:20580 次

linux下vmstat命令解析 (性能相关以及系统性能诊断)

[root@localhost ~]# vmstat 1 5

procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----

 r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa

 1  0      0 4886396 147552 2905036    0    0     1     4    4     3  0  0 100  0

 0  0      0 4886396 147552 2905036    0    0     0   228 4144  4103  1  1 98  0

 0  0      0 4886396 147552 2905036    0    0     0    88 1964  1286  0  0 99  0

 0  0      0 4886396 147552 2905036    0    0     0   100 2321  2007  1  0 99  0

 1  0      0 4886332 147552 2905036    0    0     0   156 2647  2265  1  0 99  0

[root@localhost ~]#

 

 

 

usage: vmstat [-V] [-n] [delay [count]]

              -V prints version.

              -n causes the headers not to be reprinted regularly.

              -a print inactive/active page stats.

              -d prints disk statistics

              -D prints disk table

              -p prints disk partition statistics

              -s prints vm table

              -m prints slabinfo

              -S unit size

              delay is the delay between updates in seconds.

              unit size k:1000 K:1024 m:1000000 M:1048576 (default is K)

              count is the number of updates.

 命令参数:

-a:显示活跃和非活跃内存

-f:显示从系统启动至今的fork数量 。

-m:显示slabinfo

-n:只在开始时显示一次各字段名称。

-s:显示内存相关统计信息及多种系统活动数量。

delay:刷新时间间隔。如果不指定,只显示一条结果。

count:刷新次数。如果不指定刷新次数,但指定了刷新时间间隔,这时刷新次数为无穷。

-d:显示磁盘相关统计信息。

-p:显示指定磁盘分区统计信息

-S:使用指定单位显示。参数有 k 、K 、m 、M ,分别代表1000、1024、1000000、1048576字节(byte)。默认单位为K(1024 bytes)

-V:显示vmstat版本信息。

vmstat是一个相当全面的性能分析工具,可以观察到系统的进程状态、内存使用、虚拟内存使用、磁盘的IO、中断、上下问切换、CPU使用等性能信息

 

 

   Procs

       r: The number of processes waiting for run time.(运行的和等待(CPU时间片)运行的进程数,这个值也可以判断是否需要增加CPU(长期大于