性能調試---(五)I/O性能分析

性能調試---()I/O性能分析

 

--------------------------------------------------------------------------------

 

http://www.chinaunix.net 作者:南非蜘蛛  發表於:2003-06-11 22:01:31

【發表評論】【查看原文】【Solaris討論區】【關閉】 

 

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 

?鍵進入聯機幫助界面; 

iDisk I/O by File System表界面; 

b鍵表示向後翻頁,按f鍵表示向前翻頁; 

這個界面很有用,因爲它按不同的文件顯示I/O的繁忙程度。 

 

3)對邏輯卷的分析 

 

進入GlancePlus 

?鍵進入聯機幫助界面; 

vI/O by logical volumes表界面; 

b鍵表示向後翻頁,按f鍵表示向前翻頁; 

通過把對文件系統的分析和邏輯卷的分析結合起來,能夠知道哪個磁盤的I/O最忙。 

 

4)對磁盤的分析 

 

5)對交換區的分析 

 

 

GlancePlus  

 

 

GlancePlusHP公司的性能分析工具,它是一個聯機性能分析和診斷工具,用於監控正在發生的系統活動情況。它的特點是: 

 

聯機性能分析和診斷; 

監控系統資源的使用情況; 

多屏幕輸出; 

帶有聯機幫助; 

進程閥值識別和報警,這個閥值可以基於被監控的進程、資源的利用率、用戶、進程名或者終端名; 

和前面介紹的其他性能分析工具,如:SARiostatvmstat等相比,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利用率,Nnice CPU利用率,Anegative-nice CPU利用率; 

磁盤的利用率:F-文件系統I/OV-虛擬內存I/O 

內存的利用率:S-用於系統代碼和數據的內存,U-用於用戶代碼和數據的內存,B-用作緩存的內存 

交換區的利用率:U-正在使用的交換區,R-預留的交換區 

前面講到,GlancePlus是一個聯機分析診斷工具,其實,GlancePlus還可以與MeasureWare Agent一起使用,MeasureWare Agent將可以 在一段時間內幫助GlancePlus收集基本數據,然後由GlancePlus進行分析。 

 

Glance可以運行在HP-UXSolarisAIX上。 

 

與其他的工具相比,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 

 

http://thor.prohosting.com/~nlingym/os/hpux/tuning/io/cputuning.html

 

 

 

發佈了21 篇原創文章 · 獲贊 1 · 訪問量 9萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章