vmstat工具概述
Procs
r: The number of processes waiting for run time.
b: The number of processes in uninterruptible sleep.
Memory
swpd: the amount of virtual memory used.
free: the amount of idle memory.
buff: the amount of memory used as buffers.
cache: the amount of memory used as cache.
inact: the amount of inactive memory. (-a option)
active: the amount of active memory. (-a option)
Swap
si: Amount of memory swapped in from disk (/s).
so: Amount of memory swapped to disk (/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, shown as zero.
5.1.2 在vmstat中得到什么?
r(运行队列)
pi(页导入)
us()
sy()
id()
wa()
5.1.3 识别cpu瓶颈
1. 显示IBM AIX和HP/ux的cpu数量:lsdev -C|grep Process | wc -l
2. 显示solaris的cpu数量:psrinfo -v |grep "Status of processor" |wc -l
3. 显示linux的cpu数量:cat /proc/cpuinfo|grep processor | wc -l
在b列中出现非0表示cpu瓶颈;
解决方案:
1. 给服务器增加更多的cpu
2. 通过讲大规模的批处理任务安排在不繁忙的时期执行,来均衡系统任务
3. 调整已有任务的分派优先级
5.1.4 使用vmstat识别频繁使用的cpu
us+sy接近100,只能表示cpu正在满负荷运行,唯一能够指出cpu瓶颈的度量是运行队列r值超过了服务器上的cpu数量
5.1.5 识别ram内存瓶颈
1. 显示DEC-UNIX上的ram大小:uerf -r 300 | grep -i mem
2. 显示hp/ux上的ram大小:dmesg
3. 显示aix上的ram大小:lsdev -C|grep mem , lsattr - E1 mem0
4. 显示solaris的ram大小: prtconf |grep -i mem
5. 显示linux的ram大小: free
6. 使用top工具查看ram,如下有807012k
top - 01:14:47 up 2 days, 13:03, 4 users, load average: 0.12, 0.07, 0.04
Tasks: 104 total, 1 running, 103 sleeping, 0 stopped, 0 zombie
Cpu(s): 1.8% us, 5.4% sy, 0.1% ni, 92.1% id, 0.7% wa, 0.1% hi, 0.0% si
Mem: 807012k total, 787844k used, 19168k free, 16296k buffers
Swap: 524280k total, 23448k used, 500832k free, 594024k cached
7. 使用glance看内存
8. ram内存和交换内存
解决页导入问题的方案:
1>更小的sga 2>更多ram内存 3>减少ram需求
9. 在aix中检测潜在的i/o瓶颈
通过vmstat的wa来看
vmstat
最新推荐文章于 2025-04-07 09:15:00 发布