vmstat学习

vmstat(virtual memory statistics)用于监控内存使用的工具
[root@oracle10g ~]# vmstat 5 2
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 643908  47124 233156    0    0     1     2    7    28  0  0 100  0
 0  0      0 643908  47124 233156    0    0     0     8 1008    60  0  0 99  0
间隔5秒,共收集两次
process
r   (runinng)在运行队列中等待的进程数
b    等待IO的进程数
memory
swpd    使用的虚拟内存的大小
free     空闲的物理内存大小
buffer  用作缓冲区的内存大小
cache  用作高速缓存的内存大小
swap
si    (swap in) 从磁盘交换到内存的交换页数量(kb/秒)
so   (swap out)从内存交换到磁盘的交换页的数量(kb/秒)
io
bi     (block in)发送到块设备的块数(块/秒)
bo    (bloxk out)从块设备接收的块数(块/秒)
system
in     (interrupt)每秒钟的中断次数,包括时钟中断
cs    (context switch)每秒钟上下文切换的次数
cpu
us     (user)用户进程使用的cpu时间(%)
sy      (system)系统进程使用的cpu时间(%)
id        (idle)cpu空闲时间按(%)
wa      (wait)等待IO所消耗的cpu时间(%)
st          从虚拟设备中获得的时间(%)
1、内存监控
对于内存监控要关心的是swpd、free、buffer、cache、si和so,尤其要注意的是free、si和so,
当free很小并且si和so很大时表明内存成为了性能的瓶颈。
2、cpu监控
主要监控运行队列、cpu使用率和上下文切换,正常来讲每个CPU的运行队列不会超过3个,如果是双核就不要超过6个。cpu使用中如果id(idle)长时间小于10%,则表明cpu资源紧张;上下文切换,cs(context switch)过大也会消耗大量cpu资源。
vmstat只能总体查看cpu的使用情况,如果多cpu系统就不能看出每个cpu使用情况,则使用mpstat可以查看每个cpu的使用情况:
[root@etl ~]# mpstat -P ALL
Linux 2.6.32-220.el6.x86_64 (etl)  2013年03月29日  _x86_64_ (6 CPU)
17时11分40秒  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
17时11分40秒  all    0.40    0.00    0.26    0.02    0.00    0.00    0.00    0.00   99.32
17时11分40秒    0    0.36    0.00    0.31    0.02    0.00    0.00    0.00    0.00   99.31
17时11分40秒    1    0.44    0.00    0.29    0.02    0.00    0.01    0.00    0.00   99.25
17时11分40秒    2    0.40    0.00    0.28    0.01    0.00    0.00    0.00    0.00   99.30
17时11分40秒    3    0.46    0.00    0.23    0.01    0.00    0.00    0.00    0.00   99.29
17时11分40秒    4    0.42    0.00    0.22    0.02    0.00    0.00    0.00    0.00   99.34
17时11分40秒    5    0.35    0.00    0.22    0.02    0.00    0.00    0.00    0.00   99.41
%usr  运行用户进程所占用的cpu时间
%nice  用户进程的nice操作所占用的cpu时间
%sys  系统进程所占用的cpu时间
%iowait  io等待所占用的cpu时间
%irq    硬中断所占用的cpu时间
%soft  软中断所占用的cpu时间
%steal  虚拟设备所占用的cpu时间
%idle   cpu空闲时间
intr /s   每秒钟处理的中断次数
 
 
 
 
 
 

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

转载于:http://blog.itpub.net/23655288/viewspace-757429/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值