操作系统性能调试---/O性能分析
上一篇 / 下一篇 2008-10-28 22:13:32 / 个人分类:Lunix 点滴
- 文件版本: V1.0
- 开发商: 本站原创
- 文件来源: 本地
- 界面语言: 简体中文
- 授权方式: 免费
- 运行平台: Win9X/Win2000/WinXP
1:衡量I/O闲忙程度的指标
sq-m E"D5N$H02:I/O资源成为系统性能的瓶颈的征兆51Testing软件测试网 `3b/\;P0D
3:哪些活动是占用I/O资源的大户?51Testing软件测试网GA_ KB3DP+r
4:利用iostat分析I/O的利用率51Testing软件测试网4]L8H}:hF7]l/P
5:利用SAR命令分析磁盘活动51Testing软件测试网n1|Y!R.Auy D
6:利用SAR命令分析缓冲区的活动51Testing软件测试网 h avDJI6}ra
7:利用SAR命令分析交换区的活动51Testing软件测试网F&Wl!iFP+y
8:利用GlancePlus分析系统的I/O活动情况
!c"y@#['y+w{4Zb09:对I/O需求密集型系统的性能调试51Testing软件测试网SK(E"t`N
)vfFT'r M|051Testing软件测试网n#Q)Q,g$[ anJ
衡量I/O闲忙程度的指标 51Testing软件测试网1Y%m eM2Fn M#i1k
6N|5pz Hfg051Testing软件测试网!\"L Lp `)|4^
下面是一些衡量I/O闲忙程度的经用指标:
"zB;n7W:{p051Testing软件测试网;dOu1h;Y;JPhF
磁盘利用率(disk utilization)51Testing软件测试网iX#R%} r$^
磁盘队列长度(disk queue length)51Testing软件测试网.MQm dZ5V7J Z
磁头/逻辑卷的读/写速率(read/write rates per spindle/logical volume)
&h9\-}:x+?Q0`q0原始I/O(raw I/O):主要用于数据库应用51Testing软件测试网Q;ZZa0b0Y
交换队列的长度(swap queue length)51Testing软件测试网)hAjr:rf
缓存命中率(buffer cache hit ratio)51Testing软件测试网 zNhv,| tO]
网络文件系统和无盘工作站速率(NFS and diskless rates(server))
A!~+])Lt9d&y%x JO051Testing软件测试网4\q_&H7g
I/O资源成为系统性能的瓶颈的征兆
*NSJi~Atm1G0
efx/_O_2j0
Xn~5[&}E:u0当I/O成为瓶颈时,会出现下面这些典型的症状:
*P3h2RQk/A051Testing软件测试网"z;uwW5t7W2U#KE
过高的磁盘利用率(high disk utilization)
rA`R(^0太长的磁盘等待队列(large disk queue length)51Testing软件测试网bY3?'m9E$_\/ag;U
等待磁盘I/O的时间所占的百分率太高(large percentage of time waiting for disk I/O)51Testing软件测试网K QY!FQm}(q5]
太高的物理I/O速率:large physical I/O rate(not sufficient in itself)
#{7b:i }Vjbu:Mu@U0过低的缓存命中率(low buffer cache hit ratio(not sufficient in itself))
$eM ~5e1W_0w%}~ ]0太长的运行进程队列,但CPU却空闲(large run queue with idle CPU)51Testing软件测试网%|mQ K2`2i)I.B
51Testing软件测试网f xS U7N
哪些活动是占用I/O资源的大户? 51Testing软件测试网E\H;bu[h
51Testing软件测试网#To&cX|d
;j3K!iG?\ \e0下面是一些占用大量I/O资源的活动:
$b6J2X2t2{%w(z0
NM/T P1qtiR0换页(paging):paging不仅会引起内存问题,还可能引起磁盘问题;51Testing软件测试网5{a\.H'H Xb Q
open,creat,and stat system calls:系统调用会引起大量的磁盘I/O;51Testing软件测试网*P8T G&{U] _E
multiuser I/O and random I/O51Testing软件测试网$m1m)p/IVS{%^3F{
relational database51Testing软件测试网X5ul#[ KtS
core dumps
T^,p f?)b t051Testing软件测试网gwD/})t9o)g
51Testing软件测试网F!sF fF3ZL
利用iostat分析I/O的利用率
~~K-A4B.uaen;X ?0
5D"\7`%Az?PWH+\0
L*c)f.z dV]0iostat - report I/O statistics
'pL|\lb0
'O"qe.QNdN B0iostat iteratively reports I/O statistics for each active disk on the system.51Testing软件测试网 Y,b{8I](i'B
B;c1p6X s/v0If two or more disks are present, data is presented on successive lines for each disk.51Testing软件测试网*FZ"@$c C
9v3J&Ug2Sg/W*qLm0With the advent of new disk technologies, such as data striping, where a single data transfer is spread across several disks, the number of milliseconds per average seek becomes impossible to compute accurately. At best it is only an approximation, varying greatly, based on several dynamic system conditions. For this reason and to maintain backward compatibility, the milliseconds per average seek ( msps ) field is set to the value 1.0.
8k&JZwG5|0
C0m_ X s7n$I0它的语法为:51Testing软件测试网,Z`'RE5fB7u3P$T4^~
uP9t:A5Zb%CZC0iostat [-t] [interval [count]]
)])Ox{'[_4U0
u+i%qK)`Cq0其选项的含义为:51Testing软件测试网*b }D(bL C^/N
t0` C T6lj0-t:Report terminal statistics as well as disk statistics.
{Wn!sGvE0interval: Display successive lines which are summaries of the last interval seconds. The first line reported is for the time since a reboot and each subsequent line is for the last interval only.
lI6pR^YR2Tq0count: Repeat the statistics count times.51Testing软件测试网$q+PaH+\:Xk/v4J+axp0k
对结果的分析:51Testing软件测试网&OmY%W&~#H
51Testing软件测试网K6z%Dl7N$s!NEG
通过查看bps列和sps列的值我们可以知道哪些磁盘比较忙,哪些磁盘比较闲。51Testing软件测试网R!f6E LY_
4Q1_#O2L#mXW(Qc051Testing软件测试网uVFzhh
利用SAR命令分析磁盘活动 51Testing软件测试网-vK,r.k,SWr7q e%?
TsS$c!o0Wv!m0
;Q#E;pD^k.Z,h*h0通过命令sar -d,我们可以分析系统中的每个磁盘和磁带的活动情况。
p.t g._ Vu0YY051Testing软件测试网J2~&c3Bt T:L
Report activity for each block device, e.g., disk or tape drive. One line is printed for each device that had activity during the last interval. If no devices were active, a blank line is printed.Each line contains the following data:
|v]$p.IQi2q|051Testing软件测试网%j-xu!}L%NkY
device:设备名;51Testing软件测试网j/AG"k#{P[bn
%busy: Portion of time device was busy servicing a request; statistics.51Testing软件测试网L9Z!vu vU}O
avque: Average number of requests outstanding for the device;
Fl^fh0r+w/s: Number of data transfers per second (read and writes) from and to the device;
8pZm0U7T?#t{#p0blks/s: Number of bytes transferred (in 512-byte units) from and to the device;51Testing软件测试网8R_7p#E;G
avwait: Average time (in milliseconds) that transfer requests waited idly on queue for the device;
XQ4M'NkC9_!Z6{ q0avserv: Average time (in milliseconds) to service each transfer request (includes seek, rotational latency, and data transfer times) for the device.51Testing软件测试网D/j#Y1h+z*ex
对结果的分析:51Testing软件测试网&d+N:No1G3G[
I |%l0f \2_0如果某个磁盘的%busy列的值大于50%,则说明该磁盘可能存在瓶颈;
#dA4Q1i(e5E0
gi^7w:qyP5b+s0`0如果某个磁盘的avwait珍的值大于avserv列的值,也说明该磁盘可能存在瓶颈;51Testing软件测试网jh2LSy SPhx6p
[0S*so}m0
e:J`3RS9F*SND0利用SAR命令分析缓冲区的活动 51Testing软件测试网9t ? Wt-Lig d!a
51Testing软件测试网q v F${&|c jg
51Testing软件测试网9o.m7w{ ?,w\K
通过命令sar -b,我们可以分析系统中的缓冲区的活动情况。51Testing软件测试网-S,@4j3HSR/B
51Testing软件测试网7Y%rm8qXi+? r9Ss
Report activity for each block device, e.g., disk or tape drive. One line is printed for each device that had activity during the last interval. If no devices were active, a blank line is printed.Each line contains the following data:
Y"PGWmTi051Testing软件测试网{TF Kwt;MA
bread/s Number of physical reads per second from the disk (or other block devices) to the buffer cache;51Testing软件测试网-m-|t"d'a#~"b!bjPi
bwrit/s: Number of physical writes per second from the buffer cache to the disk (or other block device);51Testing软件测试网}P.?l H/P2Y7r
lread/s: Number of reads per second from buffer cache;
x5It9Yev+z0lwrit/s: Number of writes per second to buffer cache;
LF!n'e@O c[0%rcache: Buffer cache hit ratio for read requests e.g., 1 - bread/lread;51Testing软件测试网z^P*R'Ps w
%wcache: Buffer cache hit ratio for write requests e.g., 1 - bwrit/lwrit;51Testing软件测试网~Y4]WsfK
pread/s: Number of reads per second from character device using the physio() (raw I/O) mechanism;51Testing软件测试网(G9n6TM4V#f(~v6P7@2B
pwrit/s: Number of writes per second to character device using the physio() (i.e., raw I/O ) mechanism; mechanism.
;h e Z2x(g*y3l0对结果的分析:
+u[e9X"S2rAvm0
/P2\O%J(q6}0如果%rcache列的值小于90%,并且%wcache列的值不在70-70%之间,我们必须观察系统中什么应用在做什么样的读/写操作,我们是否需要增加缓冲欧的大小。
r(U5@gcL+B051Testing软件测试网`N6x,N&in-Q
biI|0D Uq |0利用SAR命令分析交换区的活动
1R;OC'ugdb,j4e{K051Testing软件测试网&A'Kg8?~G/A,O
51Testing软件测试网} mOi%o#htB
通过命令sar -w,我们可以分析系统中的交换区的活动情况。
sq-m E"D5N$H02:I/O资源成为系统性能的瓶颈的征兆51Testing软件测试网 `3b/\;P0D
3:哪些活动是占用I/O资源的大户?51Testing软件测试网GA_ KB3DP+r
4:利用iostat分析I/O的利用率51Testing软件测试网4]L8H}:hF7]l/P
5:利用SAR命令分析磁盘活动51Testing软件测试网n1|Y!R.Auy D
6:利用SAR命令分析缓冲区的活动51Testing软件测试网 h avDJI6}ra
7:利用SAR命令分析交换区的活动51Testing软件测试网F&Wl!iFP+y
8:利用GlancePlus分析系统的I/O活动情况
!c"y@#['y+w{4Zb09:对I/O需求密集型系统的性能调试51Testing软件测试网SK(E"t`N
)vfFT'r M|051Testing软件测试网n#Q)Q,g$[ anJ
衡量I/O闲忙程度的指标 51Testing软件测试网1Y%m eM2Fn M#i1k
6N|5pz Hfg051Testing软件测试网!\"L Lp `)|4^
下面是一些衡量I/O闲忙程度的经用指标:
"zB;n7W:{p051Testing软件测试网;dOu1h;Y;JPhF
磁盘利用率(disk utilization)51Testing软件测试网iX#R%} r$^
磁盘队列长度(disk queue length)51Testing软件测试网.MQm dZ5V7J Z
磁头/逻辑卷的读/写速率(read/write rates per spindle/logical volume)
&h9\-}:x+?Q0`q0原始I/O(raw I/O):主要用于数据库应用51Testing软件测试网Q;ZZa0b0Y
交换队列的长度(swap queue length)51Testing软件测试网)hAjr:rf
缓存命中率(buffer cache hit ratio)51Testing软件测试网 zNhv,| tO]
网络文件系统和无盘工作站速率(NFS and diskless rates(server))
A!~+])Lt9d&y%x JO051Testing软件测试网4\q_&H7g
I/O资源成为系统性能的瓶颈的征兆
*NSJi~Atm1G0
efx/_O_2j0
Xn~5[&}E:u0当I/O成为瓶颈时,会出现下面这些典型的症状:
*P3h2RQk/A051Testing软件测试网"z;uwW5t7W2U#KE
过高的磁盘利用率(high disk utilization)
rA`R(^0太长的磁盘等待队列(large disk queue length)51Testing软件测试网bY3?'m9E$_\/ag;U
等待磁盘I/O的时间所占的百分率太高(large percentage of time waiting for disk I/O)51Testing软件测试网K QY!FQm}(q5]
太高的物理I/O速率:large physical I/O rate(not sufficient in itself)
#{7b:i }Vjbu:Mu@U0过低的缓存命中率(low buffer cache hit ratio(not sufficient in itself))
$eM ~5e1W_0w%}~ ]0太长的运行进程队列,但CPU却空闲(large run queue with idle CPU)51Testing软件测试网%|mQ K2`2i)I.B
51Testing软件测试网f xS U7N
哪些活动是占用I/O资源的大户? 51Testing软件测试网E\H;bu[h
51Testing软件测试网#To&cX|d
;j3K!iG?\ \e0下面是一些占用大量I/O资源的活动:
$b6J2X2t2{%w(z0
NM/T P1qtiR0换页(paging):paging不仅会引起内存问题,还可能引起磁盘问题;51Testing软件测试网5{a\.H'H Xb Q
open,creat,and stat system calls:系统调用会引起大量的磁盘I/O;51Testing软件测试网*P8T G&{U] _E
multiuser I/O and random I/O51Testing软件测试网$m1m)p/IVS{%^3F{
relational database51Testing软件测试网X5ul#[ KtS
core dumps
T^,p f?)b t051Testing软件测试网gwD/})t9o)g
51Testing软件测试网F!sF fF3ZL
利用iostat分析I/O的利用率
~~K-A4B.uaen;X ?0
5D"\7`%Az?PWH+\0
L*c)f.z dV]0iostat - report I/O statistics
'pL|\lb0
'O"qe.QNdN B0iostat iteratively reports I/O statistics for each active disk on the system.51Testing软件测试网 Y,b{8I](i'B
B;c1p6X s/v0If two or more disks are present, data is presented on successive lines for each disk.51Testing软件测试网*FZ"@$c C
9v3J&Ug2Sg/W*qLm0With the advent of new disk technologies, such as data striping, where a single data transfer is spread across several disks, the number of milliseconds per average seek becomes impossible to compute accurately. At best it is only an approximation, varying greatly, based on several dynamic system conditions. For this reason and to maintain backward compatibility, the milliseconds per average seek ( msps ) field is set to the value 1.0.
8k&JZwG5|0
C0m_ X s7n$I0它的语法为:51Testing软件测试网,Z`'RE5fB7u3P$T4^~
uP9t:A5Zb%CZC0iostat [-t] [interval [count]]
)])Ox{'[_4U0
u+i%qK)`Cq0其选项的含义为:51Testing软件测试网*b }D(bL C^/N
t0` C T6lj0-t:Report terminal statistics as well as disk statistics.
{Wn!sGvE0interval: Display successive lines which are summaries of the last interval seconds. The first line reported is for the time since a reboot and each subsequent line is for the last interval only.
lI6pR^YR2Tq0count: Repeat the statistics count times.51Testing软件测试网$q+PaH+\:Xk/v4J+axp0k
对结果的分析:51Testing软件测试网&OmY%W&~#H
51Testing软件测试网K6z%Dl7N$s!NEG
通过查看bps列和sps列的值我们可以知道哪些磁盘比较忙,哪些磁盘比较闲。51Testing软件测试网R!f6E LY_
4Q1_#O2L#mXW(Qc051Testing软件测试网uVFzhh
利用SAR命令分析磁盘活动 51Testing软件测试网-vK,r.k,SWr7q e%?
TsS$c!o0Wv!m0
;Q#E;pD^k.Z,h*h0通过命令sar -d,我们可以分析系统中的每个磁盘和磁带的活动情况。
p.t g._ Vu0YY051Testing软件测试网J2~&c3Bt T:L
Report activity for each block device, e.g., disk or tape drive. One line is printed for each device that had activity during the last interval. If no devices were active, a blank line is printed.Each line contains the following data:
|v]$p.IQi2q|051Testing软件测试网%j-xu!}L%NkY
device:设备名;51Testing软件测试网j/AG"k#{P[bn
%busy: Portion of time device was busy servicing a request; statistics.51Testing软件测试网L9Z!vu vU}O
avque: Average number of requests outstanding for the device;
Fl^fh0r+w/s: Number of data transfers per second (read and writes) from and to the device;
8pZm0U7T?#t{#p0blks/s: Number of bytes transferred (in 512-byte units) from and to the device;51Testing软件测试网8R_7p#E;G
avwait: Average time (in milliseconds) that transfer requests waited idly on queue for the device;
XQ4M'NkC9_!Z6{ q0avserv: Average time (in milliseconds) to service each transfer request (includes seek, rotational latency, and data transfer times) for the device.51Testing软件测试网D/j#Y1h+z*ex
对结果的分析:51Testing软件测试网&d+N:No1G3G[
I |%l0f \2_0如果某个磁盘的%busy列的值大于50%,则说明该磁盘可能存在瓶颈;
#dA4Q1i(e5E0
gi^7w:qyP5b+s0`0如果某个磁盘的avwait珍的值大于avserv列的值,也说明该磁盘可能存在瓶颈;51Testing软件测试网jh2LSy SPhx6p
[0S*so}m0
e:J`3RS9F*SND0利用SAR命令分析缓冲区的活动 51Testing软件测试网9t ? Wt-Lig d!a
51Testing软件测试网q v F${&|c jg
51Testing软件测试网9o.m7w{ ?,w\K
通过命令sar -b,我们可以分析系统中的缓冲区的活动情况。51Testing软件测试网-S,@4j3HSR/B
51Testing软件测试网7Y%rm8qXi+? r9Ss
Report activity for each block device, e.g., disk or tape drive. One line is printed for each device that had activity during the last interval. If no devices were active, a blank line is printed.Each line contains the following data:
Y"PGWmTi051Testing软件测试网{TF Kwt;MA
bread/s Number of physical reads per second from the disk (or other block devices) to the buffer cache;51Testing软件测试网-m-|t"d'a#~"b!bjPi
bwrit/s: Number of physical writes per second from the buffer cache to the disk (or other block device);51Testing软件测试网}P.?l H/P2Y7r
lread/s: Number of reads per second from buffer cache;
x5It9Yev+z0lwrit/s: Number of writes per second to buffer cache;
LF!n'e@O c[0%rcache: Buffer cache hit ratio for read requests e.g., 1 - bread/lread;51Testing软件测试网z^P*R'Ps w
%wcache: Buffer cache hit ratio for write requests e.g., 1 - bwrit/lwrit;51Testing软件测试网~Y4]WsfK
pread/s: Number of reads per second from character device using the physio() (raw I/O) mechanism;51Testing软件测试网(G9n6TM4V#f(~v6P7@2B
pwrit/s: Number of writes per second to character device using the physio() (i.e., raw I/O ) mechanism; mechanism.
;h e Z2x(g*y3l0对结果的分析:
+u[e9X"S2rAvm0
/P2\O%J(q6}0如果%rcache列的值小于90%,并且%wcache列的值不在70-70%之间,我们必须观察系统中什么应用在做什么样的读/写操作,我们是否需要增加缓冲欧的大小。
r(U5@gcL+B051Testing软件测试网`N6x,N&in-Q
biI|0D Uq |0利用SAR命令分析交换区的活动
1R;OC'ugdb,j4e{K051Testing软件测试网&A'Kg8?~G/A,O
51Testing软件测试网} mOi%o#htB
通过命令sar -w,我们可以分析系统中的交换区的活动情况。