51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 3857|回复: 1
打印 上一主题 下一主题

[原创] Linux性能监控之绪论篇

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2007-11-12 21:38:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<H2>Linux性能监控之绪论篇</H2>
<DIV class=t_msgfont id=postmessage_4>性能调优的目的是找到系统的瓶颈,并且调节系统来设法消除这些瓶颈.我们在监控性能的时候重点在于监视一下子系统:<BR>1.CPU<BR>2.Memory<BR>3.IO<BR>4.Network<BR><BR>但这些系统都是彼此依赖,不能单独只看其中一个.当一个系统负载过重时往往会引起其它子系统的问题,比如说:<BR>-&gt;大量的读入内存的IO请求(page-in IO)会用完内存队列;<BR>-&gt;大量的网络流量会造成CPU的过载;<BR>-&gt;CPU的高使用率可能正在处理空闲内存队列;<BR>-&gt;大量的磁盘读写会消耗CPU和IO资源.<BR><BR>我们测试的系统,总的来说可分为二类:<BR>第一, IO Bound, 这类系统会大量消耗内存和底层的存储系统,它并不消耗过多的CPU和网络资源(除非系统是网络的).IO bound系统消耗CPU资源用来接受IO请求,然后会进入休眠状态.数据库通常被认为是IO bound系统.<BR><BR>第二, CPU Bound,这类系统需要消耗大量的CPU资源.他们往往进行大量的数学计算. 高吞吐量的Web server, Mail Server通常被认为是CPU Bound系统.<BR><BR>在性能测试中首先要做的是建立基线(Baseline),这样后续的调整才会有一个参考标准.值得注意的是,在测试基线的时候,一定要保证系统工作在正常的状态下.<BR><BR>在Linux上,监视系统的性能的常用工具有:<BR><STRONG>Tool</STRONG>&nbsp; &nbsp;&nbsp;&nbsp;Description&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Base&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; Repository<BR><STRONG>vmstat</STRONG> all purpose performance tool&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;yes&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;yes<BR><STRONG>mpstat</STRONG> provides statistics per CPU&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; no&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;yes<BR><STRONG>sar</STRONG> all purpose performance monitoring tool no&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;yes<BR><STRONG>iostat</STRONG> provides disk statistics&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; no&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;yes<BR><STRONG>netstat</STRONG> provides network statistics&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;yes&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; yes<BR><STRONG>dstat</STRONG> monitoring statistics aggregator&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;no&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; in most distributions<BR><STRONG>iptraf</STRONG> traffic monitoring dashboard&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;no&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;yes<BR><STRONG>ethtool</STRONG> reports on Ethernet interface configuration yes yes<BR><BR>这些工具在Linux的安装过程中都可以选择进行安装。<BR><BR>下面是一个vmstat产生的baseline的例子:<BR># vmstat 1<BR>procs memory swap io system cpu<BR>r b swpd free buff cache si so bi bo in cs us sy wa id<BR>1 0 138592 17932 126272 214244 0 0 1 18 109 19 2 1 1 96<BR>0 0 138592 17932 126272 214244 0 0 0 0 105 46 0 1 0 99<BR>0 0 138592 17932 126272 214244 0 0 0 0 198 62 40 14 0 45<BR>0 0 138592 17932 126272 214244 0 0 0 0 117 49 0 0 0 100<BR>0 0 138592 17924 126272 214244 0 0 0 176 220 938 3 4 13 80<BR>0 0 138592 17924 126272 214244 0 0 0 0 358 1522 8 17 0 75<BR>1 0 138592 17924 126272 214244 0 0 0 0 368 1447 4 24 0 72<BR>0 0 138592 17924 126272 214244 0 0 0 0 352 1277 9 12 0 79<BR># vmstat 1<BR>procs memory swap io system cpu<BR>r b swpd free buff cache si so bi bo in cs us sy wa id<BR>2 0 145940 17752 118600 215592 0 1 1 18 109 19 2 1 1 96<BR>2 0 145940 15856 118604 215652 0 0 0 468 789 108 86 14 0 0<BR>3 0 146208 13884 118600 214640 0 360 0 360 498 71 91 9 0 0<BR>2 0 146388 13764 118600 213788 0 340 0 340 672 41 87 13 0 0<BR>2 0 147092 13788 118600 212452 0 740 0 1324 620 61 92 8 0 0<BR>2 0 147360 13848 118600 211580 0 720 0 720 690 41 96 4 0 0<BR>2 0 147912 13744 118192 210592 0 720 0 720 605 44 95 5 0 0<BR>2 0 148452 13900 118192 209260 0 372 0 372 639 45 81 19 0 0<BR>2 0 149132 13692 117824 208412 0 372 0 372 457 47 90 10 0 0</DIV>
<DIV class=t_msgfont>&nbsp;</DIV>
<DIV class=t_msgfont>欢迎访问我的个人论坛<A href="http://51test.5d6d.com">http://51test.5d6d.com</A></DIV>
<DIV class=t_msgfont>&nbsp;</DIV>
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2007-11-16 13:36:03 | 只看该作者
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-11-17 22:43 , Processed in 0.072856 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表