Introduction to iostat , vmstat and netstat
This document is primarily written with reference to solaris performance monitoring and tuning but these tools are available in other unix variants also with slight syntax difference.
iostat , vmstat and netstat are three most commonly used tools for performance monitoring . These comes built in with the operating system and are easy to use .iostat stands for input output statistics and reports statistics for i/o devices such as disk drives . vmstat gives the statistics for virtual Memory and netstat gives the network statstics .
Following paragraphs describes these tools and their usage for performance monitoring and if you need more information there are some very good solaris performance monitoring books available at www.besttechbooks.com.
Table of content :
1. Iostat
2. vmstat
3. netstat
4. Next Steps
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 <options> 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 <options> 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 a
verage 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 <option/s>
multiple options can be given at one time.
Options
-a - displays the state of all sockets.
-r - shows the system routing tables
-i - gives statistics on a per-interface basis.
-m - displays information from the network memory buffers. On Solaris, this shows statistics
forSTREAMS
-p [proto] - retrieves statistics for the specified protocol
-s - shows per-protocol statistics. (some implementations allow -ss to remove fileds with a value of 0 (zero) from the display.)
-D - display the status of DHCP configured interfaces.
-n do not lookup hostnames, display only IP addresses.
-d (with -i) displays dropped packets per interface.
-I [interface] retrieve information about only the specified interface.
-v be verbose
interval - number for continuous display of statictics.
Example :
$netstat -rn
Routing Table: IPv4 Destination Gateway Flags Ref Use Interface -------------------- -------------------- ----- ----- ------ --------- 192.168.1.0 192.168.1.11 U 1 1444 le0 224.0.0.0 192.168.1.11 U 1 0 le0 default 192.168.1.1 UG 1 68276 127.0.0.1 127.0.0.1 UH 1 10497 lo0 |
This shows the output on a Solaris machine who's IP address is 192.168.1.11 with a default router at 192.168.1.1
Results and Solutions:
A.) Network availability
The command as above is mostly useful in troubleshooting network accessibility issues . When outside network is not accessible from a machine check the following
1. if the default router ip address is correct
2. you can ping it from your machine.
3. If router address is incorrect it can be changed with route add commnad . See man route for more info .
route command examples:
$route add default <hostname>
$route add 192.0.2.32 <gateway_name>
If the router address is correct but still you can't ping it there may be some network cable /hub/switch problem and you have to try and eliminate the faulty component .
B.) Network Response
$ netstat -i
Name |
Mtu |
Net/Dest |
Address |
Ipkts |
Ierrs |
Opkts |
Oerrs |
Collis |
Queue |
lo0 |
8232 |
loopback |
localhost |
77814 |
0 |
77814 |
0 |
0 |
0 |
hme0 |
1500 |
server1 |
server1 |
10658566 |
3 |
4832511 |
0 |
279257 |
0 |
This option is used to diagnose the network problems when the connectivity is there but it is slow in response .
Values to look at:
- Collisions (
Collis
)
- Output packets (
Opkts
)
- Input errors (
Ierrs
)
- Input packets (
Ipkts
)
The above values will give information to workout
i. Network collision rate as follows :
Network collision rate = Output collision counts / Output packets
Network-wide collision rate greater than 10 percent will indicate
- Overloaded network,
- Poorly configured network,
- Hardware problems.
ii. Input packet error rate as follows :
Input Packet Error Rate = Ierrs / Ipkts
.
If the input error rate is high (over 0.25 percent), the host is dropping packets. Hub/switch cables etc needs to be checked for potential problems.
C. Network socket & TCP Cconnection state
Netstat gives important information about network socket and tcp state . This is very useful in
finding out the open , closed and waiting network tcp connection .
Network states returned by netstat are following :
CLOSED ---- Closed. The socket is not being used.
LISTEN ---- Listening for incoming connections.
SYN_SENT ---- Actively trying to establish connection.
SYN_RECEIVED ---- Initial synchronization of the connection under way.
ESTABLISHED ---- Connection has been established.
CLOSE_WAIT ---- Remote shut down; waiting for the socket to close.
FIN_WAIT_1 ---- Socket closed; shutting down connection.
CLOSING ---- Closed, then remote shutdown; awaiting acknowledgement.
LAST_ACK ---- Remote shut down, then closed ;awaiting acknowledgement.
FIN_WAIT_2 ---- Socket closed; waiting for shutdown from remote.
TIME_WAIT ---- Wait after close for remote shutdown retransmission.
Example:
#netstat -a
|
Local Address |
Remote Address |
Swind |
Send-Q |
Rwind |
Recv-Q |
State |
*.* |
*.* |
0 |
0 |
24576 |
0 |
IDLE |
*.22 |
*.* |
0 |
0 |
24576 |
0 |
LISTEN |
*.22 |
*.* |
0 |
0 |
24576 |
0 |
LISTEN |
*.* |
*.* |
0 |
0 |
24576 |
0 |
IDLE |
*.32771 |
*.* |
0 |
0 |
24576 |
0 |
LISTEN |
*.4045 |
*.* |
0 |
0 |
24576 |
0 |
LISTEN |
*.25 |
*.* |
0 |
0 |
24576 |
0 |
LISTEN |
*.5987 |
*.* |
0 |
0 |
24576 |
0 |
LISTEN |
*.898 |
*.* |
0 |
0 |
24576 |
0 |
LISTEN |
*.32772 |
*.* |
0 |
0 |
24576 |
0 |
LISTEN |
*.32775 |
padding-right: 1px; padding-left: 1px; font-weight: 400; font-size: 10pt; vertical-align: bottom; color: windowtext; padding-top: 1px;
分享到:
Global site tag (gtag.js) - Google Analytics
| |
相关推荐
ensp校园网络毕业设计,java+毕业设计+扫雷(程序)
Matlab领域上传的视频均有对应的完整代码,皆可运行,亲测可用,适合小白; 1、代码压缩包内容 主函数:main.m; 调用函数:其他m文件;无需运行 运行结果效果图; 2、代码运行版本 Matlab 2019b;若运行有误,根据提示修改;若不会,私信博主; 3、运行操作步骤 步骤一:将所有文件放到Matlab的当前文件夹中; 步骤二:双击打开main.m文件; 步骤三:点击运行,等程序运行完得到结果; 4、仿真咨询 如需其他服务,可私信博主或扫描视频QQ名片; 4.1 博客或资源的完整代码提供 4.2 期刊或参考文献复现 4.3 Matlab程序定制 4.4 科研合作
Wox全局搜索工具类似mac的全局搜索功能,在win下可以实时搜索电脑上安装的软件及文档,节省了找文档的时间,可在在不会到桌面的情况下使用Alt+回车搜索需要的内容。
附件是判断回文素数C语言程序,这个程序首先定义了两个函数:isPrime 用于判断一个数是否为素数,isPalindrome 用于判断一个数是否为回文。然后在 main 函数中,通过一个循环来检查从2到999(这里假设我们只需要检查小于1000的数)的所有数,如果一个数既是素数又是回文数,就将其打印出来。 请注意,这个程序只检查了小于1000的数。如果需要检查更大的范围,可以相应地调整循环的上限。此外,素数判断的效率并不是最优的,对于大数的判断,可能需要更高效的算法。
课设毕设基于SSM的抗疫医疗用品销售平台 LW+PPT+源码可运行
16生产设备日常保养记录表.xls
Matlab领域上传的视频均有对应的完整代码,皆可运行,亲测可用,适合小白; 1、代码压缩包内容 主函数:main.m; 调用函数:其他m文件;无需运行 运行结果效果图; 2、代码运行版本 Matlab 2019b;若运行有误,根据提示修改;若不会,私信博主; 3、运行操作步骤 步骤一:将所有文件放到Matlab的当前文件夹中; 步骤二:双击打开main.m文件; 步骤三:点击运行,等程序运行完得到结果; 4、仿真咨询 如需其他服务,可私信博主或扫描视频QQ名片; 4.1 博客或资源的完整代码提供 4.2 期刊或参考文献复现 4.3 Matlab程序定制 4.4 科研合作
Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 JavaScript引擎,可以在Windows、Linux、Unix、Mac OS X等操作系统上运行。 Node.js的特点之一是事件驱动和非阻塞I/O模型,这使得它非常适合处理大量并发连接,从而在构建实时应用程序如在线游戏、聊天应用以及实时通讯服务时表现卓越。此外,Node.js使用了模块化的架构,通过npm(Node package manager,Node包管理器),社区成员可以共享和复用代码,极大地促进了Node.js生态系统的发展和扩张。 Node.js不仅用于服务器端开发。随着技术的发展,它也被用于构建工具链、开发桌面应用程序、物联网设备等。Node.js能够处理文件系统、操作数据库、处理网络请求等,因此,开发者可以用JavaScript编写全栈应用程序,这一点大大提高了开发效率和便捷性。 在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。
Sandboxie Plus 是一款强大的沙盒工具,它允许你在隔离的环境中运行和测试软件。有了它,你可以无所畏惧的在电脑操作一些危险的行为,不用担心会损坏电脑设备,只需一键即可清理所有的残留数据.可以实现程序多开,软件安全保护等一系列不可思议的操作. 通过这种方式,你可以保护系统免受恶意软件和其他潜在威胁的侵害,同时还能安全地进行软件测试和开发。Sandboxie Plus 提供了用户友好的界面和高级功能,确保你的系统始终保持安全和稳定.
ISO TR 9968 2023 功能安全能量存储系统应用
相信很好多使用,使用草图2024的朋友,都会遇到一个问题就是在新建贴图或修改贴图是点击打开不显示图片的问题 其实只需要替换一个文件就可以完美解决 "C:\Program Files\SketchUp\SketchUp 2024\resources\zh-cn\替换以下路径"
策略性游戏可以锻炼人的思维能力还能缓解人的压力,使人们暂时忘却生活当中的烦恼,增强人们的逻辑思维能力,游戏的艺术美也吸引着越来越多的玩家和厂商,寓教于乐,在放松人们心情的同时还可以活跃双手。在人类的社会生活当中,游戏占有很大的比重,并且随着社会的发展而不断发展。而且游戏本身具有激发人类潜在行为的特质,是一种能够吸引人们参与其中的活动,其本身具有强烈的吸引力使游戏者卷入其中;再者适当的游戏、合理的时间安排,能够让玩家在娱乐的同时还可以锻炼其反应速度及灵敏程度,亦可让玩家从压力中释放出来。因此游戏逐渐成为人们生活中不可缺少的一部分,游戏产业也正逐步发展成熟。 经典的推箱子游戏是一个来自日本的古老游戏,目的是在训练你的逻辑思考能力。它的玩法也非常简单,在一个狭小的仓库中,要求把木箱放到指定的位置,稍不小心就会出现箱子无法移动或者通道被堵住的情况,所以需要巧妙的利用有限的空间和通道,合理安排移动的次序和位置,控制人物不停的移动将箱子推到目的位置才能顺利的完成任务。难点在于移动的位置,以及箱子到达指定位置的顺序,只有多加思考才能获得游戏的胜利。反复推敲,锻炼了人们的耐性。
考研数据结构-学习笔记
Matlab领域上传的视频均有对应的完整代码,皆可运行,亲测可用,适合小白; 1、代码压缩包内容 主函数:main.m; 调用函数:其他m文件;无需运行 运行结果效果图; 2、代码运行版本 Matlab 2019b;若运行有误,根据提示修改;若不会,私信博主; 3、运行操作步骤 步骤一:将所有文件放到Matlab的当前文件夹中; 步骤二:双击打开main.m文件; 步骤三:点击运行,等程序运行完得到结果; 4、仿真咨询 如需其他服务,可私信博主或扫描视频QQ名片; 4.1 博客或资源的完整代码提供 4.2 期刊或参考文献复现 4.3 Matlab程序定制 4.4 科研合作
【疾病检测】机器视觉黑色素瘤皮肤癌检测【含Matlab源码 1689期】
成品检验报告(COA).xls
39内审不合格项分布表.xls
史上最详细四网协同技术交流材料(G网、T网、TD-LTE、WLAN).ppt,希望对您的事业有帮助! 史上最详细四网协同技术交流材料(G网、T网、TD-LTE、WLAN).ppt,希望对您的事业有帮助! 史上最详细四网协同技术交流材料(G网、T网、TD-LTE、WLAN).ppt,希望对您的事业有帮助! 史上最详细四网协同技术交流材料(G网、T网、TD-LTE、WLAN).ppt,希望对您的事业有帮助! 史上最详细四网协同技术交流材料(G网、T网、TD-LTE、WLAN).ppt,希望对您的事业有帮助! 史上最详细四网协同技术交流材料(G网、T网、TD-LTE、WLAN).ppt,希望对您的事业有帮助! 史上最详细四网协同技术交流材料(G网、T网、TD-LTE、WLAN).ppt,希望对您的事业有帮助! 史上最详细四网协同技术交流材料(G网、T网、TD-LTE、WLAN).ppt,希望对您的事业有帮助! 史上最详细四网协同技术交流材料(G网、T网、TD-LTE、WLAN).ppt,希望对您的事业有帮助! 史上最详细四网协同技术交流材料(G网、T网、TD-LTE、WLAN).ppt,希望
20仓储管理程序.doc
Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 JavaScript引擎,可以在Windows、Linux、Unix、Mac OS X等操作系统上运行。 Node.js的特点之一是事件驱动和非阻塞I/O模型,这使得它非常适合处理大量并发连接,从而在构建实时应用程序如在线游戏、聊天应用以及实时通讯服务时表现卓越。此外,Node.js使用了模块化的架构,通过npm(Node package manager,Node包管理器),社区成员可以共享和复用代码,极大地促进了Node.js生态系统的发展和扩张。 Node.js不仅用于服务器端开发。随着技术的发展,它也被用于构建工具链、开发桌面应用程序、物联网设备等。Node.js能够处理文件系统、操作数据库、处理网络请求等,因此,开发者可以用JavaScript编写全栈应用程序,这一点大大提高了开发效率和便捷性。 在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。