1.1 系统io情况
iostat [ -c | -d ] [ -k ] [ -t ] [ -V ] [ -x [ device ] ] [ interval [ count ] ]
其中,-c为汇报CPU的使用情况;
-d为汇报磁盘的使用情况;
-k表示每秒按kilobytes字节显示数据;
-t为打印汇报的时间;
-v表示打印出版本信息和用法;
-x device指定要统计的设备名称,默认为所有的设备;
interval指每次统计间隔的时间;count指按照这个时间间隔统计的次数。
l 经验分析
如果磁盘显示长时间的高reads/writes,
并且磁盘的percentage busy (%b)也远大于5%,
同时average service time (svc_t)也远大于30 milliseconds,
监控IO Wait
bash-2.03# iostat -xts 2
extended device statistics tty
device r/s w/s kr/s kw/s wait actv svc_t %w %b tin tout
sd6 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 0
ssd0 0.0 2.1 1.8 16.8 0.0 0.0 6.9 0 1
ssd1 0.0 0.1 0.1 0.7 0.0 0.0 70.3 0 0
nfs1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0
extended device statistics tty
device r/s w/s kr/s kw/s wait actv svc_t %w %b tin tout
sd6 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 209
ssd0 0.0 3.0 0.0 24.0 0.0 0.0 5.0 0 1
ssd1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0
nfs1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0
extended device statistics tty
device r/s w/s kr/s kw/s wait actv svc_t %w %b tin tout
sd6 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 210
ssd0 0.0 1.5 0.0 12.0 0.0 0.0 7.6 0 1
ssd1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0
nfs1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0
1.1.2 监控io等待
iostat 1
如果wt过多,serv时间过程超过30毫秒,需要考虑
tty sd6 ssd0 ssd1 nfs1 cpu
tin tout kps tps serv kps tps serv kps tps serv kps tps serv us sy wtid
0 2 0 0 0 44 5 9 1 0 89 0 0 0 2 1 1 96
0 234 0 0 0 8 1 9 0 0 0 0 0 0 8 12 0 79
0 80 0 0 0 48 6 6 0 0 0 0 0 0 19 30 0 50
0 80 0 0 0 161 21 31 240 30 74 0 0 0 1 18 2 78
0 80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 100
0 81 0 0 0 88 10 4 0 0 0 0 0 0 6 9 1 84
0 80 0 0 0 16 2 6 0 0 0 0 0 0 24 24 0 52
设备类型 字段名 说明
终端 设备类型
tin 终端输入队列中的字符数
tout 终端输出队列中的字符数
磁盘 设备类型
bps 每秒块数
tps 每秒事务数
serv平均服务时间,以毫秒为单位
CPU设备类型
us 在用户模式下
sy 在系统模式下
wt 等待I/O
id 空闲
1.1.3 vmstat
如果disk经常不等于0,且在proc.b中的队列大于3,表示io性能不好。
bash-2.03# vmstat 2
procs memory page disk faults cpu
rbw swap free re mf pi po fr de sr s6 sd sd -- in sy cs us sy id
0 0 0 6093080 4373384 1 13 2 0 0 0 0 0 2 0 0 151 156 134 1 1 98
0 0 0 5916504 4649088 0 3 0 0 0 0 0 0 1 0 0 148 49 106 0 0 100
0 0 0 5916504 4649088 0 0 0 0 0 0 0 0 2 0 0 152 28 111 0 6 94
l 统计参数的描述下面是关于一些参数的描述:
procs
r-->在运行队列中等待的进程数
b-->在等待io的进程数
w-->可以进入运行队列但被替换的进程
memoy
swap-->现时可用的交换内存(k表示)
free-->空闲的内存(k表示)
buff : the amount of memory consumed by buffers (in KB by default)
inact : the amount of memory on the inactive list (in KB by default)
active: the amount of memory on the active list (in KB by default)
pages
re--》回收的页面
mf--》非严重错误的页面
pi--》进入页面数(k表示)
po--》出页面数(k表示)
fr--》空余的页面数(k表示)
de--》提前读入的页面中的未命中数
sr--》通过时钟算法扫描的页面
disk显示每秒的磁盘操作。s表示scsi盘,0表示盘号
fault显示每秒的中断数
in--》设备中断
sy--》系统中断
cy--》cpu交换
swap
si: the amount of memory paged in from disk (in KB/s by default)
so: the amount of memory paged out to disk (in KB/s by default)
io
bi: blocks sent out to a block device (in blocks/s)
bo: blocks received from a block device (in blocks/s)
system
in: the number of interrupts received (in interrupts/s)
cs: the number of context switches (in switches/s)
cpu表示cpu的使用状态
cs--》用户进程使用的时间百分比
sy--》系统进程使用的时间百分比
wa――》IO等待使用的时间的百分比
i d--》cpu空闲的时间
1.2 网络情况
1.2.1 网络连通问题ping
如果为timeout表示为不连通
如果time时间过长,比如达到了秒级别,表示网络延时很长
如果有时候通,有时候不通,表示网络负载重,有丢包
C:\Documents and Settings\Administrator>ping www.hao123.net
Pinging hao123.n.shifen.com [220.181.107.31] with 32 bytes of data:
Reply from 220.181.107.31: bytes=32 time=59ms TTL=56
Reply from 220.181.107.31: bytes=32 time=109ms TTL=56
Reply from 220.181.107.31: bytes=32 time=83ms TTL=56
Reply from 220.181.107.31: bytes=32 time=60ms TTL=56
1.2.2 网络负荷问题iostat
网络冲突严重,检查网络负载过大、网络配置不正确、硬件问题
collis/opkts>10%
丢包严重,物理线路是否有问题
Ierrs / Ipkts.>0.25%
bash-3.00$ netstat -i
Name Mtu Net/Dest Address Ipkts Ierrs Opkts Oerrs