性能调试---I/O性能分析
1:衡量I/O闲忙程度的指标
2:I/O资源成为系统性能的瓶颈的征兆
3:哪些活动是占用I/O资源的大户?
4:利用iostat分析I/O的利用率
5:利用SAR命令分析磁盘活动
6:利用SAR命令分析缓冲区的活动
7:利用SAR命令分析交换区的活动
8:利用GlancePlus分析系统的I/O活动情况
9:对I/O需求密集型系统的性能调试
衡量I/O闲忙程度的指标
下面是一些衡量I/O闲忙程度的经用指标:
磁盘利用率(disk utilization)
磁盘队列长度(disk queue length)
磁头/逻辑卷的读/写速率(read/write rates per spindle/logical volume)
原始I/O(raw I/O):主要用于数据库应用
交换队列的长度(swap queue length)
缓存命中率(buffer cache hit ratio)
网络文件系统和无盘工作站速率(NFS and diskless rates(server))
I/O资源成为系统性能的瓶颈的征兆
当I/O成为瓶颈时,会出现下面这些典型的症状:
过高的磁盘利用率(high disk utilization)
太长的磁盘等待队列(large disk queue length)
等待磁盘I/O的时间所占的百分率太高(large percentage of time waiting for disk I/O)
太高的物理I/O速率:large physical I/O rate(not sufficient in itself)
过低的缓存命中率(low buffer cache hit ratio(not sufficient in itself))
太长的运行进程队列,但CPU却空闲(large run queue with idle CPU)
哪些活动是占用I/O资源的大户?
下面是一些占用大量I/O资源的活动:
换页(paging):paging不仅会引起内存问题,还可能引起磁盘问题;
open,creat,and stat system calls:系统调用会引起大量的磁盘I/O;
multiuser I/O and random I/O
relational database
core dumps
利用iostat分析I/O的利用率
iostat - report I/O statistics
iostat iteratively reports I/O statistics for each active disk on the system.
If two or more disks are present, data is presented on successive lines for each disk.
With 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.
它的语法为:
iostat [-t] [interval [count]]
其选项的含义为:
-t:Report terminal statistics as well as disk statistics.
interval: 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.
count: Repeat the statistics count times.
对结果的分析:
通过查看bps列和sps列的值我们可以知道哪些磁盘比较忙,哪些磁盘比较闲。
利用SAR命令分析磁盘活动
通过命令sar -d,我们可以分析系统中的每个磁盘和磁带的活动情况。
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:
device:设备名;
%busy: Portion of time device was busy servicing a request; statistics.
avque: Average number of requests outstanding for the device;
r+w/s: Number of data transfers per second (read and writes) from and to the device;
blks/s: Number of bytes transferred (in 512-byte units) from and to the device;
avwait: Average time (in milliseconds) that transfer requests waited idly on queue for the device;
avserv: Average time (in milliseconds) to service each transfer request
(includes seek, rotational latency, and data transfer times) for the
device.
对结果的分析:
如果某个磁盘的%busy列的值大于50%,则说明该磁盘可能存在瓶颈;
如果某个磁盘的avwait珍的值大于avserv列的值,也说明该磁盘可能存在瓶颈;
利用SAR命令分析缓冲区的活动
通过命令sar -b,我们可以分析系统中的缓冲区的活动情况。
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:
bread/s Number of physical reads per second from the disk (or other block devices) to the buffer cache;
bwrit/s: Number of physical writes per second from the buffer cache to the disk (or other block device);
lread/s: Number of reads per second from buffer cache;
lwrit/s: Number of writes per second to buffer cache;
%rcache: Buffer cache hit ratio for read requests e.g., 1 - bread/lread;
%wcache: Buffer cache hit ratio for write requests e.g., 1 - bwrit/lwrit;
pread/s: Number of reads per second from character device using the physio() (raw I/O) mechanism;
pwrit/s: Number of writes per second to character device using the physio() (i.e., raw I/O ) mechanism; mechanism.
对结果的分析:
如果%rcache列的值小于90%,并且%wcache列的值不在70-70%之间,我们必须观察系统中什么应用在做什么样的读/写操作,我们是否需要增加缓冲欧的大小。
利用SAR命令分析交换区的活动
通过命令sar -w,我们可以分析系统中的交换区的活动情况。
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:
swpin/s: Number of process swapins per second;
swpot/s: Number of process swapouts per second;
bswin/s: Number of 512-byte units transferred for swapins per second;
bswot/s: Number of 512-byte units transferred for swapouts per second;
pswch/s: Number of process context switches per second.
对结果的分析:
如果swpin/s的值大于零,那么swpot的值必须引起注意;
同时必须注意pswch/s的值,如果很大,说明进程切换频繁。
利用GlancePlus分析系统的I/O活动情况
1)对磁盘的整体使用情况的分析:
进入GlancePlus;
按?键进入联机帮助界面;
按d键进入磁盘的详细界面;
按b键表示向后翻页,按f键表示向前翻页;
通过Disk Detail Screen,我们可以知道所有的逻辑和物理I/O请求的分布情况。
2)对Disk I/O by File System
进入GlancePlus;
按?键进入联机帮助界面;
按i键Disk I/O by File System表界面;
按b键表示向后翻页,按f键表示向前翻页;
这个界面很有用,因为它按不同的文件显示I/O的繁忙程度。
3)对逻辑卷的分析
进入GlancePlus;
按?键进入联机帮助界面;
按v键I/O by logical volumes表界面;
按b键表示向后翻页,按f键表示向前翻页;
通过把对文件系统的分析和逻辑卷的分析结合起来,能够知道哪个磁盘的I/O最忙。
4)对磁盘的分析
5)对交换区的分析
GlancePlus
GlancePlus是HP公司的性能分析工具,它是一个联机性能分析和诊断工具,用于监控正在发生的系统活动情况。它的特点是:
联机性能分析和诊断;
监控系统资源的使用情况;
多屏幕输出;
带有联机帮助;
进程阀值识别和报警,这个阀值可以基于被监控的进程、资源的利用率、用户、进程名或者终端名;
和前面介绍的其他性能分析工具,如:SAR,iostat,vmstat等相比,GlancePlus有一最大好处,这就是:GlancePlus不仅能对系统的整体情况进行分析,而且还可以对某个进程进行深入分析。
GlancePlus所有监控的系统资源主要有以下这些,应该说,它们已经包括了主要的系统资源。
CPU、磁盘、内存和交换区的整体使用情况;
全局进程的活动情况;
CPU的详细使用情况;
内存的详细使用情况;
文件系统、设备和逻辑卷的磁盘输入/输出;
磁盘队列和长度;
交换区的详细使用情况;
系统表的使用情况;
单个进程的活动情况;
GlancePlus的运行形式有两种:
图形方式:#/opt/perf/bin/gpm,或以后台方式运行#gpm&;不过,我们必须先设置环境变量DISPLAY,因为它是图形输出
的目的地,比如:export DISPLAY=主机名(IP地址):0.0;如果是工作站telnet别的主机上,则本工作站还要运行#xhost
+,表示别的机器上输出可以到本工作站;
终端方式:#/opt/perf/bin/glance
GlancePlus的界面主要有两部分,上面部分是系统资源的整体使用情况,下面部分则按不同的资源的详细使用情况。
GlancePlus的界面的上面部分的详细说明,其中字母表示谁用了资源,而字母之间的长度资源占用率。
CPU的利用率:S-系统CPU利用率,U-用户CPU利用率,R-实时CPU利用率,N-nice CPU利用率,A-negative-nice CPU利用率;
磁盘的利用率:F-文件系统I/O,V-虚拟内存I/O
内存的利用率:S-用于系统代码和数据的内存,U-用于用户代码和数据的内存,B-用作缓存的内存
交换区的利用率:U-正在使用的交换区,R-预留的交换区
前面讲到,GlancePlus是一个联机分析诊断工具,其实,GlancePlus还可以与MeasureWare
Agent一起使用,MeasureWare Agent将可以
在一段时间内帮助GlancePlus收集基本数据,然后由GlancePlus进行分析。
Glance可以运行在HP-UX,Solaris和AIX上。
与其他的工具相比,Glance占用的系统资源会更多一些。
通常情况下,启动工具的命令的语法如下:
#glance [-j interval][-p dest][-f dest][maxpagers n][-command][-nice n][-nosort][lock][]
其中,各选项的含义为:
-j :指定数据刷新的时间间隔;
-p :使得结果送到打印机队列;
-f :enbles printing to a file;
-maxpages :limits the number of pages to be printed;
-command:selects the inital metric screen;
-nice :nice value at which glance runs;
-nosort:don't sort processes on the screen;
-lock:locks glance into memory
b]本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/468/showart_470102.html
1:衡量I/O闲忙程度的指标
2:I/O资源成为系统性能的瓶颈的征兆
3:哪些活动是占用I/O资源的大户?
4:利用iostat分析I/O的利用率
5:利用SAR命令分析磁盘活动
6:利用SAR命令分析缓冲区的活动
7:利用SAR命令分析交换区的活动
8:利用GlancePlus分析系统的I/O活动情况
9:对I/O需求密集型系统的性能调试
衡量I/O闲忙程度的指标
下面是一些衡量I/O闲忙程度的经用指标:
磁盘利用率(disk utilization)
磁盘队列长度(disk queue length)
磁头/逻辑卷的读/写速率(read/write rates per spindle/logical volume)
原始I/O(raw I/O):主要用于数据库应用
交换队列的长度(swap queue length)
缓存命中率(buffer cache hit ratio)
网络文件系统和无盘工作站速率(NFS and diskless rates(server))
I/O资源成为系统性能的瓶颈的征兆
当I/O成为瓶颈时,会出现下面这些典型的症状:
过高的磁盘利用率(high disk utilization)
太长的磁盘等待队列(large disk queue length)
等待磁盘I/O的时间所占的百分率太高(large percentage of time waiting for disk I/O)
太高的物理I/O速率:large physical I/O rate(not sufficient in itself)
过低的缓存命中率(low buffer cache hit ratio(not sufficient in itself))
太长的运行进程队列,但CPU却空闲(large run queue with idle CPU)
哪些活动是占用I/O资源的大户?
下面是一些占用大量I/O资源的活动:
换页(paging):paging不仅会引起内存问题,还可能引起磁盘问题;
open,creat,and stat system calls:系统调用会引起大量的磁盘I/O;
multiuser I/O and random I/O
relational database
core dumps
利用iostat分析I/O的利用率
iostat - report I/O statistics
iostat iteratively reports I/O statistics for each active disk on the system.
If two or more disks are present, data is presented on successive lines for each disk.
With 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.
它的语法为:
iostat [-t] [interval [count]]
其选项的含义为:
-t:Report terminal statistics as well as disk statistics.
interval: 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.
count: Repeat the statistics count times.
对结果的分析:
通过查看bps列和sps列的值我们可以知道哪些磁盘比较忙,哪些磁盘比较闲。
利用SAR命令分析磁盘活动
通过命令sar -d,我们可以分析系统中的每个磁盘和磁带的活动情况。
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:
device:设备名;
%busy: Portion of time device was busy servicing a request; statistics.
avque: Average number of requests outstanding for the device;
r+w/s: Number of data transfers per second (read and writes) from and to the device;
blks/s: Number of bytes transferred (in 512-byte units) from and to the device;
avwait: Average time (in milliseconds) that transfer requests waited idly on queue for the device;
avserv: Average time (in milliseconds) to service each transfer request
(includes seek, rotational latency, and data transfer times) for the
device.
对结果的分析:
如果某个磁盘的%busy列的值大于50%,则说明该磁盘可能存在瓶颈;
如果某个磁盘的avwait珍的值大于avserv列的值,也说明该磁盘可能存在瓶颈;
利用SAR命令分析缓冲区的活动
通过命令sar -b,我们可以分析系统中的缓冲区的活动情况。
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:
bread/s Number of physical reads per second from the disk (or other block devices) to the buffer cache;
bwrit/s: Number of physical writes per second from the buffer cache to the disk (or other block device);
lread/s: Number of reads per second from buffer cache;
lwrit/s: Number of writes per second to buffer cache;
%rcache: Buffer cache hit ratio for read requests e.g., 1 - bread/lread;
%wcache: Buffer cache hit ratio for write requests e.g., 1 - bwrit/lwrit;
pread/s: Number of reads per second from character device using the physio() (raw I/O) mechanism;
pwrit/s: Number of writes per second to character device using the physio() (i.e., raw I/O ) mechanism; mechanism.
对结果的分析:
如果%rcache列的值小于90%,并且%wcache列的值不在70-70%之间,我们必须观察系统中什么应用在做什么样的读/写操作,我们是否需要增加缓冲欧的大小。
利用SAR命令分析交换区的活动
通过命令sar -w,我们可以分析系统中的交换区的活动情况。
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:
swpin/s: Number of process swapins per second;
swpot/s: Number of process swapouts per second;
bswin/s: Number of 512-byte units transferred for swapins per second;
bswot/s: Number of 512-byte units transferred for swapouts per second;
pswch/s: Number of process context switches per second.
对结果的分析:
如果swpin/s的值大于零,那么swpot的值必须引起注意;
同时必须注意pswch/s的值,如果很大,说明进程切换频繁。
利用GlancePlus分析系统的I/O活动情况
1)对磁盘的整体使用情况的分析:
进入GlancePlus;
按?键进入联机帮助界面;
按d键进入磁盘的详细界面;
按b键表示向后翻页,按f键表示向前翻页;
通过Disk Detail Screen,我们可以知道所有的逻辑和物理I/O请求的分布情况。
2)对Disk I/O by File System
进入GlancePlus;
按?键进入联机帮助界面;
按i键Disk I/O by File System表界面;
按b键表示向后翻页,按f键表示向前翻页;
这个界面很有用,因为它按不同的文件显示I/O的繁忙程度。
3)对逻辑卷的分析
进入GlancePlus;
按?键进入联机帮助界面;
按v键I/O by logical volumes表界面;
按b键表示向后翻页,按f键表示向前翻页;
通过把对文件系统的分析和逻辑卷的分析结合起来,能够知道哪个磁盘的I/O最忙。
4)对磁盘的分析
5)对交换区的分析
GlancePlus
GlancePlus是HP公司的性能分析工具,它是一个联机性能分析和诊断工具,用于监控正在发生的系统活动情况。它的特点是:
联机性能分析和诊断;
监控系统资源的使用情况;
多屏幕输出;
带有联机帮助;
进程阀值识别和报警,这个阀值可以基于被监控的进程、资源的利用率、用户、进程名或者终端名;
和前面介绍的其他性能分析工具,如:SAR,iostat,vmstat等相比,GlancePlus有一最大好处,这就是:GlancePlus不仅能对系统的整体情况进行分析,而且还可以对某个进程进行深入分析。
GlancePlus所有监控的系统资源主要有以下这些,应该说,它们已经包括了主要的系统资源。
CPU、磁盘、内存和交换区的整体使用情况;
全局进程的活动情况;
CPU的详细使用情况;
内存的详细使用情况;
文件系统、设备和逻辑卷的磁盘输入/输出;
磁盘队列和长度;
交换区的详细使用情况;
系统表的使用情况;
单个进程的活动情况;
GlancePlus的运行形式有两种:
图形方式:#/opt/perf/bin/gpm,或以后台方式运行#gpm&;不过,我们必须先设置环境变量DISPLAY,因为它是图形输出
的目的地,比如:export DISPLAY=主机名(IP地址):0.0;如果是工作站telnet别的主机上,则本工作站还要运行#xhost
+,表示别的机器上输出可以到本工作站;
终端方式:#/opt/perf/bin/glance
GlancePlus的界面主要有两部分,上面部分是系统资源的整体使用情况,下面部分则按不同的资源的详细使用情况。
GlancePlus的界面的上面部分的详细说明,其中字母表示谁用了资源,而字母之间的长度资源占用率。
CPU的利用率:S-系统CPU利用率,U-用户CPU利用率,R-实时CPU利用率,N-nice CPU利用率,A-negative-nice CPU利用率;
磁盘的利用率:F-文件系统I/O,V-虚拟内存I/O
内存的利用率:S-用于系统代码和数据的内存,U-用于用户代码和数据的内存,B-用作缓存的内存
交换区的利用率:U-正在使用的交换区,R-预留的交换区
前面讲到,GlancePlus是一个联机分析诊断工具,其实,GlancePlus还可以与MeasureWare
Agent一起使用,MeasureWare Agent将可以
在一段时间内帮助GlancePlus收集基本数据,然后由GlancePlus进行分析。
Glance可以运行在HP-UX,Solaris和AIX上。
与其他的工具相比,Glance占用的系统资源会更多一些。
通常情况下,启动工具的命令的语法如下:
#glance [-j interval][-p dest][-f dest][maxpagers n][-command][-nice n][-nosort][lock][]
其中,各选项的含义为:
-j :指定数据刷新的时间间隔;
-p :使得结果送到打印机队列;
-f :enbles printing to a file;
-maxpages :limits the number of pages to be printed;
-command:selects the inital metric screen;
-nice :nice value at which glance runs;
-nosort:don't sort processes on the screen;
-lock:locks glance into memory
b]本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/468/showart_470102.html
编辑回复