Friday, October 24, 2008

Introduction to iostat , vmstat and netstat

Input Output statistics ( iostat )
iostat reports terminal and disk I/O activity and CPU utilization. The first line of output is for the time period since boot & each subsequent line is for the prior interval . Kernel maintains a number of counters to keep track of the values.
iostat's activity class options default to tdc (terminal, disk, and CPU). If any other option/s are specified, this default is completely overridden i.e. iostat -d will report only statistics about the disks.

syntax:
Basic synctax is iostat interval count
option - let you specify the device for which information is needed like disk , cpu or terminal. (-d , -c , -t or -tdc ) . x options gives the extended statistics .
interval - is time period in seconds between two samples . iostat 4 will give data at each 4 seconds interval.
count - is the number of times the data is needed . iostat 4 5 will give data at 4 seconds interval 5 times

-->

Example
$ iostat -xtc 5 2
extended disk statistics tty cpu
disk r/s w/s Kr/s Kw/s wait actv svc_t %w %b tin tout us sy wt id
sd0 2.6 3.0 20.7 22.7 0.1 0.2 59.2 6 19 0 84 3 85 11 0
sd1 4.2 1.0 33.5 8.0 0.0 0.2 47.2 2 23
sd2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0
sd3 10.2 1.6 51.4 12.8 0.1 0.3 31.2 3 31

The fields have the following meanings:
disk name of the disk
r/s reads per second
w/s writes per second
Kr/s kilobytes read per second
Kw/s kilobytes written per second
wait average number of transactions waiting for service (Q length) actv average number of transactions actively being serviced (removed from the queue but not yet
completed)
%w percent of time there are transactions waiting
for service (queue non-empty)
%b percent of time the disk is busy (transactions
in progress)

Results and Solutions:
The values to look from the iostat output are:
Reads/writes per second (r/s , w/s)
Percentage busy (%b)
Service time (svc_t)
If a disk shows consistently high reads/writes along with , the percentage busy (%b) of the disks is greater than 5 percent, and the average service time (svc_t) is greater than 30 milliseconds, then one of the following action needs to be taken
1.)Tune the application to use disk i/o more efficiently by modifying the disk queries and using available cache facilities of application servers .
2.) Spread the file system of the disk on to two or more disk using disk striping feature of volume manager /disksuite etc.
3.) Increase the system parameter values for inode cache , ufs_ninode , which is Number of inodes to be held in memory. Inodes are cached globally (for UFS), not on a per-file system basis 4.) Move the file system to another faster disk /controller or replace existing disk/controller to a faster one.



Virtual Memory Statistics ( vmstat )
vmstat - vmstat reports virtual memory statistics of process, virtual memory, disk, trap, and CPU activity. On multicpu systems , vmstat averages the number of CPUs into the output. For per-process statistics .Without options, vmstat displays a one-line summary of the virtual memory activity since the system was booted. syntax:
Basic synctax is vmstat interval count
option - let you specify the type of information needed such as paging -p , cache -c ,.interrupt -i etc.
if no option is specified information about process , memory , paging , disk ,interrupts & cpu is displayed .
interval - is time period in seconds between two samples . vmstat 4 will give data at each 4 seconds interval.
count - is the number of times the data is needed . vmstat 4 5 will give data at 4 seconds interval 5 times. Example The following command displays a summary of what the system
is doing every five seconds.


example% vmstat 5
procs memory page disk faults cpu
r b w swap free re mf pi p fr de sr s0 s1 s2 s3 in sy cs us sy id
0 0 0 11456 4120 1 41 19 1 3 0 2 0 4 0 0 48 112 130 4 14 82
0 0 1 10132 4280 0 4 44 0 0 0 0 0 23 0 0 211 230 144 3 35 62
0 0 1 10132 4616 0 0 20 0 0 0 0 0 19 0 0 150 172 146 3 33 64
0 0 1 10132 5292 0 0 9 0 0 0 0 0 21 0 0 165 105 130 1 21 78


The fields of vmstat's display are procs r in run queue b blocked for resources I/O, paging etc. w swapped memory (in Kbytes) swap - amount of swap space currently available free - size of the free list page ( in units per second). re page reclaims - see -S option for how this field is modified. mf minor faults - see -S option for how this field is modified. pi kilobytes paged in po kilobytes paged out fr kilobytes freed de anticipated short-term memory shortfall (Kbytes) sr pages scanned by clock algorithm disk ( operations per second )

There are slots for up to four disks, labeled with a single letter and number.
The letter indicates the type of disk (s = SCSI, i = IPI, etc) . The number is
the logical unit number. faults in (non clock) device interrupts sy system calls cs CPU context switches cpu - breakdown of percentage usage of CPU time. On multiprocessors this is an average across all processors.
us user time sy system time id idle time

Results and Solutions:
A. CPU issues:
Following columns has to be watched to determine if there is any cpu issue
Processes in the run queue (procs r)
User time (cpu us)
System time (cpu sy)
Idle time (cpu id)
procs cpu
r b w us sy id
0 0 0 4 14 82
0 0 1 3 35 62
0 0 1 3 33 64
0 0 1 1 21 78
Problem symptoms:
1.) If the number of processes in run queue (procs r) are consistently greater than the number of CPUs on the system it will slow down system as there are more processes then available CPUs .
2.) if this number is more than four times the number of available CPUs in the system then system is facing shortage of cpu power and will greatly slow down the processess on the system.
3.) If the idle time (cpu id) is consistently 0 and if the system time (cpu sy) is double the user time (cpu us) system is facing shortage of CPU resources.

Resolution :
Resolution to these kind of issues involves tuning of application procedures to make efficient use of cpu and as a last resort increasing the cpu power or adding more cpu to the system.


B. Memory Issues:
Memory bottlenecks are determined by the scan rate (sr) . The scan rate is the pages scanned by the clock algorithm per second. If the scan rate (sr) is continuously over 200 pages per second then there is a memory shortage.

Resolution :
1. Tune the applications & servers to make efficient use of memory and cache.
2. Increase system memory .
3. Implement priority paging in s in pre solaris 8 versions by adding line "set priority paging=1" in /etc/system. Remove this line if upgrading from Solaris 7 to 8 & retaining old /etc/system file.



Network Statistics (netstat)
netstat displays the contents of various network-related data structures in depending on the options selected.
Syntax :
netstat

43 comments:

項鍊 said...

仇恨是一把雙刃劍,傷了別人,也傷了自己 ..................................................

睡衣 said...

與其爭取不可能得到的東西,不如善自珍惜運用自己所擁有的........................................

香蕉哥哥 said...

0401影音成人影片交流愛撫淫叫色情照片性愛圖片女生如何自慰激突成人論壇美女脫胸罩走光一夜正妹視訊情人性愛論壇85cc影城性伴侶85cc色情影片打手槍情色視訊聊天室色情a片色情色情圖片限制級照片色情電話520sex免費色情網情色性愛一夜情聊天網成人聊天網視訊成人台灣性網av一夜女情色av淫女免費視訊美女挑逗情色影音聊天作愛影片辣妹清涼秀美女做愛成人自拍貼圖成人資訊色論壇台灣色情成人網站色情視訊聊天露三點打砲情色性愛貼圖av成人網成人影片

冠宇 said...

夫妻自拍片成人無碼片線上看18限成人影片論壇成人亞洲線上免費成人電影性片免費狂看性交線上免費影片性免費小說網性美女做愛性美女遊戲性教影片性教學影片性感乳房影片性感做愛電影性感援交妹性感電影性感劍士性愛a片免費試看性小遊戲幸愛影片姓愛圖貼亞洲線上免費電影亞洲線上免費影片其色制聊天室咆哮入口咆哮老鼠網咆哮鼠咆嘯小老鼠論壇分享論壇學生妹做愛自拍影片夫妻聯誼成人小說正妹

仁南 said...

KK777一夜激情聊天live show成人自拍貼圖自慰少婦自拍裸體圖片台灣色情成人網站情人視訊網情色留言板視訊美女免費視訊聊天室限制級極度震撼情色論壇色情特區自拍裸女貼圖潮吹性影片觀賞小穴情色片a圖片sex story性愛影片美女做愛成人色情網站性愛圖片成人情色貼圖全裸寫真集圖片走光圖女生陰毛自慰影片色情av1007成人色情聊天室女生自慰裸體照成人影音聊天台灣色情網站色情片打手槍情色天堂成人視訊聊天免費情色網站av網超性感辣妹激突成人論壇情色視訊聊天鹹濕成人網站av成人論壇免費美女視訊

婷妏 said...

I do like ur article~!!!...................................................

少菁 said...

你可以從外表的美來評論一朵花或一隻蝴蝶,但你不能這樣來評論一個人........................................

明宏 said...

pleasure to find such a good artical! please keep update!! ........................................

美書 said...

變天了~~注意身體,別感冒囉! ........................................

昭士松修 said...

請繼續發表好文!加油加油加油! ........................................

萬宇 said...

不勞而獲的事情,並沒有價值........................................

LupeConstan治士 said...

I love readding, and thanks for your artical..............................................

CyrusD_Ar淑福 said...

欣賞是一種美德~回應是最大的支持^^.............................................

韋于倫成 said...

85cc成人片卡通免費下載a片韓瑜寫真aaaaaa片性愛遊戲正妹星球正妹空姐寫真正妹走光250av女優免費影片星野流宇星野殘紅星野桂星野愛利絲星野天堂星野優奈星野雅希寫真集星野美優影片星野美優寫真集星野美優短片美女 視訊999無瑪試看圖線上免費av影片台灣情網色嘿咻kiss168cu成人bt情色 網免費成人成人貼圖視訊聊天室土豆網韓劇播放打飛機專用網免費聊天室交友小魔女自天堂18成人動漫畫av女優免費做愛影片成人情色網戀愛ing聊天室卡通美女短片免費試看台灣18成年網台灣18成年人網

EdmundoK_黎 said...

如果成為一支火柴,也要點亮一個短暫的宇宙;如果是一隻烏鴉,也要叫疼閉塞的耳膜。..................................................

佩GailBohanan1蓉 said...

Look before you leap.............................................................

estherme said...

Man proposes, God disposes.............................................................

Vi2139 said...

當一個人內心能容納兩樣相互衝突的東西,這個人便開始變得有價值了。..................................................................

登山登山 said...

大師手筆﹐果然不凡.................................................................

亦妮亦妮 said...

來給你加油打氣!!!保重!!!.................................................................                           

佳燕 said...

很棒的分享~~~來留個言囉~~~~.................................................................                           

于庭 said...

成熟,就是有能力適應生活中的模糊。.................................................................

王名仁 said...

It takes all kinds to make a world.............................................................

玉婷良DGFHFJ瑋黃吳 said...

人有兩眼一舌,是為了觀察倍於說話的緣故。............................................................

吳婷婷 said...

唯有穿鞋的人,才知道鞋的哪一處擠腳............................................................

佳皓佳皓 said...

時間可證明一切~你的BLOG是我覺得不賴的..................................................................

楊儀卉 said...

成熟,就是有能力適應生活中的模糊。............................................................

楊偉馨楊偉馨 said...

God helps those who help themselves...................................................

天花天花 said...

Gather roses while you may...................................................

銘木 said...

天氣涼了~要注意身體喔@~@...............................................................

said...

晚上好,很喜歡你的blog哦.....................................................................

琬安琬安 said...

感謝分享,將本身的錯誤想法改正了!............................................................

王筱彥王筱彥 said...

成熟,就是有能力適應生活中的模糊。............................................................

毛彥宇毛彥宇 said...

Say not all that you know, believe not all that you hear.............................................................

王金正偉彥君 said...

愛,拆開來是心和受兩個字。用心去接受對方的一切,用心去愛對方的所有。......................................................................

文王廷 said...

時時關心,時時感動。..................................................

佳陳容 said...

要在憂患恥辱的環境裡,創造我們自力更生的新生活。..................................................

麗王王珠 said...

用行動來支持你~~~不留言不行!............................................................

胡曹哲維佳玲 said...

文章是心情的反應~~祝妳天天寫的都是讓人開心的好文章哦!!...............................................................

陳欣陳玟珮陳玟珮琦 said...

生命所經歷的折磨愈多,其所產生的奮鬥力愈大。................. ................................................

麗王王珠 said...

加油!!! 很棒的分享~..................................................................

佳張張張張燕張張張張張 said...

很棒,令人期待..................................................................

黃英吳思潔吳思潔邦 said...

走召糸及言贊白勺口拉............................................................