﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-qileilove-文章分类-性能测试</title><link>http://www.blogjava.net/qileilove/category/54127.html</link><description>不想做屌丝的码农，不是好项目经理！屌丝生涯从此开始！</description><language>zh-cn</language><lastBuildDate>Thu, 10 Apr 2014 16:29:31 GMT</lastBuildDate><pubDate>Thu, 10 Apr 2014 16:29:31 GMT</pubDate><ttl>60</ttl><item><title>一次完整的性能测试</title><link>http://www.blogjava.net/qileilove/articles/412181.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 10 Apr 2014 02:37:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/articles/412181.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/412181.html</wfw:comment><comments>http://www.blogjava.net/qileilove/articles/412181.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/412181.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/412181.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><strong style="word-break: break-all; line-height: normal !important;"><a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>工具：</strong>http_load，tsar</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">测试系统：</strong>公司网站的beta环境，本次测试数据有大约9万条数据。系统的架构为lamp+nginx，数据的流向，从mysql数据库 做一个dumper 每10分钟dump一次数据到系统的引擎。引擎是提供给用户垂直搜索的数据集合。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　测试数据来源：收集线上访问的日志，并做相关的参数化。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">测试步骤：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">1.准备相关测试工具</strong>，这里采用http_load ，测试命令sudo http_load -f 1000 -p 10 &nbsp;url.txt</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">2.准备测数据</strong>，目前该工具只支持get的请求，收集引擎服务器上的访问log 作为url，注意收集的 url 非常重要 他关系这个本次测试是否有效 ，最好收集 线上服务器的一个小时内的访问log 做修改和参数化</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">3.新旧版本对比测试</strong>，跑数据 -f 1000 -p 10 ; -f 2000 -p 20 ; -f 3000 -p 30; -f 5000 -p 50 ;-f 10000 -p 100 .每组数据跑三次 取平均的结果，当然跑多次取平均最好。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">2000 fetches, 20 max parallel, 9.63347e+07 bytes, in 89.0738 seconds</div><div style="word-break: break-all; margin: 10px 0px;">48167.3 mean bytes/connection</div><div style="word-break: break-all; margin: 10px 0px;">22.4533 fetches/sec, 1.08152e+06 bytes/sec</div><div style="word-break: break-all; margin: 10px 0px;">msecs/connect: 0.250249 mean, 0.763 max, 0 min</div><div style="word-break: break-all; margin: 10px 0px;">msecs/first-response: 874.104 mean, 4883.77 max, 3.489 min</div><div style="word-break: break-all; margin: 10px 0px;">33 bad byte counts</div><div style="word-break: break-all; margin: 10px 0px;">HTTP response codes:</div><div style="word-break: break-all; margin: 10px 0px;">code 200 -- 1952</div><div style="word-break: break-all; margin: 10px 0px;">code 400 -- 1</div><div style="word-break: break-all; margin: 10px 0px;">code 500 -- 47</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">4.结果分析：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　22.4533 fetches/sec &nbsp;--这个是qps 业务处理能力</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　HTTP response codes &nbsp;--这个是记录访问成功和失败的url数据</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　一般来说 同样的压力下 ，qps越高，代表业务处理能力越好性能越好，返回200 越多越好，如果qps相同 但是404，或者5000比较多，就要考虑是不是系统有性能瓶颈</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">5.补充 ：</strong>一般好要监控 服务的性能指标load数和cpu等等，仅仅看返回结果是不准确的，要把这些因素综合考虑，并且当并发和请求数太多客户机的性能也要考虑进去</div><img src ="http://www.blogjava.net/qileilove/aggbug/412181.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-04-10 10:37 <a href="http://www.blogjava.net/qileilove/articles/412181.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试工具原理</title><link>http://www.blogjava.net/qileilove/articles/411449.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Tue, 25 Mar 2014 03:38:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/articles/411449.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/411449.html</wfw:comment><comments>http://www.blogjava.net/qileilove/articles/411449.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/411449.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/411449.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　广义的讲，可以把<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">性能测试</strong></u></a>过程中使用到的所有工具都称为<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">性能测试工具</strong></u></a>，性能测试工具分为两大类，服务端性能测试工具和前端性能测试工具；服务端性能测试工具需要支持产生压力和负载，录制和生成测试脚本，设置和部署场景，产生并发用户和向系统施加持续的压力；而前端性能测试工具则不需要关系系统的压力和负载，只需要关心浏览器等客户端工具(目前的前端性能测试工具主要是Web前端性能测试工具)。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">服务端性能测试工具架构</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><strong style="word-break: break-all; line-height: normal !important;">　　1.虚拟用户脚本产生器</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　虚拟用户脚本生成器通过Proxy方式实现，具体来说，就是由一个Proxy作为客户端和服务器之间的中间人，接收从客户端发送的数据包，记录并将其转发给服务端，接收从服务端返回的数据流，记录并返回给客户端。这样，无论是客户端还是服务端都以为自己在一个真实的运行环境中。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">2.压力产生器</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　压力产生器用于根据脚本内容产生实际的负载。在性能测试工具中，压力产生器扮演者&#8220;产生负载&#8221;的角色。例如，如果一个测试场景要求产生100个虚拟用户，则压力产生器会在调度下生成100个进程或线程，每个线程对指定的脚本进行解释执行</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">3.用户代理</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　用户代理是运行在负载机上的进程，该进程与产生负载压力的进程或线程协作，接收调度系统的命令，调度产生负载压力的进程或线程，从这个意义上看，用户代理业可以被看作是压力产生器的组成部分</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　4.压力调度和监控系统</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　压力调度和监控系统是性能测试工具中直接与用户交互的主要内容。压力调度工具可以根据用户的场景要求，设置各不同脚本的VU数量、设置同步点等，而监控系统则可以对各种<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">数据库</strong></u></a>、应用服务器、服务器的主要性能计数器进行监控</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">5.压力结果分析工具</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　压力结果分析工具可以用来辅助进行测试结果的分析。</div><img src ="http://www.blogjava.net/qileilove/aggbug/411449.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-03-25 11:38 <a href="http://www.blogjava.net/qileilove/articles/411449.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试性能分析与调优的原理</title><link>http://www.blogjava.net/qileilove/articles/410044.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 19 Feb 2014 05:51:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/articles/410044.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/410044.html</wfw:comment><comments>http://www.blogjava.net/qileilove/articles/410044.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/410044.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/410044.html</trackback:ping><description><![CDATA[<p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">最近一直纠结性能分析与调优如何下手，先从硬件开始，还是先从代码或数据库。从操作系统（<span style="font-family: Arial;">CPU</span><span style="font-family: 宋体;">调度，内存管理，进程调度，磁盘</span><span style="font-family: Arial;">I/O</span><span style="font-family: 宋体;">）、网络、协议（</span><span style="font-family: Arial;">HTTP</span><span style="font-family: 宋体;">，&nbsp;</span><span style="font-family: Arial;">TCP/IP&nbsp;</span><span style="font-family: 宋体;">），还是从应用程序代码，数据库调优，中间件配置等方面入手。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　单一个中间件又分<span style="font-family: Arial;">web</span><span style="font-family: 宋体;">中间件（</span><span style="font-family: Arial;">apache&nbsp;</span><span style="font-family: 宋体;">、</span><span style="font-family: Arial;">IIS</span><span style="font-family: 宋体;">），应用中间件（</span><span style="font-family: Arial;">tomcat&nbsp;</span><span style="font-family: 宋体;">、</span><span style="font-family: Arial;">weblogic&nbsp;</span><span style="font-family: 宋体;">、</span><span style="font-family: Arial;">webSphere&nbsp;</span><span style="font-family: 宋体;">）等，虽然都是中间件，每一样拎出来往深了学都不是一朝一夕之功。但调优对于每一项的要求又不仅仅是&#8220;知道&#8221;或&#8220;会使用&#8221;这么简单。起码要达到&#8220;如何更好的使用&#8221;。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　常看到性能测试书中说，性能测试不单单是性能测试工程师一个人的事儿。需要<span style="font-family: Arial;">DBA&nbsp;</span><span style="font-family: 宋体;">、开发人员、运维人员的配合完成。但是在不少情况下性能测试是由性能测试人员独立完成的，退一步就算由其它人员的协助，了解系统架构的的各个模块对于自身的提高也有很大帮助，同进也更能得到别人的尊重。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　再说性能调优之前，我们有必要再提一下进行测试的目的，或者我们进行性能测试的初衷是什么？</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;"><strong>能力验证</strong>：验证某系统在一定条件具有什么样的能力。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;"><strong>能力规划</strong>：如何使系统达到我们要求的性能能力。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;"><strong>应用程序诊断</strong>：比如内存泄漏，通过功能测试很难发现，但通过性能测试却很容易发现。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;"><strong>性能调优</strong>：满足用户需求，进一步进行系统分析找出瓶颈，优化瓶颈，提高系统整体性能。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;"><img src="http://images.cnitblog.com/blog/311516/201303/19233903-cee5265a860949478ca195445c42155a.png" alt="" style="border: 0px;" /></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><div style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 18pt;"><strong><span style="background-color: #c0c0c0;">一般系统的瓶颈 &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">性能测试调优需要先发现瓶颈，那么系统一般会存在哪些瓶颈：</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;"><strong>硬件上的性能瓶颈</strong>：</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">一般指的是<span style="font-family: Arial;">CPU</span><span style="font-family: 宋体;">、内存、磁盘</span><span style="font-family: Arial;">I/O&nbsp;</span><span style="font-family: 宋体;">方面的问题，分为服务器硬件瓶颈、网络瓶颈（对局域网可以不考虑）、服务器操作系统瓶颈（参数配置）、中间件瓶颈（参数配置、数据库、</span><span style="font-family: Arial;">web</span><span style="font-family: 宋体;">服务器等）、应用瓶颈（</span><span style="font-family: Arial;">SQL&nbsp;</span><span style="font-family: 宋体;">语句、数据库设计、业务逻辑、算法等）。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;"><strong>应用软件上的性能瓶颈</strong>：</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">一般指的是应用服务器、<span style="font-family: Arial;">web&nbsp;</span><span style="font-family: 宋体;">服务器等应用软件，还包括数据库系统。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">例如：中间件<span style="font-family: Arial;">weblogic&nbsp;</span><span style="font-family: 宋体;">平台上配置的</span><span style="font-family: Arial;">JDBC</span><span style="font-family: 宋体;">连接池的参数设置不合理，造成的瓶颈。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;"><strong>应用程序上的性能瓶颈</strong>：</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">一般指的是开发人员新开发出来的应用程序。</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">例如，程序架构规划不合理，程序本身设计有问题（串行处理、请求的处理线程不够），造成系统在大量用户方位时性能低下而造成的瓶颈。</span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;"><strong>操作系统上的性能瓶颈</strong>：</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">一般指的是<span style="font-family: Arial;">windows</span><span style="font-family: 宋体;">、</span><span style="font-family: Arial;">UNIX</span><span style="font-family: 宋体;">、</span><span style="font-family: Arial;">Linux</span><span style="font-family: 宋体;">等操作系统。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">例如，在进行性能测试，出现物理内存不足时，虚拟内存设置也不合理，虚拟内存的交换效率就会大大降低，从而导致行为的响应时间大大增加，这时认为操作系统上出现性能瓶颈。</span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;"><strong>网络设备上的性能瓶颈</strong>：</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">一般指的是防火墙、动态负载均衡器、交换机等设备。</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">例如，在动态负载均衡器上设置了动态分发负载的机制，当发现某个应用服务器上的硬件资源已经到达极限时，动态负载均衡器将后续的交易请求发送到其他负载较轻的应用服务器上。在测试时发现，动态负载均衡器没有起到相应的作用，这时可以认为网络瓶颈。</span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　性能测试出现的原因及其定位十分复杂，这里只是简单介绍常见的几种瓶颈类型和特征，而性能测试所需要做的就是根据各种情况因素综合考虑，然后协助开发人员<span style="font-family: Arial;">\DBA\</span><span style="font-family: 宋体;">运维人员一起定位性能瓶颈。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 18pt;"><strong><span style="background-color: #c0c0c0;">一般性能调优步骤 &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">一般性能问题调优的步骤：</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;"><strong><span style="background-color: #c0c0c0;">步骤一</span></strong>：确定问题</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">应用程序代码：在通常情况下，很多程序的性能问题都是写出来的，因此对于发现瓶颈的模块，应该首先检查一下代码。</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">数据库配置：经常引起整个系统运行缓慢，一些诸如<span style="font-family: Arial;">oracle&nbsp;</span><span style="font-family: 宋体;">的大型数据库都是需要</span><span style="font-family: Arial;">DBA</span><span style="font-family: 宋体;">进行正确的参数调整才能投产的。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">操作系统配置：不合理就可能引起系统瓶颈。</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">硬件设置：硬盘速度、内存大小等都是容易引起瓶颈的原因，因此这些都是分析的重点。</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">网络：网络负载过重导致网络冲突和网络延迟。</span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;"><span style="background-color: #c0c0c0;"><strong>步骤二</strong></span>：确定问题</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　当确定了问题之后，我们要明确这个问题影响的是响应时间吞吐量，还是其他问题？是多数用户还是少数用户遇到了问题？如果是少数用户，这几个用户与其它用户的操作有什么不用？系统资源监控的结果是否正常？<span style="font-family: Arial;">CPU</span><span style="font-family: 宋体;">的使用是否到达极限？</span><span style="font-family: Arial;">I/O&nbsp;</span><span style="font-family: 宋体;">情况如何？问题是否集中在某一类模块中？&nbsp;是客户端还是服务器出现问题？&nbsp;系统硬件配置是否够用？实际负载是否超过了系统的负载能力？&nbsp;是否未对系统进行优化？</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">通过这些分析及一些与系统相关的问题，可以对系统瓶颈有更深入的了解，进而分析出真正的原因。</span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;"><span style="background-color: #c0c0c0;"><strong>步骤三</strong></span>：&nbsp;确定调整目标和解决方案</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">得高系统吞吐理，缩短响应时间，更好地支持并发。</span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;"><span style="background-color: #c0c0c0;"><strong>步骤四</strong></span>：测试解决方案</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">对通过解决方案调优后的系统进行基准测试。（基准测试是指通过设计科学的测试方法、测试工具和测试系统，实现对一类测试对象的某项性能指标进行定量的和可对比的测试）</span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;"><span style="background-color: #c0c0c0;"><strong>步骤五</strong></span>：分析调优结果</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">系统调优是否达到或者超出了预定目标？系统是整体性能得到了改善，还是以系统某部分性能来解决其他问题。调优是否可以结束了。</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　最后，如果达到了预期目标，调优工作就基本可以结束了。</span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;">下面算是一个技巧，如面试官问到一个性能问题假设，我不知道性能问题出在哪儿时，可以按照这个思路回答^_^</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">&nbsp; &nbsp;&#8226;&nbsp;<span style="font-family: 宋体;">查找瓶颈时按以下顺序，由易到难。</span></span><br /><span style="font-size: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;服务器硬件瓶颈<span style="font-family: Verdana;">---</span><span style="font-family: 宋体;">〉网络瓶颈（对局域网，可以不考虑）</span><span style="font-family: Verdana;">---</span><span style="font-family: 宋体;">〉服务器操作系统瓶颈（参数配置）</span><span style="font-family: Verdana;">---</span><span style="font-family: 宋体;">〉中间件瓶颈（参数配置，数据库，</span><span style="font-family: Verdana;">web</span><span style="font-family: 宋体;">服务器等）</span><span style="font-family: Verdana;">---</span><span style="font-family: 宋体;">〉应用瓶颈（</span><span style="font-family: Verdana;">SQL</span><span style="font-family: 宋体;">语句、数据库设计、业务逻辑、算法等）</span></span><br /><span style="font-size: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;注：以上过程并不是每个分析中都需要的，要根据测试目的和要求来确定分析的深度。对一些要求低的，我们分析到应用系统在将来大的负载压力（并发用户数、数据量）下，系统的硬件瓶颈在哪儿就够了。</span><br /><span style="font-size: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&#8226;&nbsp;<span style="font-family: 宋体;">分段排除法&nbsp;很有效</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">性能测试调优应该注意的要点：</span></p><ul style="margin-left: 45px;"><li style="list-style: inherit !important;"><span style="font-size: 15px;">要点1<span style="font-family: 宋体;">：&nbsp;在应用系统的设计开发过程中，应始终把性能放在考虑的范围内。</span></span></li><li style="list-style: inherit !important;"><span style="font-size: 15px;">要点<span style="font-family: 'Times New Roman';">2</span><span style="font-family: 宋体;">： 确定清晰明确的性能目标是关键。</span></span></li><li style="list-style: inherit !important;"><span style="font-size: 15px;">要点<span style="font-family: 'Times New Roman';">3</span><span style="font-family: 宋体;">：&nbsp;必须保证调优后的程序运行正确。</span></span></li><li style="list-style: inherit !important;"><span style="font-size: 15px;">要点<span style="font-family: 'Times New Roman';">4</span><span style="font-family: 宋体;">：&nbsp;系统的性能更大程度上取决于良好的设计，调优技巧只是一个辅助手段。</span></span></li><li style="list-style: inherit !important;"><span style="font-size: 15px;">要点<span style="font-family: 'Times New Roman';">5</span><span style="font-family: 宋体;">：&nbsp;调优过程是迭代渐进的过程，每一次调优的结果都要反馈到后续的代码开发中去。</span></span></li><li style="list-style: inherit !important;"><span style="font-size: 15px;">要点<span style="font-family: 'Times New Roman';">6</span><span style="font-family: 宋体;">：&nbsp;性能调优不能以牺牲代码的可读性和可维护性为代码。</span></span></li></ul><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><hr /><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　本文只介绍了一些性能调优的要关注的东西以及性能调优的一般要点。并没有具体说如何对系统的每个部件进行调优，如何要细说也不是一两书能说清的，对知识面的要求也非常高，是我目前的能力无法触摸的。</span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;"><span style="color: #800080;"><strong>这里做个总结</strong></span>：</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　《性能测试知多少》系列基本完结，虽然时间拉得比较长，但我没有把它给太监。虽然内容都在空谈性能测试理论知识，但我认为这些东西对于你从事性能测试工作必不可少。当然，我在&#8220;&nbsp;<span style="font-family: 'Times New Roman';">jmeter</span><span style="font-family: 宋体;">基础 &#8221;&nbsp;与&#8220;&nbsp;</span><span style="font-family: 'Times New Roman';">loadrunner&nbsp;</span><span style="font-family: 宋体;">技巧 &#8221;&nbsp;中讲解两个性能测试工具的使用。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　如果我的这些文章对于想了解和学习性能的同学带来一丝的帮助，我将非常开心。<span style="color: #ff0000;">我不是高手</span>，只是和你一起热爱测试技术的初学者，只是比较喜欢总结；也时常为前途迷茫，但我知道只要断去学习，路就在前方。我后面会整理性能调优的相关文章。</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">性能测试所有文章汇总：http://www.cnblogs.com/fnng/archive/2012/08/17/2644878.html&nbsp;</span></p></div><img src ="http://www.blogjava.net/qileilove/aggbug/410044.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-02-19 13:51 <a href="http://www.blogjava.net/qileilove/articles/410044.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试知多少---测试工具介绍</title><link>http://www.blogjava.net/qileilove/articles/409979.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Tue, 18 Feb 2014 03:41:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/articles/409979.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/409979.html</wfw:comment><comments>http://www.blogjava.net/qileilove/articles/409979.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/409979.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/409979.html</trackback:ping><description><![CDATA[<p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　继续这个系列的学习，这一节重点介绍目前流行的性能测试工具以及如何选择适合项目的工具。在此之前，我已经对性能测试工具的原理与架构做了分析。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><a href="http://www.cnblogs.com/fnng/archive/2012/07/31/2617546.html" style="color: #1d58d1; text-decoration: none;">http://www.cnblogs.com/fnng/archive/2012/07/31/2617546.html</a>&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 18pt;"><strong><span style="background-color: #c0c0c0;">性能测试工具的选择与评估 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　在性能工具原理与架构一章中，我们了解到性能测试工具的原理通常是：通过录制、回放脚本，模拟多用户同时访问被测试系统，模拟产生负载压力，监控并记录各种性能指标，生成性能分析结果和报告，从而完性能测试的基本任务。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　对需要进行性能测试的组织来说，决定使用哪种性能测试工具也不是一个简单的问题。我们有需要对性能需求进行分析，购买成本，人员学习使用成本进行综合考虑，从而确定最适合的本次性能测试的工具。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px; font-family: 仿宋;"><strong>注</strong>：这里所提到的性能测试工具为狭义上的性能测试工具，特指包含脚本生成、负载生成与测试数据搜集的性能测试工具，从广义上来讲，在性能测试过程中所用到一切工具，都可以称为性能测试工具，其中包括，软件协议分析工具，测试数据生成工具，测试监控工具等都属于性能测试工具范畴。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　我简单的软件性能测试工具分为三类，商业收费工具、开源免费工具、自主开发工具。下面是这三类工具的比较：</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><img src="http://pic002.cnblogs.com/images/2012/311516/2012101723493238.jpg" alt="" style="border: 0px;" /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">通过上面的比较分析，很难判别对某类工具的取舍，各自有其明显的优势，当然也有明显的缺点，如何更好选择工具，这里就要结合实际性能的需求了。</p><h3>需要考虑以下几个方面：</h3><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>性能需求</strong>：</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　首先要考虑的是否满足性能需求，例如系统的协议不支持，无法创建脚本，系统的模拟用户数达不到，或都某此特殊功能无法测试，如流媒体性能测试等。一些有性能工具是无法满足这些需求的，那当然要首先排除。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>购买成本</strong>：</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　对于商业工具的购买成本也是我们需要考虑的问题，其实，这个问题也是老板需要考虑的问题，对性能测试成本的整体预算等。当然了，在满足性能需求的前提下，当然一切从简。如果只需要某商业软件的部分功能，也可以只购买部分功能。有的是根据支持协议的多少、并发用户上限来区分，如loadrunner&nbsp;<span style="font-family: 宋体;">。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　这里要多扯一点，loadrunner<span style="font-family: 宋体;">应该是性能测试领域的巨无霸，它的年服务费多百万，这不是一般的小公司能承受的，可能许多网友用破解习惯了不以为然。而且</span><span style="font-family: 'Times New Roman';">loadrunner</span><span style="font-family: 宋体;">是可以定制的，一般商业软件都是可以定制的，也就是说，你有特定的需求，只要你愿意花钱，提供商都可以帮你定制开发。这样算下来成本会很高。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　那么开源软件呢？&nbsp;开源的性能测试工具其实非常的多，因为它们都分别适合在不同的需求场景下，所以，它们的体积相比商业软件会小很大，当然功能也相对简陋。但是他们在某些情况下可以完全满足某些性能需求，或者可以通过几款开源工具配合满足，或者通过对开源工具进行扩展进行满足。对开源工具进行扩展，对测试人员的要求较高。需要测试人员对工具的原理及源代码有相当有研究。这里对测试人员自动能力的提升非常有帮助。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　或者你的性能测试项目特殊，找遍市面上的所有性能工具无一款满意，商业定制成本过高。或者你想构建自己有工具体系。处于公司需求的特殊性与长期性考虑，可以自主开发一个性能测试工具来用。一次开发，永久收益（当然也需要维护与升级、扩展等），而且更贴近自已的需求。目前很多知明的大公司都有自己的性能测试工具，用于内部使用。&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>人员学习成本</strong>：</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　最后要提到的就是人员对工具的学习成本，其实，测试人员在选择性能测试工具时最先考虑的就是从自己会使用的工具入手，这样可以最低的控制学习成生，如果整一个工具，测试人员单学测试脚本就学了半年，老板早让你走人了。这也是对性能测试人员要求较高的地方。所以，对于性能测试人员，你最好熟悉一款流程的商业性能工具，一款开源免费性能具，还需要熟悉常见的性能脚本开发语言等，这是基本要求。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 18pt;"><strong><span style="background-color: #c0c0c0;">性能测试工具介绍 &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #800000;"><strong>商业工具 ：</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>　　QA&nbsp;Load</strong>：Compuware公司的QALoad是客户/服务器系统、企业资源配置（ERP）和电子商务应用的自动化负载测试工具。QALoad是QACenter性能版的一部分，它通过可重复的、真实的测试能够彻底地度量应用的可扩展性和性能。QACenter汇集完整的跨企业的自动测试产品，专为提高软件质量而设计。QACenter可以在整个开发生命周期、跨越多种平台、自动执行测试任务。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;<strong>SilkPerformer</strong>：一种在工业领域最高级的企业级负载测试工具。它可以模仿成千上万的用户在多协议和多计算的环境下工作。不管企业电子商务应用的规模大小及其复杂性，通过SilkPerformer，均可以在部署前预测它的性能。可视的用户化界面、实时的性能监控和强大的管理报告可以帮助我们迅速的解决问题，例如加快产品投入市场的时间，通过最小的测试周期保证系统的可靠性，优化性能和确保应用的可扩充性。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp; &nbsp; &nbsp;<strong>LoadRunner</strong>：一种较高规模适应性的，自动负载测试工具，它能预测系统行为，优化性能。LoadRunner强调的是整个企业的系统，它通过模拟实际用户的操作行为和实行实时性能监测，来帮助您更快的确认和查找问题。此外，LoadRunner&nbsp;能支持最宽范的协议和技术，为您的特殊环境，量身定做地提供解决方案。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>&nbsp;</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>　　WebRunner</strong>：是RadView公司推出的一个性能测试和分析工具，它让web应用程序开发者自动执行压力测试；webload通过模拟真实用户的操作，生成压力负载来测试web的性能，用户创建的是基于javascript的测试脚本，称为议程agenda，用它来模拟客户的行为，通过执行该脚本来衡量web应用程序在真实环境下的性能。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>&nbsp;</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>　　IBM&nbsp;Rational&nbsp;Performance&nbsp;Tester</strong>（简称&nbsp;RPT）也是一款性能测试工具，适用于基于&nbsp;Web&nbsp;的应用程序的性能和可靠性测试。Rational&nbsp;Performance&nbsp;Tester&nbsp;将易用性与深入分析功能相结合，从而简化了测试创建、负载生成和数据收集，以帮助确保应用程序具有支持数以千计并发用户并稳定运行的性能。&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #800000;"><strong>&nbsp;开源或免费工具：</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　<strong>Apache&nbsp;JMeter</strong>是Apache组织开发的基于Java的压力测试工具。用于对软件做压力测试，它最初被设计用于Web应用测试但后来扩展到其他测试领域。&nbsp;它可以用于测试静态和动态资源例如静态文件、Java&nbsp;小服务程序、CGI&nbsp;脚本、Java&nbsp;对象、数据库，&nbsp;FTP&nbsp;服务器,&nbsp;等等。JMeter&nbsp;可以用于对服务器、网络或对象模拟巨大的负载，来在不同压力类别下测试它们的强度和分析整体性能。&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>　　AutoBench</strong>&nbsp;是一款基于httperf的Perl脚本。它会在一次测试中调用多次httperf来对web服务器进行测试，每次会按照给定的参数增加并发连接数，将&nbsp;httperf的测试结果保存为CSV格式的文件，该文件可以被Excel直接读取，方便生成测试报告。借助于autobench自带的&nbsp;bench2graph工具可以生成漂亮的测试结果对比图。&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>&nbsp;</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>　　ApacheBench</strong>&nbsp;工具程式(ab)是&nbsp;Apache&nbsp;网站伺服器软体的一个附带的工具软体，专门用来执行网站伺服器的运行效能，特别是针对&nbsp;Apache&nbsp;网站伺服器&nbsp;的效能分析。这支程式原本是用来检测&nbsp;Apache&nbsp;网站伺服器(Web&nbsp;Server)&nbsp;所能够提供的效能，特别是可以看出&nbsp;Apache&nbsp;网站伺服器能提供每秒能送出多少网页，当然的，也可以用在任何其他的网站伺服器&nbsp;Apache&nbsp;ab的全称是ApacheBench，是&nbsp;Apache&nbsp;附带的一个小工具，专门用于&nbsp;HTTP&nbsp;Server&nbsp;的benchmark&nbsp;testing，可以同时模拟多个并发请求。&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>&nbsp;</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>　　curl-loader</strong>（也被称为&#8220;omes-NIK&#8221;和&#8220;davilka&#8221;）是一个开源的C语言编写的工具，模拟应用负载和成千上万的几十万人的HTTP&nbsp;/&nbsp;HTTPS和FTP/&nbsp;FTPS的客户端应用程序的行为，每个有其自己的源IP地址。相反，其他curl-loader使用真正的C编写的客户端协议栈，即libcurl和TLS/&nbsp;openssl的SSL的HTTP和FTP协议栈，支持登录和验证口味和模拟用户行为的工具。&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>&nbsp;</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>　　Iago</strong>&nbsp;是一个网站负载测试工具，Iago&nbsp;针对一个给定的网站进行访问录制并合成流量数据。它不同于其他的负载生成工具，它试图保持恒定的请求率。例如如果你想按每分钟100K来请求您的服务，Iago&nbsp;会试图保持这个速度进行测试。&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>&nbsp;</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>　　Pylot</strong>&nbsp;是一款开源的用以测试&nbsp;Web&nbsp;Service性能和扩展性的工具，它运行HTTP负载测试，这对于制定容量计划、确定基准点、分析系统瓶颈以及系统调优都非常有用。在使用过程&nbsp;中，Pylot会发起并发请求（HTTP&nbsp;Requests），检验服务器响应，以及带有相关指标的报表。它通过GUI或者Shell/Console来执行和监视对被测试网站的测试过程。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">-----------------------------------------------</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;关于性能测试工具非常的多，如果你是个开源的粉丝可以去开源中国转转，那里有许多非常优秀的开源软件。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;<div style="display: inline-block;"></div></p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;目前市场上的性能测试的工具种类很多，可以简单的划分为以下几种：负载压力测试工具、资源监控工具、故障定位工具以及调优工具。</p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp; &nbsp; 1. 主流负载性能测试工具</p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;&nbsp;&nbsp; 负载性能测试工具的原理通常是通过录制、回放脚本、模拟多用户同时访问被测试系统，制造负载，产生并记录各种性能指标，生成分析结果，从而完成性能测试的任务。</p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;&nbsp;&nbsp; 主流的负载性能测试工具有：</p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;&nbsp;&nbsp; QA Load：Compuware公司的QALoad是客户/服务器系统、企业资源配置（ERP）和电子商务应用的自动化负载测试工具。QALoad是QACenter性能版的一部分，它通过可重复的、真实的测试能够彻底地度量应用的可扩展性和性能。QACenter汇集完整的跨企业的自动测试产品，专为提高软件质量而设计。QACenter可以在整个开发生命周期、跨越多种平台、自动执行测试任务。</p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;&nbsp;&nbsp; SilkPerformer：一种在工业领域最高级的企业级负载测试工具。它可以模仿成千上万的用户在多协议和多计算的环境下工作。不管企业电子商务应用的规模大小及其复杂性，通过SilkPerformer，均可以在部署前预测它的性能。可视的用户化界面、实时的性能监控和强大的管理报告可以帮助我们迅速的解决问题，例如加快产品投入市场的时间，通过最小的测试周期保证系统的可靠性，优化性能和确保应用的可扩充性。</p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;&nbsp;&nbsp; LoadRunner：一种较高规模适应性的，自动负载测试工具，它能预测系统行为，优化性能。LoadRunner强调的是整个企业的系统，它通过模拟实际用户的操作行为和实行实时性能监测，来帮助您更快的确认和查找问题。此外，LoadRunner 能支持最宽范的协议和技术，为您的特殊环境，量身定做地提供解决方案。</p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;&nbsp;&nbsp; WebRunner：是RadView公司推出的一个性能测试和分析工具，它让web应用程序开发者自动执行压力测试；webload通过模拟真实用户的操作，生成压力负载来测试web的性能，用户创建的是基于javascript的测试脚本，称为议程agenda，用它来模拟客户的行为，通过执行该脚本来衡量web应用程序在真实环境下的性能。</p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;&nbsp;&nbsp; 免费测试工具：</p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;&nbsp;&nbsp; OpenSTA：开源项目，功能强大，自定义功能设置完备，但设置通过Script来完成。必须学习Script编写</p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;&nbsp;&nbsp; WAS（Web Application Stress Tool）：微软的工具，输出结果是纯文本的。</p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;&nbsp;&nbsp; 主流商用负载性能工具的比较图如下：</p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;&nbsp;&nbsp;&nbsp;</p><center style="font-size: 12px; font-family: Simsun; line-height: 23px; background-color: #f5f8fd;"><table cellspacing="4" cellpadding="1" border="0" align="center" style="margin: 0px; padding: 0px;"><tbody><tr><td valign="top" align="center" style="font-size: 12px; margin: 0px; padding: 0px;"><img alt="性能测试工具的介绍" src="http://i2.sinaimg.cn/IT/s/2008-12-19/30cf8292e55dfcb90d3af4a32d43a415.jpg" style="margin: 0px; padding: 0px; border: 1px solid #000000;" /></td></tr><tr><td valign="top" align="center" style="font-size: 12px; margin: 0px; padding: 0px;"></td></tr></tbody></table></center><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;<br style="font-size: 14px;" /><span style="font-size: 14px;">&nbsp;&nbsp;&nbsp;&nbsp;</span></p><center style="font-size: 12px; font-family: Simsun; line-height: 23px; background-color: #f5f8fd;"><table cellspacing="4" cellpadding="1" border="0" align="center" style="margin: 0px; padding: 0px;"><tbody><tr><td valign="top" align="center" style="font-size: 12px; margin: 0px; padding: 0px;"><img alt="性能测试工具的介绍" src="http://i2.sinaimg.cn/IT/s/2008-12-19/c59814ec36595559a2d4772599dfb689.jpg" style="margin: 0px; padding: 0px; border: 1px solid #000000;" /></td></tr><tr><td valign="top" align="center" style="font-size: 12px; margin: 0px; padding: 0px;"></td></tr></tbody></table></center><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;</p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;"></p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;&nbsp;&nbsp; 2.资源监控工具</p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;&nbsp;&nbsp; 资源监控作为系统压力测试过程中的一个重要环节，在相关的测试工具中基本上都有很多的集成。只是不同的工具之间，监控的中间件、数据库、主机平台的能力以及方式各有差异。而这些监控工具更大程度上都依赖于被监控平台自身的数据采集能力，目前的绝大多数的监控工具基本上是直接从中间件、数据库以及主机自身提供的性能数据采集接口获取性能指标。</p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;&nbsp;&nbsp; 首先，不同的应用平台有自身的监控命令以及控制界面。比如UNIX主机用户可以直接使用topas，vmstat,iostat了解系统自身的健康工作状况。另外，weblogic以及websphere平台都有自身的监控台，在上面可以了解到目前的JVM的大小、数据库连接池的使用情况以及目前连接的客户端数量以及请求状况等等。只是这些监控方式的使用对测试人员有一定的技术储备要求，需要自己熟练掌握以上监控方式的使用。</p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;&nbsp;&nbsp; 第三方的监控工具相应的对一些系统平台的监控进行了集成。比如Loadrunner对目前常用的一些业务系统平台环境都提供了相应的监控入口，从而可以在并发测试的同时，对业务系统所处的测试环境进行监控，更好的分析测试数据。</p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;&nbsp;&nbsp; 但Loadrunner工具其提供的监控方式还不是很直观，一些更直观的测试工具能在监控的同时提供相关的报警信息，类似的监控产品如QUEST公司提供的一整套监控解决方案包括了主机的监控、中间件平台的监控以及数据库平台的监控。QUEST系列监控产品提供了直观的图形化界面，能让测试者尽快进入监控的角色。</p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;&nbsp;&nbsp; 3. 故障定位工具以及调优工具</p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;&nbsp;&nbsp; 技术的不断发展以及测试需求的不断提升，故障定位工具应运而生，它能更精细的对负载压力测试中暴露的问题进行故障根源分析。在目前的主流测试工具厂商中，都相应地提供了对应的产品支持。尤其是目前.NET以及J2EE架构的流行，测试工具厂商纷纷在这些领域提供了相关的技术产品，比如Loadrunner模块中添加的诊断以及调优模块、Quest公司的PerformaSure、Compuware的Vantage套件以及CA公司收购的Wily的Introscope工具等等，都在更深层次上对业务流的调用进行追踪。这些工具在中间件平台上引入探针技术，能捕获后台业务内部的调用关系，发现问题所在，为应用系统的调优提供直接的参考指南。</p><p style="margin: 15px 0px; padding: 0px; border: 0px; font-size: 14px; line-height: 23px; font-family: Simsun; background-color: #f5f8fd;">&nbsp;&nbsp;&nbsp; 在数据库产品的故障定位分析上，Oracle自身提供了强大的诊断模块，同时，Quest公司的数据库产品也在数据库设计、开发以及上线运行维护都提供了全套的产品支持。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"></p><img src ="http://www.blogjava.net/qileilove/aggbug/409979.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-02-18 11:41 <a href="http://www.blogjava.net/qileilove/articles/409979.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试之性能测试计划</title><link>http://www.blogjava.net/qileilove/articles/409936.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Mon, 17 Feb 2014 07:14:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/articles/409936.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/409936.html</wfw:comment><comments>http://www.blogjava.net/qileilove/articles/409936.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/409936.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/409936.html</trackback:ping><description><![CDATA[<div style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><p style="margin-top: 10px; margin-bottom: 10px;">　上一章节中我们对性能的需求进行了分析，知道了测试对象，了解了测试需求，那么下面就需要制定一份详细的计划，来规划和指导性能测试工作的进行。为了使你对性能测试计划更清晰明白，这里以测试计划的格式来描述。</p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 14pt;"><strong>一．简介</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;">　　简介部分就不用过多描述了，无非项目的背景，进行此次性能测试的原因，以及性能测试覆盖的范围等等，几乎所有项目文档都在开端对项目进行简单的阐述。</p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 14pt;"><strong>二．性能测试需求</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;">寻找的被测试对象和压力点</p><p style="margin-top: 10px; margin-bottom: 10px;">　　要测试的对象不是凭空想象出来，而是经过分析与系统数据收集得到。下取几个典型的压力点</p><p style="margin-top: 10px; margin-bottom: 10px;"><strong>登录</strong>：对于一般的系统来说，登录是用户操作系统的前提，如果用户根本就登录不了，那么其它功能将毫无用处。例如网游戏，开新服的时候，玩家挤破了脑袋只为登录。</p><p style="margin-top: 10px; margin-bottom: 10px;"><strong>查询</strong>：查询一般比较消耗系统和数据库资源。搜索引擎的查询功能就是典型，如果你在输入框内输入内容，很久就得不到结果。我想被称为&#8220;互联网入口&#8221;的搜索引擎就不会存在。</p><p style="margin-top: 10px; margin-bottom: 10px;"><strong>交易</strong>：对于一些电子商务系统来说，交易过程的性能要求是很高的，如果交易过程消耗用户很长时间的话。我宁愿去超市买东西了。当然，除了交易速度外，对交易的成功率要求也是非常高的。不然，造成的损失也是不可估量的。</p><p style="margin-top: 10px; margin-bottom: 10px;">被测的系统应该是最重要的最基本的功能，也是用户使用最频繁的功能。</p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><strong>一般的性能要求包括：</strong></p><p style="margin-top: 10px; margin-bottom: 10px;"><strong>系统容量</strong>：系统最大容纳多少个用户注册。</p><p style="margin-top: 10px; margin-bottom: 10px;"><strong>访问数</strong>：同时访问系统的用户数。</p><p style="margin-top: 10px; margin-bottom: 10px;"><strong>并发数</strong>：一个操作同时执行的并发数目，一个系统中应该有不同操作的并发数的组合（一般是有权限进行操作的用户）。</p><p style="margin-top: 10px; margin-bottom: 10px;"><strong>系统的最大用户数与最佳用户数</strong>:系统在承受的最大并发用户数量，系统在最佳状态下承受的并发用户数据。</p><p style="margin-top: 10px; margin-bottom: 10px;"><strong>响应时间</strong>：用户提交一个操作到得到响应的时间间隔。</p><p style="margin-top: 10px; margin-bottom: 10px;"><strong>吞吐率</strong>：系统每秒钟处理的TPS</p><p style="margin-top: 10px; margin-bottom: 10px;">　　性能测试关键的一个因素就是压力，性能是在系统设计满足的最大压力下的性能。并发数要不小于系统正常运行的峰值，数据总量不小于系统正常运行3个月的数据量。</p><p style="margin-top: 10px; margin-bottom: 10px;">　　在描述并发用户数目时，总是会带有相应的时间段限制。系统的性能指标实质上应当使用单位时间内系统处理请求的个数以及请求响应时间描述。单位时间内能处理的请求个数就是系统的业务吞吐量。虚拟并发用户的数量可以使用如下的公式换算：&nbsp;（真实用户数&#215;每个真实用户请求数）/(总请求响应时间+真实用户总思考时间)=(虚拟用户数&#215;每用户请求个数)/(总请求响应时间+虚拟用户总思考时间)=吞吐量。</p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p></div><div style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 14pt;"><strong>三．测试环境</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;">这里的测试环境主要指的软件硬件环境和网络环境。</p><p style="margin-top: 10px; margin-bottom: 10px;">　　笔者认为性能测试最好在一个独立的环境内进行，这样不会受到外界的干扰，能够保证测试的数据是独立有效的。如果现你对某个已经上线的网站进行压力测试，那么你得到的数据不是独立的，因为你在做压力测试的时候，其它散户也在访问系统。</p><p style="margin-top: 10px; margin-bottom: 10px;">软件环境：</p><p style="margin-top: 10px; margin-bottom: 10px;">　　这里的软件环境主要指项目运行的环境，比如采用什么样的操作系统、中间件、和数据库。</p><p style="margin-top: 10px; margin-bottom: 10px;">硬件环境：</p><p style="margin-top: 10px; margin-bottom: 10px;">　　这里的硬件环境除了主要包括主机内部部件，<span style="font-family: 'Times New Roman';">cpu</span><span style="font-family: 宋体;">、内存、磁盘以及主板、网卡等，传输介质和路由器也应该考虑在内，</span></p><p style="margin-top: 10px; margin-bottom: 10px;">网络环境：</p><p style="margin-top: 10px; margin-bottom: 10px;">　　网络环境除了考虑测试机与被系统服务器在一个局域网中进行，还应该保证这个网络的独立性。如果在在性能测试的过程中，其它机子也在消耗着路由器资源。那么路由器也会影响到数据库的传输速度。</p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 14pt;"><strong>四．数据准备</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;">　　在很多时候，我们是要准备测试数据的，例如系统不允许相同用户的重复登录，那么必须要生成合法的用户数据。有时要对系统进行查询测试，只有在系统有一定数据量进才能验证出系统的真实性能。一个数据库中有两条数据和有两千万条数据，同相一条查询操作，对系统造成的压力是完全不一样的。</p><p style="margin-top: 10px; margin-bottom: 10px;">系统所需数据的分析可以参考以下方式：</p><p style="margin-top: 10px; margin-bottom: 10px;">　　历史数据分析有助于数据量级的确定。从历史数据入手，找出高峰期数据量。</p><p style="margin-top: 10px; margin-bottom: 10px;">　　从其他相似或者相同系统入手，进行数据分析，找出高峰期数据量。</p><p style="margin-top: 10px; margin-bottom: 10px;">　　无历史或者相关系统可以参考的时候，就要对系统的性能数据进行估算，包含系统容量，并发数等数据，估算以后给相关人员进行评审或者修订以后，按照大家同意的性能指标进行测试。</p><p style="margin-top: 10px; margin-bottom: 10px;">&#8230;&#8230;&#8230;&#8230;</p><p style="margin-top: 10px; margin-bottom: 10px;">　　测试数据最好和真实数据相同，如果能够获得真实系统运行3个月的数据，我们就可以在此基础上进行性能测试。</p><p style="margin-top: 10px; margin-bottom: 10px;">　　关于数据的生成，我们可以祝一个工具完成，如数据库数据生成工具，大小文件生成工具等。</p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 14pt;"><strong>五．测试工具</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;">　　前面已经介绍如何分析需求，需求确定下来之后，我们可以考虑引入什么样的工具适合性能需求。</p><p style="margin-top: 10px; margin-bottom: 10px;">　　当然，在引入工具的时候除了考虑可以是否满足需求，还应该考虑工具的成本，这不单指工具的购买成本，还有测试人员对工具的学习成本。</p><p style="margin-top: 10px; margin-bottom: 10px;">　　关于测试工具的选择，后面会单独有一章节介绍，这里就不细说了。</p><p style="margin-top: 10px; margin-bottom: 10px;">　　如果你选择的性能测试工具不是足够的强大的话，你可能还需要其它的辅助的工具。如果<span style="font-family: 'Times New Roman';">jmeter</span><span style="font-family: 宋体;">利用</span><span style="font-family: 'Times New Roman';">badboy</span><span style="font-family: 宋体;">来录制脚本，更能提高脚本开发效率。在压力测试的过程中也可能需要性能计数器来记录软硬件的性能。如监控服务器</span><span style="font-family: 'Times New Roman';">cpu</span><span style="font-family: 宋体;">、内存的计数器，记录中间件日志的监控中工具，监控数据库性能的监控工具等。</span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 14pt;"><strong>六．测试策略</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;">　　对于一个特定的业务系统，用户一般会分散在一天的各个时间段进行访问。在不同的时间段中，用户使用业务系统的频率不同，而系统的繁忙程度不同。在一些特定的条件下，可能出现短时间内用户集中访问某个业务系统的情况。例如对于公文处理子系统而言，可能就存在短时间内大量用户查看并办理某条公文的情况。&nbsp;在进行性能测试时，应当使用&#8220;考虑最坏情况的原则&#8221;。也就是应当在用户使用业务系统最频繁、对系统造成最大压力的情况下对系统的功能进行测试，判断各功能和页面是否能够满足性能的要求，系统的响应时间是否过长。</p><p style="margin-top: 10px; margin-bottom: 10px;">　　另一方面，系统性能的验证必须做到&#8220;覆盖全面&#8221;。虽然系统中各个功能的使用频率并不相同，一些功能的使用频率相对于其他功能来说比较低，但是在进行性能测试和优化时，不能忽略这些功能，编制测试用例时也不能仅仅选择最常用功能。例如可能所有的用户都会访问我的通知列表，但是一般只有5%的用户会使用通过系统设置模块查找某个用户的信息；但是在测试时，我们并不能因为查看用户信息功能的使用频率相对较少，而忽略掉这项功能的测试。所以，这里进行系统性能测试时，对于不同业务，用户的访问比例应该做一个合理分配。</p><p style="margin-top: 10px; margin-bottom: 10px;">　　在测试策略上，我们还应该考虑，同一个系统在不同硬件环境下的性能表现。从而让系统满足需求的情况下，硬件配置也能达到一个最佳的状态。过份的增加硬件来满足需求也是一种浪费。再说增加硬件设备不是能解决所有性能问题的。</p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 14pt;"><strong>七．人力与时间安排</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;">　　最后一条，就是要根据项目的进度要求以及规模，来进行人力与时间的安排。对于大型的性能测试，项目前期的需求调研，环境的部署，工具的选购或开发，人员对测试工具的学习与使用，性能测试的后进行，后期数据的分析与调优。都需要人员安排的。有可以需要专业的，系统工程师、数据库工程师、软件开发工程师、网络工程师以及性能测试工程师的共同参与配合完成。不是一个性能测试人员就可以全部搞定的。</p><p style="margin-top: 10px; margin-bottom: 10px;">　　笔者听说，最牛<span style="font-family: 'Times New Roman';">x</span><span style="font-family: 宋体;">的性能测试，需要几个国家的十几个城市的性能测试团队同步时行。前期的准备工作就需要几个月的时间。如何把控性能测试的同步进行。后期测试数据的汇总与分析。是一个非常复杂的过程。这个例子有待考证，我想说明的是，对于大项目的性能测试，人员与时间安排也至关重要。</span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-family: 宋体;">----------------------</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-family: 宋体;">　　根据项目的不同，我们在做性能测试计划椒考虑的问题不仅仅上面这些内容，这一节所罗列的内容是基本需要考虑的因素。</span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;<a href="/Files/qileilove/性能测试计划_XX项目.doc">/Files/qileilove/性能测试计划_XX项目.doc</a></p></div><img src ="http://www.blogjava.net/qileilove/aggbug/409936.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-02-17 15:14 <a href="http://www.blogjava.net/qileilove/articles/409936.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试之性能需求分析</title><link>http://www.blogjava.net/qileilove/articles/409860.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Fri, 14 Feb 2014 05:56:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/articles/409860.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/409860.html</wfw:comment><comments>http://www.blogjava.net/qileilove/articles/409860.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/409860.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/409860.html</trackback:ping><description><![CDATA[<p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　需求分析是个繁杂过程，它并非我们想象的那么简单，而性能测试需求除了要对系统的业务非常了解，还需要有深厚性能测试知识。才能够挖掘分析出真正的性能需求。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 14pt;"><strong>如何获得有效的需求</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 14pt;"><strong>&nbsp;</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">1、客户方提出</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　客户方能提出明确的性能需求，说明对方很重视性能测试，这样的企业一般是金融、电信、银行、医疗器械等；他们一般对系统的性能要求非常高，对性能也非常了解。提出需求也比较明确。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　曾经有一个银行项目，已经到最后的性能测试极端，因为数据库设计不合理，导致性能出现很大的问题，最终不得不把整合项目作废，对于这样的项目，其实从分析设计阶段就应该考虑系统的性能问题。性能测试也一样，对于某些项目来说越早进行越好。当然，前期的性能测试为单元性能测试、接口性能测试，有别系统性能测试。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　有时候也会碰到不懂装懂的客户，提出一些无理的需求，比如只能<span style="font-family: 'Times New Roman';">2000</span><span style="font-family: 宋体;">人使用的</span><span style="font-family: 'Times New Roman';">OA</span><span style="font-family: 宋体;">系统，客户要求并发用户</span><span style="font-family: 'Times New Roman';">2000</span><span style="font-family: 宋体;">，这显然是不合理的需求。这个就要看你怎么给客户沟通了。但是，千万别伪造数据欺骗客户。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">2、根据历史数据分析</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　对于一些面向用户的独特产品，比较难定位市场的大小，可以先上一运营一段时间，通过运营可以搜集客户资料，比如，每月、每星期、每天的峰值业务量是多少。用户以 什么样的速度在递增中。用户对系统的哪些功能模块使用的最多，他们所点的比例等等。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　收集到这些数据之后，我们就可评估系统的系统需求指标，从而进行性能测试。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">3、需求分析与定位</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　这里根据前期的需求分析与定位，来分析确定系统性能指标。例如某省幼儿园管理系统。统计全省有多少家幼儿园，系统的使用时间为幼儿到校之后，管理人员对幼儿的到校情况进行录入，以及幼儿的午饭，放学情况的录入时间。经过与需求人员交流分析也能得到比较明确的性能指标。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">4、参考历史项目或其它同行业的项目</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　如果公司之前有类似的项目经验，根据项目大小及上次性能测试的一些指标。从根据项目的规模可以制定出相应的性能指标。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　即使本公司没有类似的项目，但其它公司有类似的项目，例如做IPTV或者DVB计费系统的测试，可以参考电信计费系统的需求&#8212;&#8212;虽然不能完全照搬数据，但是可以通过其他行业成熟的需求来了解需要测试的项目有哪些，应该考虑到的情况有哪些种。&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">5、参考其它资料数据</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　如果你做的是非常独特的产品，市场上没有此类型的产品，而且需求及市场也难以估计，那么只能从与产品相关的资料中寻找痕迹了。不过，相信这样不确定性的产品，老板要承担的风险也是挺大的。<span style="font-family: 'Times New Roman';">^_^</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　需要说明的是，我上面介绍的方面并非是独立的，可以综合的使用，你可以根据客户提出的指标，再根据历史数据以及参考同类型项目来进行。这样可以更确定你的性能指标是客户（或自己）真正需要的、最符合项目需求的。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 14pt;"><strong>性能测试点的选取</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 14pt;"><strong>&nbsp;</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">*　　发生频率非常高的（例如：某邮箱核心业务系统中的登录、收发邮件等业务，它们在每天的业务总量中占到<span style="font-family: 'Times New Roman';">90%</span><span style="font-family: 宋体;">以上）</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">*　　关键程度非常高的（产品经理认为绝对不能出现问题的，如登录等）</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">*　　资源占用非常严重的（导致磁盘<span style="font-family: 'Times New Roman';">I/O</span><span style="font-family: 宋体;">非常大的，例如某个业务进行结果提交时需要向数十个表存取数据，或者一个查询提交请求时会检索出大量的数据记录）</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 14pt;"><strong>对性能需求点的描述</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 14pt;"><strong>&nbsp;</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">准确</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">如<span style="font-family: 'Times New Roman';">**</span><span style="font-family: 宋体;">系统必须在不超过&nbsp;</span><span style="font-family: 'Times New Roman';">10&nbsp;</span><span style="font-family: 宋体;">秒的响应时间内</span><span style="font-family: 'Times New Roman';">,</span><span style="font-family: 宋体;">处理&nbsp;</span><span style="font-family: 'Times New Roman';">20&nbsp;</span><span style="font-family: 宋体;">起登录任务。再如发邮件时间最大不超过</span><span style="font-family: 'Times New Roman';">5</span><span style="font-family: 宋体;">秒以及平均时间在</span><span style="font-family: 'Times New Roman';">2</span><span style="font-family: 宋体;">秒以内。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">一致</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">用户和性能测试工程师对有关术语的理解要一致<span style="font-family: 'Times New Roman';">,</span><span style="font-family: 宋体;">如</span><span style="font-family: 'Times New Roman';">:</span><span style="font-family: 宋体;">并发用户数、在线用户数、注册用户数</span><span style="font-family: 'Times New Roman';">:&nbsp;</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">特定</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">性能测试的需求一定是有条件的。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">检查系统后台关键业务数据<span style="font-family: 'Times New Roman';">10G</span><span style="font-family: 宋体;">、操作数据量为</span><span style="font-family: 'Times New Roman';">20K,&nbsp;1500&nbsp;</span><span style="font-family: 宋体;">个用户、</span><span style="font-family: 'Times New Roman';">500&nbsp;</span><span style="font-family: 宋体;">个并发用户运行的负载下，连续运行</span><span style="font-family: 'Times New Roman';">12</span><span style="font-family: 宋体;">小时过程中</span><span style="font-family: 'Times New Roman';">,</span><span style="font-family: 宋体;">业务操作是否满足性能需求。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 14pt;"><strong>常见性能需求</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 14pt;"><strong>&nbsp;</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">1<span style="font-family: 宋体;">、</span><span style="font-family: 'Times New Roman';">WEB</span><span style="font-family: 宋体;">首页打开速度</span><span style="font-family: 'Times New Roman';">5s</span><span style="font-family: 宋体;">以下，</span><span style="font-family: 'Times New Roman';">web</span><span style="font-family: 宋体;">登陆速度&nbsp;</span><span style="font-family: 'Times New Roman';">15s</span><span style="font-family: 宋体;">以下。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">2<span style="font-family: 宋体;">、邮件服务支持</span><span style="font-family: 'Times New Roman';">50</span><span style="font-family: 宋体;">万个在线用户</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">3<span style="font-family: 宋体;">、计费话单成功率达到</span><span style="font-family: 'Times New Roman';">99.999%</span><span style="font-family: 宋体;">以上。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">4<span style="font-family: 宋体;">、在</span><span style="font-family: 'Times New Roman';">100</span><span style="font-family: 宋体;">个并发用户的高峰期，邮箱的基本功能，处理能力至少达到</span><span style="font-family: 'Times New Roman';">10TPS</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">5<span style="font-family: 宋体;">、系统能在高于实际系统运行压力</span><span style="font-family: 'Times New Roman';">1</span><span style="font-family: 宋体;">倍的情况下，稳定的运行</span><span style="font-family: 'Times New Roman';">12</span><span style="font-family: 宋体;">小时&nbsp;</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">6<span style="font-family: 宋体;">、这个系统能否支撑</span><span style="font-family: 'Times New Roman';">200</span><span style="font-family: 宋体;">万的</span><span style="font-family: 'Times New Roman';">vu</span><span style="font-family: 宋体;">（每天登录系统的人次） &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #008000;">vu----Virtual user(虚拟用户)</span>&nbsp;</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 14pt;"><strong>"不成文"的性能需求指标：　　</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 14pt;"><strong>&nbsp;</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>响应时间</strong>：根据国外的一些资料，一般操作的响应时间为<span style="font-family: 'Times New Roman';">2</span><span style="font-family: 宋体;">，</span><span style="font-family: 'Times New Roman';">5</span><span style="font-family: 宋体;">，</span><span style="font-family: 'Times New Roman';">8</span><span style="font-family: 宋体;">秒，</span><span style="font-family: 'Times New Roman';">2</span><span style="font-family: 宋体;">秒内优秀，</span><span style="font-family: 'Times New Roman';">5</span><span style="font-family: 宋体;">秒内良好，</span><span style="font-family: 'Times New Roman';">8</span><span style="font-family: 宋体;">秒内可接受，其它一些特殊的操作，如上传，下载可以依据用户体验的情况</span>，延长响应时间。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　Peter&nbsp;bickford&nbsp;<span style="font-family: 宋体;">在调查用户反应时发现：在连续</span><span style="font-family: 'Times New Roman';">27</span><span style="font-family: 宋体;">次即使反馈之后，第</span><span style="font-family: 'Times New Roman';">28</span><span style="font-family: 宋体;">次操作进，计算机让用户等待</span><span style="font-family: 'Times New Roman';">2</span><span style="font-family: 宋体;">分钟，结果半数人在第</span><span style="font-family: 'Times New Roman';">8.5</span><span style="font-family: 宋体;">秒左右就走开或者按下种启键。使用了鼠标指针变成漏斗提示的界面会把用户的等待时间延长到</span><span style="font-family: 'Times New Roman';">20</span><span style="font-family: 宋体;">秒左右，使用动画的鼠标指针漏斗提示界面则会让用户的等待时间超过</span><span style="font-family: 'Times New Roman';">1</span><span style="font-family: 宋体;">分钟，而进度条则可以让用户等待到最后。</span><span style="font-family: 'Times New Roman';">Peter&nbsp;bickford</span><span style="font-family: 宋体;">的调查结果被广泛用到</span><span style="font-family: 'Times New Roman';">web</span><span style="font-family: 宋体;">软件系统的性能需求的响应时间定义中。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　第三方研究表明，如果网页是逐步加载的，先出现横幅，再出现文字，最后出现图像。在这样的条件下，用户会忍受更长的等待时间，用户会把延迟在<span style="font-family: 'Times New Roman';">39</span><span style="font-family: 宋体;">秒内的也标识为&#8220;</span><span style="font-family: 'Times New Roman';">good</span><span style="font-family: 宋体;">&#8221;，超过</span><span style="font-family: 'Times New Roman';">56</span><span style="font-family: 宋体;">秒的才认为是&#8220;</span><span style="font-family: 'Times New Roman';">poor</span><span style="font-family: 宋体;">&#8221;的。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>80/20</strong><span style="font-family: 宋体;"><strong>原则</strong>：又称帕累托效应，比如，某一些系统一天中</span><span style="font-family: 'Times New Roman';">80%</span><span style="font-family: 宋体;">的访问量集中在</span><span style="font-family: 'Times New Roman';">20%</span><span style="font-family: 宋体;">的时间内。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 14pt;"><strong>如何根据性能需求进行测试</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 14pt;"><strong>&nbsp;</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">其实我们上面得到的需求指标仍然是不明确的：</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">是验证当前硬件和软件配置能否支撑<span style="font-family: 'Times New Roman';">200</span><span style="font-family: 宋体;">万</span><span style="font-family: 'Times New Roman';">vu</span><span style="font-family: 宋体;">？</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">是测试当前的硬件和软件配置最多能支撑多少<span style="font-family: 'Times New Roman';">vu?</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">是帮助开发寻找性能瓶颈？</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">根据需求进行性能测试的过程：</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><img src="http://pic002.cnblogs.com/images/2012/311516/2012081813561227.png" alt="" style="border: 0px;" /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　首先，请你们当前软件和硬件配置下验证能否支撑<span style="font-family: 'Times New Roman';">200</span><span style="font-family: 宋体;">万</span><span style="font-family: 'Times New Roman';">vu</span><span style="font-family: 宋体;">。如果可以支撑200万，再增加到300万看是否可以支撑。如果不能达到200万，那么就需要寻找一下是否有性能瓶颈，将主要的性能瓶颈解决后，再看一下是否可以支撑200万，如果可以支撑，输出测试结果。仍然不能，请评估需要添加多少硬件设备。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　通过上面流程的分析，那么我们对于需求实施过程就非常明确了。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 14pt;"><strong>下面看来分析某邮箱系统的需求</strong></span>：</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">按照&nbsp;某某&nbsp;邮箱<span style="font-family: 'Times New Roman';">20000</span><span style="font-family: 宋体;">万注册用户，其中日活跃用户数为</span><span style="font-family: 'Times New Roman';">1.5%</span><span style="font-family: 宋体;">的规模计算：</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">日活跃用户<span style="font-family: 'Times New Roman';">=20000*1.5%=300</span><span style="font-family: 宋体;">万</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">日活跃用户人均每天发<span style="font-family: 'Times New Roman';">6</span><span style="font-family: 宋体;">封邮件，用户使用客户端收发邮件比例</span><span style="font-family: 'Times New Roman';">20%</span><span style="font-family: 宋体;">，则：</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">每天发邮件投递量<span style="font-family: 'Times New Roman';">=300</span><span style="font-family: 宋体;">万</span><span style="font-family: 'Times New Roman';">*6*20%=360</span><span style="font-family: 宋体;">万封</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-family: 宋体;"><strong>&nbsp;</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-family: 宋体;"><strong>如何得到每秒的邮件数</strong>？</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">方式一： 严格的根据2/8原则 &nbsp;，80%的邮件集中在20%的时间发送。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">集中发邮件数： &nbsp;3600000*80%=28800000封</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">集中发送的时间：24*20%=4.8小时=17280秒</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">每秒发送邮件数：2880000/17280=166.7封/秒</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">方式二，根据&nbsp;某某邮箱业务模型表，每天忙时集中邮件系数<span style="font-family: 'Times New Roman';">0.15</span><span style="font-family: 宋体;">，邮件平均峰值系数</span><span style="font-family: 'Times New Roman';">2,</span><span style="font-family: 宋体;">则：</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">峰值邮件量<span style="font-family: 'Times New Roman';">=3600000*0.15*2/3600=300</span><span style="font-family: 宋体;">封</span><span style="font-family: 'Times New Roman';">/</span><span style="font-family: 宋体;">秒</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-family: 宋体;">注：</span>忙时集中系数<span style="font-family: 'Times New Roman';">=</span><span style="font-family: 宋体;">忙时业务量</span><span style="font-family: 'Times New Roman';">/</span><span style="font-family: 宋体;">全天业务量</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-family: 宋体;">&nbsp; &nbsp; &nbsp;在两种方式的分析中，方法二得出的结果是方法一的将近一倍，我们不要根据经验理所当然的去分析，要深入的了解系统，我们要对行业指标及计算方式。如果按照第一种方式，性能测试达标了，但系统真正上线后可能远远超出了我们的评估。2008年北京奥运运门票系统就是一个典型的案例。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong><span style="font-family: 宋体;">再来分析系统的登录：</span></strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　去年全年处理&#8220;<span style="font-family: 'Times New Roman';">WEB</span><span style="font-family: 宋体;">登录&#8221;交易约&nbsp;</span><span style="font-family: 'Times New Roman';">100&nbsp;</span><span style="font-family: 宋体;">万笔，考虑到&nbsp;</span><span style="font-family: 'Times New Roman';">3&nbsp;</span><span style="font-family: 宋体;">年后交易量递增到每年&nbsp;</span><span style="font-family: 'Times New Roman';">200</span><span style="font-family: 宋体;">万笔。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　假设每年交易量集中在&nbsp;<span style="font-family: 'Times New Roman';">8&nbsp;</span><span style="font-family: 宋体;">个月，每个月&nbsp;</span><span style="font-family: 'Times New Roman';">20&nbsp;</span><span style="font-family: 宋体;">个工作日，每个工作日&nbsp;</span><span style="font-family: 'Times New Roman';">8&nbsp;</span><span style="font-family: 宋体;">小时，试采用&nbsp;</span><span style="font-family: 'Times New Roman';">80</span><span style="font-family: 宋体;">～</span><span style="font-family: 'Times New Roman';">20&nbsp;</span><span style="font-family: 宋体;">原理估算系统服务器高峰期&#8220;</span><span style="font-family: 'Times New Roman';">WEB</span><span style="font-family: 宋体;">登录&#8221;的交易吞吐量应达到怎样的一个处理能力</span><span style="font-family: 宋体;">　　</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　200万/8=25万/月</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　25万/20=1.25万/日</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　1.25万*80%/(8*20%*3600)=1.74TPS</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-family: 宋体;">----------------------</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-family: 宋体;">　　上面的小案例算是抛出的一块砖，需求开发难度要远远大于需求管理，在实际工作中常常需要我们为客户开发这部分性能需求。所以，在追求技术的基础上，请更多的了解分析你的项目及行业指标。　　</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-family: 宋体;">&nbsp;2012-8-24 &nbsp;对部分内容进行的调整。</span></p><img src ="http://www.blogjava.net/qileilove/aggbug/409860.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-02-14 13:56 <a href="http://www.blogjava.net/qileilove/articles/409860.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试之系统架构分析</title><link>http://www.blogjava.net/qileilove/articles/409826.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 13 Feb 2014 09:12:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/articles/409826.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/409826.html</wfw:comment><comments>http://www.blogjava.net/qileilove/articles/409826.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/409826.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/409826.html</trackback:ping><description><![CDATA[<p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　之前有对性能需求进行过分析，那篇主要从项目业务、背景等角度如何抽丝剥茧的将项目的需求抽离出来。在我们进行需求的时候也需要对被测项目的架构有一定的认识，如果不了解被测系统的架构，那么在后期的性能分析与调优阶段将无从下手。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 18pt;"><strong><span style="background-color: #c0c0c0;">简单系统架构介绍 &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　因为每个公司的业务不同，采用的技术，架构也都有很大不同。但不管怎么变动，但基本都在三层架构的基础上扩展与改进。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">下面看一个基本的系统架构：</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><img src="http://pic002.cnblogs.com/images/2012/311516/2012101123571184.png" alt="" style="border: 0px;" /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>表示层</strong>：</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　表示层运行在客户终端上，运行<span style="font-family: 'Times New Roman';">java&nbsp;&nbsp;applet&nbsp;</span><span style="font-family: 宋体;">程序，提供协议控制和用户界面，与系统用户实现直接交互，通过</span><span style="font-family: 'Times New Roman';">TCP/HTTP</span><span style="font-family: 宋体;">协议与业务层系统通信，向应用层系统发送请求报文，并接收应用层系统返回的回应报文。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>业务逻辑层</strong>：</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　业务逻辑层作为中间层实现核心业务逻辑服务。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　应用服务器主要运行中间件系统，中间件系统系统作为一个容器来运行各种应用软件系统。前台发来的请求报文通过中间件传递给应用程序，应用程序在处理的过程中调用数据层的数据服务器，数据服务器将查询的数据返回给应用程序，应用软件处理完成后通过中间件系统返回给客户端。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　在大型的系统中，可以对应用系统进行拆分，比如拆分成交易服务，查询服务；或者通过负载均衡技术，来分散客户端发来的请求，使其能承受更大的用户访问量。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>数据层</strong>：</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　数据层运行在数据库主机上，负责整个系统中数据信息的存储。运行数据库服务程序，查询通过<span style="font-family: 'Times New Roman';">JDBC</span><span style="font-family: 宋体;">与应用程序进行通信，主要用于存储数据与提供数据查询等服务。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　数据库集群技术就是对大型系统应用非常广泛的一种解决方案。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 18pt;"><strong><span style="background-color: #c0c0c0;">大型系统架构介绍 &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　前面介绍了一般系统的架构，那么一个大型的系统在设计中使用了哪些手段或技术来提高系统的性能呢</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><img src="http://pic002.cnblogs.com/images/2012/311516/2012101200004974.png" alt="" style="border: 0px;" /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>操作系统</strong><br /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　操作系统是硬件与软件之间的桥梁，那么一个稳定的操作系统是系统坚实的基础。在个人操作系统领域，windows&nbsp;<span style="font-family: 宋体;">无疑是绝对的霸主，但随着近几年的发展，</span><span style="font-family: Verdana;">linux/unix</span><span style="font-family: 宋体;">以其不俗的性能表现，超强的稳定性与安全性使其在服务器领域变成重多企业的首选。因为系统服务器由少数技术人员使用，他们更看重系统的性能、稳定性和安全性等方面的表现。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>Web</strong><span style="font-family: 宋体;"><strong>服务器</strong><br /></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　Web<span style="font-family: 宋体;">服务器即中间件服务器，是应用程序的载体（容器），应用程序只有在中间件服务器上才能正常的运行被外界所访问使用。对于</span><span style="font-family: Verdana;">window</span><span style="font-family: 宋体;">系统来说，</span><span style="font-family: Verdana;">IIS</span><span style="font-family: 宋体;">是微软配套的</span><span style="font-family: Verdana;">web</span><span style="font-family: 宋体;">服务器，他们的搭配应该是夫妻是之间的默契；</span><span style="font-family: Verdana;">apache&nbsp;</span><span style="font-family: 宋体;">作为开源力量代表，不管在</span><span style="font-family: Verdana;">windows</span><span style="font-family: 宋体;">还是</span><span style="font-family: Verdana;">linux</span><span style="font-family: 宋体;">下面都非常得宠。因为</span><span style="font-family: Verdana;">linux</span><span style="font-family: 宋体;">与</span><span style="font-family: Verdana;">apache&nbsp;</span><span style="font-family: 宋体;">都为开源产品且性能优异，应用非常广泛。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　&#183;&nbsp;淘宝网（阿里巴巴）<span style="font-family: Verdana;">:&nbsp;Linux</span><span style="font-family: 宋体;">操作系统&nbsp;</span><span style="font-family: Verdana;">+&nbsp;Web&nbsp;</span><span style="font-family: 宋体;">服务器</span><span style="font-family: Verdana;">:&nbsp;Apache</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　&#183;&nbsp;新浪：<span style="font-family: Verdana;">FreeBSD&nbsp;+&nbsp;Web&nbsp;</span><span style="font-family: 宋体;">服务器：</span><span style="font-family: Verdana;">Apache</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　&#183;&nbsp;Yahoo<span style="font-family: 宋体;">：</span><span style="font-family: Verdana;">FreeBSD&nbsp;+&nbsp;Web&nbsp;</span><span style="font-family: 宋体;">服务器：自己的</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　&#183;&nbsp;Google:&nbsp;<span style="font-family: 宋体;">部分</span><span style="font-family: Verdana;">Linux&nbsp;+&nbsp;Web&nbsp;</span><span style="font-family: 宋体;">服务器：自己的</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　&#183;&nbsp;百度：<span style="font-family: Verdana;">Linux&nbsp;+&nbsp;Web&nbsp;</span><span style="font-family: 宋体;">服务器</span><span style="font-family: Verdana;">:&nbsp;Apache</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　&#183;&nbsp;网易：<span style="font-family: Verdana;">Linux&nbsp;+&nbsp;Web&nbsp;</span><span style="font-family: 宋体;">服务器</span><span style="font-family: Verdana;">:&nbsp;Apache</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　&#183;&nbsp;eBay:&nbsp;Windows&nbsp;Server&nbsp;2003/8&nbsp;(<span style="font-family: 宋体;">大量</span><span style="font-family: Verdana;">)&nbsp;+&nbsp;Web&nbsp;</span><span style="font-family: 宋体;">服务器：</span><span style="font-family: Verdana;">Microsoft&nbsp;IIS</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　&#183;&nbsp;MySpace:&nbsp;Windows&nbsp;Server&nbsp;2003/8&nbsp;+&nbsp;Web&nbsp;<span style="font-family: 宋体;">服务器：</span><span style="font-family: Verdana;">Microsoft&nbsp;IIS</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>常用的系统架构是</strong><span style="font-family: Verdana;">:</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&#183;&nbsp;Linux&nbsp;+&nbsp;Apache&nbsp;+&nbsp;PHP&nbsp;+&nbsp;MySQL</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&#183;&nbsp;Linux&nbsp;+&nbsp;Apache&nbsp;+&nbsp;Java&nbsp;(WebSphere)&nbsp;+&nbsp;Oracle</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&#183;&nbsp;Windows&nbsp;Server&nbsp;2003/2008&nbsp;+&nbsp;IIS&nbsp;+&nbsp;C#/ASP.NET&nbsp;+&nbsp;<span style="font-family: 宋体;">数据库</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&#183;&nbsp;Window&nbsp;Server&nbsp;2003/2008&nbsp;+&nbsp;tomcat&nbsp;+&nbsp;MySql</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 18pt;"><strong><span style="background-color: #c0c0c0;">提高系统性能的相关技术 &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 18px;"><strong>网页HTML&nbsp;静态化</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　其实大家都知道网页静态化,效率最高,消耗最小的就是纯静态化的&nbsp;html&nbsp;页面,所以我们尽可能使我们的网站上的页面采用静态页面来实现,这个最简单的方法其实也是最有效的方法。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　但是对于大量内容并且频繁更新的网站,我们无法全部手动去挨个实现,于是出现了我们常见的信息发布系统&nbsp;CMS,像我们常访问的各个门户站点的新闻频道,甚至他们的其他频道,都是通过信息发布系统来管理和实现的,信息发布系统可以实现最简单的信息录入自动生成静态页面,还能具备频道管理,权限管理,自动抓取等功能,</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　对于一个大型网站来说,拥有一套高效,可管理的CMS&nbsp;是必不可少的，除了门户和信息发布类型的网站,对于交互性要求很高的社区类型网站来说,尽可能的静态化也是提高性能的必要手段,将社区内的帖子,文章进行实时的静态化,有更新的时候再重新静态化也是大量使用的策略,像Mop&nbsp;的大杂烩就是使用了这样的策略,网易社区等也是如此同时,html&nbsp;静态化也是某些缓存策略使用的手段,</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　对于系统中频繁使用数据库查询但是内容更新很小的应用,可以考虑使用&nbsp;html&nbsp;静态化来实现,比如论坛中论坛的公用设置信息,这些信息目前的主流论坛都&nbsp;可以进行后台管理并且存储再数据库中,这些信息其实大量被前台程序调用,但是更新频率很小,可以&nbsp;考虑将这部分内容进行后台更新的时候进行静态化,这样避免了大量的数据库访问请求；</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 18px;"><strong>图片服务器分离</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　对Web&nbsp;服务器来说,不管是&nbsp;Apache,IIS&nbsp;还是其他容器,图片是最消耗资源的,于是我们&nbsp;有必要将图片与页面进行分离,这是基本上大型网站都会采用的策略,他们都有独立的图片服务器,甚至很多台图片服务器，这样的架构可以降低提供页面访问请求的服务器系统压力,并且可以保证系统不&nbsp;会因为图片问题而崩溃,在应用服务器和图片服务器上,可以进行不同的配置优化,比如&nbsp;apache&nbsp;在配置&nbsp;ContentType&nbsp;的时候可以尽量少支持,尽可能少的&nbsp;LoadModule,保证更高的系统消耗和执行效率；</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 18px;"><strong>数据库集群和库表散列&nbsp;</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　大型网站都有复杂的应用,这些应用必须使用数据库,那么在面对大量访问的时候,数据库的瓶颈很快就能显现出来,这时一台数据库将很快无法满足应用,于是我们需要使用数据库集群或者库表散列。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　在数据库集群方面,&nbsp;很多数据库都有自己的解决方案,&nbsp;Oracle,&nbsp;Sybase&nbsp;等都有很好的方案,常用的&nbsp;MySQL&nbsp;提供的&nbsp;Master/Slave&nbsp;也是类似的方案,您使用了什么样的&nbsp;DB,就参考相应的解决方案来实施即可。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　上面提到的数据库集群由于在架构,成本,扩张性方面都会受到所采用&nbsp;DB&nbsp;类型的限制,于是我们需要从应用程序的角度来考虑改善系统架构,库表散列是常用并且最有效的解决方案，我们在应用程序中安装&nbsp;业务和应用或者功能模块将数据库进行分离,不同的模块对应不同的数据库或者表,再按照一定的策略&nbsp;对某个页面或者功能进行更小的数据库散列,比如用户表,按照用户&nbsp;ID&nbsp;进行表散列,这样就能够低成本&nbsp;的提升系统的性能并且有很好的扩展性，sohu&nbsp;的论坛就是采用了这样的架构,将论坛的用户,设置,帖&nbsp;子等信息进行数据库分离,然后对帖子,用户按照板块和&nbsp;ID&nbsp;进行散列数据库和表,最终可以在配置文件&nbsp;中进行简单的配置便能让系统随时增加一台低成本的数据库进来补充系统性能；</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 18px;"><strong>缓存</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　缓存一词搞技术的都接触过,很多地方用到缓存，网站架构和网站开发中的缓存也是非常重要，这里先&nbsp;讲述最基本的两种缓存，高级和分布式的缓存在后面讲述，&nbsp;架构方面的缓存,对&nbsp;Apache&nbsp;比较熟悉的人都能知道&nbsp;Apache&nbsp;提供了自己的缓存模块,也可以使用外加的&nbsp;Squid&nbsp;模块进行缓存,这两种方式均可以有效的提高&nbsp;Apache&nbsp;的访问响应能力，&nbsp;网站程序开发方面的缓存,Linux&nbsp;上提供的&nbsp;Memory&nbsp;Cache&nbsp;是常用的缓存接口,可以在&nbsp;web&nbsp;开发中使用,&nbsp;比如用&nbsp;Java&nbsp;开发的时候就可以调用&nbsp;MemoryCache&nbsp;对一些数据进行缓存和通讯共享,&nbsp;一些大型社区使用了&nbsp;这样的架构，&nbsp;另外,&nbsp;在使用&nbsp;web&nbsp;语言开发的时候,&nbsp;各种语言基本都有自己的缓存模块和方法,&nbsp;PHP&nbsp;有&nbsp;Pear&nbsp;的&nbsp;Cache&nbsp;模块,Java&nbsp;就更多了,net&nbsp;不是很熟悉,相信也肯定有；</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 18px;"><strong>镜像</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">镜像是大型网站常采用的提高性能和数据安全性的方式,镜像的技术可以解决不同网络接入商和地域带来的用户访问速度差异,&nbsp;比如&nbsp;ChinaNet&nbsp;和&nbsp;EduNet&nbsp;之间的差异就促使了很多网站在教育网内搭建镜像站点,数据进行定时更新或者实时更新，在镜像的细节技术方面,这里不阐述太深,有很多专业的现成的解决&nbsp;架构和产品可选，也有廉价的通过软件实现的思路,比如&nbsp;Linux&nbsp;上的&nbsp;rsync&nbsp;等工具；</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong><span style="font-size: 18px;">负载均衡</span></strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">负载均衡将是大型网站解决高负荷访问和大量并发请求采用的终极解决办法，负载均衡技术发展了多年,有很多专业的服务提供商和产品可以选择,下面介绍几种常见的负载均衡。</p><h4>1.&nbsp;基于<span style="font-family: Arial;">DNS</span><span style="font-family: 黑体;">的负载均衡</span><span style="font-family: Arial;">--</span><span style="font-family: 黑体;">一个域名绑定多个</span><span style="font-family: Arial;">IP</span></h4><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　DNS<span style="font-family: 宋体;">负载均衡技术是最早的负载均衡解决方案，它是通过</span><span style="font-family: Arial;">DNS</span><span style="font-family: 宋体;">服务中的随机名字解析来实现的，在</span><span style="font-family: Arial;">DNS</span><span style="font-family: 宋体;">服务器中，可以为多个不同的地址配置同一个名字，而最终查询这个名字的客户机将在解析这个名字时得到其中的一个地址。因此，对于同一个名字，不同的客户机会得到不同的地址，它们也就访问不同地址上的</span><span style="font-family: Arial;">Web&nbsp;</span><span style="font-family: 宋体;">服务器，从而达到负载均衡的目的。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　这种技术的优点是，实现简单、实施容易、成本低、适用于大多数<span style="font-family: Arial;">TCP/IP</span><span style="font-family: 宋体;">应用；但是，其缺点也非常明显，首先这种方案不是真正意义上的负载均衡，</span><span style="font-family: Arial;">DNS&nbsp;</span><span style="font-family: 宋体;">服务器将</span><span style="font-family: Arial;">Http</span><span style="font-family: 宋体;">请求平均地分配到后台的</span><span style="font-family: Arial;">Web</span><span style="font-family: 宋体;">服务器上，而不考虑每个</span><span style="font-family: Arial;">Web</span><span style="font-family: 宋体;">服务器当前的负载情况；如果后台的</span><span style="font-family: Arial;">Web</span><span style="font-family: 宋体;">服务器的配置和处理能力不同，最慢的&nbsp;</span><span style="font-family: Arial;">Web</span><span style="font-family: 宋体;">服务器将成为系统的瓶颈，处理能力强的服务器不能充分发挥作用；其次未考虑容错，如果后台的某台</span><span style="font-family: Arial;">Web</span><span style="font-family: 宋体;">服务器出现故障，</span><span style="font-family: Arial;">DNS</span><span style="font-family: 宋体;">服务器仍然会把</span><span style="font-family: Arial;">DNS&nbsp;</span><span style="font-family: 宋体;">请求分配到这台故障服务器上，导致不能响应客户端。最后一点是致命的，有可能造成相当一部分客户不能享受</span><span style="font-family: Arial;">Web</span><span style="font-family: 宋体;">服务，并且由于</span><span style="font-family: Arial;">DNS</span><span style="font-family: 宋体;">缓存的原因，所造成的后果要持续相当长一段时间</span><span style="font-family: Arial;">(</span><span style="font-family: 宋体;">一般</span><span style="font-family: Arial;">DNS</span><span style="font-family: 宋体;">的刷新周期约为</span><span style="font-family: Arial;">24</span><span style="font-family: 宋体;">小时</span><span style="font-family: Arial;">)</span><span style="font-family: 宋体;">。所以在国外最新的建设中心</span><span style="font-family: Arial;">Web</span><span style="font-family: 宋体;">站点方案中，已经很少采用这种方案了</span>。</p><h4>2.&nbsp;通过硬件四层交换实现负载均衡</h4><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　在硬件四层交换产品领域，有一些知名的产品可以选择，比如Alteon、F5等，这些产品很昂贵，但是物有所值，能够提供非常优秀的性能和很灵活的管理能力。Yahoo中国当初接近2000台服务器使用了三四台Alteon就搞定了</p><h4>3.&nbsp;通过软件四层交换实现负载均衡</h4><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　软件四层交换我们可以使用Linux上常用的LVS来解决，LVS就是Linux&nbsp;Virtual&nbsp;Server，他提供了基于心跳线heartbeat的实时灾难应对解决方案，提高系统的鲁棒性，同时可供了灵活的虚拟VIP配置和管理功能，可以同时满足多种应用需求，这对于分布式的系统来说必不可少。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">一个典型的使用负载均衡的策略就是，在软件或者硬件四层交换的基础上搭建squid集群，这种思路在很多大型网站包括搜索引擎上被采用，这样的架构低成本、高性能还有很强的扩张性。</p><h4>4.&nbsp;通过反向代理服务器实现负载均衡</h4><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　反向代理服务器又称为&nbsp;WEB&nbsp;加速服务器，它位于&nbsp;WEB&nbsp;服务器的前端，充当WEB服务器的内容缓存器,反向代理服务器是针对&nbsp;WEB&nbsp;服务器设置的，后台&nbsp;WEB&nbsp;服务器对互联网用户是透明的，用户只能看到反向代理服务器的地址，不清楚后台&nbsp;WEB&nbsp;服务器是如何组织架构的。当互联网用户请求&nbsp;WEB&nbsp;服务时，DNS&nbsp;将请求的域名解析为反向代理服务器的&nbsp;IP&nbsp;地址，这样&nbsp;URL&nbsp;请求将被发送到反向代理服务器，由反向代理服务器负责处理用户的请求与应答、与后台&nbsp;WEB&nbsp;服务器交互。利用反向代理服务器减轻了后台&nbsp;WEB&nbsp;服务器的负载，提高了访问速度，同时避免了因用户直接与&nbsp;WEB&nbsp;服务器通信带来的安全隐患。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">-------------------------------------</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp; &nbsp; &nbsp; 这篇文章非常纠结，以目前技术水平来讲这块的东西实属班门弄斧。部分内容从互联网搜集。<br /><br /><br /><a href="http://blog.csdn.net/zfrong/article/details/5992349" style="color: #000000; text-decoration: none; font-family: 'Microsoft YaHei'; font-size: 20px; line-height: 30px;">各种系统架构图及其简介<br /><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;"><span style="color: #ff0000;">1.Spring&nbsp;架构图</span></p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;">&nbsp;&nbsp;Spring&nbsp;是一个<a target="_self" style="color: #ca0000;"><span style="text-decoration: underline;"><span style="color: #108ac6;"><strong>开源</strong>&nbsp;</span></span></a>框架，是为了解决<a target="_self" style="color: #ca0000;"><span style="text-decoration: underline;"><span style="color: #108ac6;"><strong>企业</strong>&nbsp;</span></span></a>应用程序开发复杂性而创建的。框架的主要优势之一就是其分层架构，分层架构允许您选择使用哪一个组件，同时为J2EE&nbsp;应用程序开发提供集成的框架。Spring&nbsp;框架的功能可以用在任何J2EE&nbsp;服务器中，大多数功能也适用于不受<a target="_self" style="color: #ca0000;"><span style="text-decoration: underline;"><span style="color: #108ac6;"><strong>管理</strong>&nbsp;</span></span></a>的环境。Spring的核心要点是：支持不绑定到特定J2EE&nbsp;服务的可重用业务和数据访问对象。这样的对象可以在不同J2EE&nbsp;环境（<a target="_self" style="color: #ca0000;"><span style="text-decoration: underline;"><span style="color: #108ac6;"><strong>Web</strong>&nbsp;</span></span></a>或EJB&nbsp;）、独立应用程序、<a target="_self" style="color: #ca0000;"><span style="text-decoration: underline;"><span style="color: #108ac6;"><strong>测试</strong>&nbsp;</span></span></a>环境之间重用。</p><p align="center" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;"><a href="http://space.itpub.net/batch.download.php?aid=17002" target="_blank" style="color: #ca0000; text-decoration: none;"><img src="http://space.itpub.net/attachments/2009/07/6517_200907200031341.gif" border="0" alt="" style="border: none;" /></a></p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;">组成Spring&nbsp;框架的每个模块（或组件）都可以单独存在，或者与其他一个或多个模块联合实现。每个模块的功能如下：</p><ul type="disc" style="font-family: Arial; font-size: 14.44444465637207px; line-height: 25.98958396911621px;"><li style="line-height: 15.555556297302246px;">核心容器：核心容器提供Spring&nbsp;框架的基本功能。核心容器的主要组件是BeanFactory&nbsp;，它是工厂模式的实现。BeanFactory&nbsp;使用控制反转 （IOC&nbsp;） 模式将应用程序的配置和依赖性规范与实际的应用程序<a target="_self" style="color: #ca0000;"><span style="text-decoration: underline;"><span style="color: #108ac6;"><strong>代码</strong>&nbsp;</span></span></a>分开。</li><li style="line-height: 15.555556297302246px;">Spring&nbsp;上下文：Spring&nbsp;上下文是一个配置文件，向Spring&nbsp;框架提供上下文信息。Spring&nbsp;上下文包括企业服务，例如JNDI&nbsp;、EJB&nbsp;、电子邮件、国际化、校验和调度功能。</li><li style="line-height: 15.555556297302246px;">Spring AOP&nbsp;： 通过配置管理特性，Spring AOP&nbsp;模块直接将面向方面的<a target="_self" style="color: #ca0000;"><span style="text-decoration: underline;"><span style="color: #108ac6;"><strong>编程</strong>&nbsp;</span></span></a>功能集成到了Spring&nbsp;框架中。所以，可以很容易地使Spring&nbsp;框架管理的任何对象支持AOP&nbsp;。Spring AOP&nbsp;模块为基于Spring&nbsp;的应用程序中的对象提供了事务管理服务。通过使用Spring AOP&nbsp;，不用依赖EJB组件，就可以将声明性事务管理集成到应用程序中。</li><li style="line-height: 15.555556297302246px;">Spring DAO&nbsp;：JDBC DAO&nbsp;抽象层提供了有意义的异常层次结构，可用该结构来管理异常处理和不同<a target="_self" style="color: #ca0000;"><span style="text-decoration: underline;"><span style="color: #108ac6;"><strong>数据库</strong>&nbsp;</span></span></a>供应商抛出的错误消息。异常层次结构简化了错误处理，并且极大地降低了需要编写 的异常代码数量（例如打开和关闭连接）。Spring DAO&nbsp;的面向JDBC&nbsp;的异常遵从通用的DAO&nbsp;异常层次结构。</li><li style="line-height: 15.555556297302246px;">Spring ORM&nbsp;：Spring&nbsp;框架插入了若干个ORM&nbsp;框架，从而提供了ORM&nbsp;的对象关系工具，其中包括JDO&nbsp;、Hibernate&nbsp;和iBatis&nbsp;<a target="_self" style="color: #ca0000;"><span style="text-decoration: underline;"><span style="color: #108ac6;"><strong>SQL</strong>&nbsp;</span></span></a>Map&nbsp;。所有这些都遵从Spring&nbsp;的通用事务和DAO&nbsp;异常层次结构。</li></ul><p align="left" style="margin: 0px 0px 0px 36pt; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;">&nbsp;</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;"><span style="color: #ff0000;">2.ibatis&nbsp;架构图</span></p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; text-indent: 21pt; line-height: 15.555556297302246px;">ibatis&nbsp;是一个基于&nbsp;<a target="_self" style="color: #ca0000;"><span style="text-decoration: underline;"><span style="color: #108ac6;"><strong>Java</strong>&nbsp;</span></span></a>的持久层框架。&nbsp;iBATIS&nbsp;提供的持久层框架包括&nbsp;SQL Maps&nbsp;和&nbsp;<a target="_self" style="color: #ca0000;"><span style="text-decoration: underline;"><span style="color: #108ac6;"><strong>Data</strong>&nbsp;</span></span></a>Access Objects&nbsp;（&nbsp;DAO&nbsp;），同时还提供一个利用这个框架开发的&nbsp;JPetStore&nbsp;实例。</p><p align="center" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;"><a href="http://space.itpub.net/batch.download.php?aid=17003" target="_blank" style="color: #ca0000; text-decoration: none;"><img src="http://space.itpub.net/attachments/2009/07/6517_200907200031342.jpg" border="0" alt="" style="border: none;" /></a></p><p style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; text-indent: 21pt; line-height: 15.555556297302246px;">IBATIS&nbsp;：最大的优点是可以有效的控制sql&nbsp;发送的数目，提高数据层的执行效率！它需要程序员自己去写sql&nbsp;语句，不象hibernate&nbsp;那样是完全面向对象的，自动化的，ibatis&nbsp;是半自动化的，通过表和对象的映射以及手工书写的sql&nbsp;语句，能够实现比hibernate&nbsp;等更高的查询效率。</p><p style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; text-indent: 21pt; line-height: 15.555556297302246px;">Ibatis&nbsp;只是封装了数据访问层，替我们做了部分的对象关系映射。但代价是必须要写<a target="_self" style="color: #ca0000;"><span style="text-decoration: underline;"><span style="color: #108ac6;"><strong>xml</strong>&nbsp;</span></span></a>配置文件，相对于Hibernate&nbsp;还要写很多sql&nbsp;。Hibernate通过工具直接从数据库模式生成实体类和基本的配置文件，而且大部分情况下不需要我们写sql&nbsp;，会较大的提升开发效率。但这些也有很多的局限性，尤其是对环境的要求较高（数据库设计，对象设计，团队的协作等）。 个人感觉Ibatis&nbsp;对项目比较有意义的地方在于它小巧灵活，可扩展，封装了数据访问层（事务，缓存，异常，日志），并提供了DAO&nbsp;框架支持。</p><p style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; text-indent: 21pt; line-height: 15.555556297302246px;">利用Ibatis&nbsp;我们可以做到代码和sql&nbsp;的分离，只要sql&nbsp;能够解决的问题，Ibatis&nbsp;就能帮我们较容易的解决，同时也使我们的项目对某一框架的依赖性变小（因为Ibatis&nbsp;是非侵入性的）。这将极大的降低项目风险，减少解决复杂问题的时间，使项目的维护变得简单。</p><p style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; text-indent: 21pt; line-height: 15.555556297302246px;">Ibatis&nbsp;对于应用的修改，调试，扩充和维护将会变得容易自然。修改时，我们主要修改的是代表模型的实体对象，xml&nbsp;配置文件中的sql&nbsp;，和/&nbsp;或配置文件的ResultMap&nbsp;（很多时候是不需要的）。同时，sql&nbsp;和代码分离，我们不用在代码的StringBuffer&nbsp;的append&nbsp;方法之间寻找需要修改的sql&nbsp;。配置文件中的sql&nbsp;便利了我们的调试和对sql&nbsp;的评审及以后的sql&nbsp;重用。</p><p style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; text-indent: 21pt; line-height: 15.555556297302246px;">&nbsp;</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;"><span style="color: #ff0000;">3.structs1&nbsp;架构图</span></p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; text-indent: 21pt; line-height: 15.555556297302246px;">Struts&nbsp;是Apache&nbsp;基金会Jakarta&nbsp;项目组的一个Open Source&nbsp;项目，它采用MVC&nbsp;模式，能够很好地帮助java&nbsp;开发者利用J2EE&nbsp;开发Web&nbsp;应用。和其他的java&nbsp;架构一样，Struts&nbsp;也是面向对象设计，将MVC&nbsp;模式"&nbsp;分离显示逻辑和业务逻辑"&nbsp;的能力发挥得淋漓尽致。Structs&nbsp;框架的核心是一个弹性的控制层，基于如Java Servlets&nbsp;，JavaBeans&nbsp;，ResourceBundles&nbsp;与XML&nbsp;等标准<a target="_self" style="color: #ca0000;"><span style="text-decoration: underline;"><span style="color: #108ac6;"><strong>技术</strong>&nbsp;</span></span></a>，以及Jakarta Commons&nbsp;的一些类库。Struts&nbsp;有一组相互协作的类（组件）、Serlvet&nbsp;以及<a target="_self" style="color: #ca0000;"><span style="text-decoration: underline;"><span style="color: #108ac6;"><strong>jsp</strong>&nbsp;</span></span></a>tag lib&nbsp;组成。基于struts&nbsp;构架的web&nbsp;应用程序基本上符合JSP Model2&nbsp;的设计标准，可以说是一个传统MVC&nbsp;设计模式的一种变化类型。　　</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; text-indent: 21pt; line-height: 15.555556297302246px;">Struts&nbsp;有其自己的控制器（Controller&nbsp;），同时整合了其他的一些技术去实现模型层（Model&nbsp;）和视图层（View&nbsp;）。在模型层，Struts&nbsp;可以很容易的与数据访问技术相结合，如JDBC / EJB&nbsp;，以及其它第三方类库，如Hibernate / iBATIS&nbsp;，或者Object Relational Bridge(&nbsp;对象关系桥)&nbsp;。在视图层，Struts&nbsp;能够与JSP&nbsp;，包括JSTL&nbsp;与JSF&nbsp;，以及Velocity&nbsp;模板，XSLT&nbsp;与其它表示层技术。</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; text-indent: 21pt; line-height: 15.555556297302246px;">Struts&nbsp;为每个专业的Web&nbsp;应用程序做背后的支撑，帮助为你的应用创建一个扩展的开发环境。</p><p align="center" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;"><a href="http://space.itpub.net/batch.download.php?aid=17004" target="_blank" style="color: #ca0000; text-decoration: none;"><img src="http://space.itpub.net/attachments/2009/07/6517_200907200031343.jpg" border="0" alt="" style="border: none;" /></a></p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;">&nbsp; Client browser&nbsp;（客户浏览器）</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;">来自客户浏览器的每个HTTP&nbsp;请求创建一个事件。Web&nbsp;容器将用一个HTTP&nbsp;响应作出响应。</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;">&nbsp; Controller&nbsp;（控制器）</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;">控制器接收来自浏览器的请求，并决定将这个请求发往何处。就Struts&nbsp;而言，控制器是以servlet&nbsp;实现的一个命令设计模式。struts-config.xml&nbsp;文件配置控制器。</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;">&nbsp;&nbsp;业务逻辑</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;">业务逻辑更新模型的状态，并帮助控制应用程序的流程。就Struts&nbsp;而言，这是通过作为实际业务逻辑&#8220;&nbsp;瘦&#8221;&nbsp;包装的Action&nbsp;类完成的。</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;">&nbsp; Model&nbsp;（模型）的状态</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;">模型表示应用程序的状态。业务对象更新应用程序的状态。ActionForm. bean&nbsp;在会话级或请求级表示模型的状态，而不是在持久级。JSP&nbsp;文件使用JSP&nbsp;标记读取来自ActionForm. bean&nbsp;的信息。</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;">&nbsp; View&nbsp;（视图）</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;">视图就是一个JSP&nbsp;文件。其中没有流程逻辑，没有业务逻辑，也没有模型信息--&nbsp;只有标记。标记是使Struts&nbsp;有别于其他框架（如Velocity&nbsp;）的因素之一</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;">&nbsp;</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;"><span style="color: #ff0000;">4.structs2&nbsp;架构图</span></p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; text-indent: 21pt; line-height: 15.555556297302246px;">Struts 2&nbsp;相对于Struts 1.X&nbsp;，将实现用户业务逻辑（Action&nbsp;）同Servlet API&nbsp;分离开，这种分离机制，是采用了拦截器或者拦截器栈（拦截器链）。拦截器是Struts 2&nbsp;的核心内容之一。</p><div style="font-family: Arial; font-size: 14.44444465637207px; line-height: 25.98958396911621px;"><p align="center" style="margin: 0px; padding: 0px; text-indent: 21pt; line-height: 15.555556297302246px;">Struts 2&nbsp;内建了多个拦截器和拦截器栈（由多个拦截器形成的拦截器链），将用户的Web&nbsp;请求进行拦截处理，从而提供了更加丰富的功能，例如数据类型转换、国际化、文件上传等。&lt;!-- [if gte vml 1]&gt;&lt;v:shape id="_x0000_i1028" type="#_x0000_t75" style='width:362.25pt;height:336.75pt'&gt;&lt;v:imagedata src="file:///C:/Users/bq_wang/AppData/Local/Temp/msohtmlclip1/01/clip_image006.png" o:title=""/&gt;&lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!-- [if !vml]--&gt;&nbsp;<a href="http://space.itpub.net/batch.download.php?aid=17005" target="_blank" style="color: #ca0000; text-decoration: none;"><img src="http://space.itpub.net/attachments/2009/07/6517_200907200031344.jpg" border="0" alt="" style="border: none;" /></a></p></div><p style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 25.98958396911621px;">&nbsp;</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;">&nbsp;</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;"><span style="color: #ff0000;">5.Hibernate&nbsp;架构图</span></p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; text-indent: 21pt; line-height: 15.555556297302246px;">Hibernate&nbsp;是一个开放<a target="_self" style="color: #ca0000;"><span style="text-decoration: underline;"><span style="color: #108ac6;"><strong>源代码</strong>&nbsp;</span></span></a>的对象关系映射框架，它对JDBC&nbsp;进行了非常轻量级的对象封装，使得Java&nbsp;程序员可以随心所欲的使用对象编程思维来操纵数据库。Hibernate&nbsp;可以应用在任何使用JDBC&nbsp;的场合，既可以在Java&nbsp;的客户端程序使用，也可以在Servlet/JSP&nbsp;的Web&nbsp;应用中使用，最具革命 意义的是，Hibernate&nbsp;可以在应用EJB&nbsp;的J2EE&nbsp;架构中取代CMP&nbsp;，完成数据持久化的重任。</p><div style="font-family: Arial; font-size: 14.44444465637207px; line-height: 25.98958396911621px;"><p align="center" style="margin: 0px; padding: 0px; line-height: 15.555556297302246px;"><a href="http://space.itpub.net/batch.download.php?aid=17006" target="_blank" style="color: #ca0000; text-decoration: none;"><img src="http://space.itpub.net/attachments/2009/07/6517_200907200031345.jpg" border="0" alt="" style="border: none;" /></a></p></div><p style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 25.98958396911621px;">&nbsp;</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;">　 　Hibernate&nbsp;的核心接口一共有5&nbsp;个，分别为:Session&nbsp;、<a href="http://baike.baidu.com/view/1097304.htm" target="_blank" style="color: #ca0000; text-decoration: none;"><span style="color: windowtext;">SessionFactory&nbsp;</span></a>、Transaction&nbsp;、<a href="http://baike.baidu.com/view/209416.htm" target="_blank" style="color: #ca0000; text-decoration: none;"><span style="color: windowtext;">Query&nbsp;</span></a>和Configuration&nbsp;。这5&nbsp;个核心接口在任何开发中都会用到。通过这些接口，不仅可以对持久化对象进行存取，还能够进行事务控制。下面对这五个核心接口分别加以介绍。</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; text-indent: 21pt; line-height: 15.555556297302246px;">&#183;Session&nbsp;接口:Session&nbsp;接口负责执行被持久化对象的CRUD&nbsp;操作(CRUD&nbsp;的任务是完成与数据库的交流，包含了很多常见的SQL&nbsp;语句。)&nbsp;。但需要注意的是Session&nbsp;对象是非线程安全的。同时，Hibernate&nbsp;的session&nbsp;不同于JSP&nbsp;应用中的HttpSession&nbsp;。这里当使用session&nbsp;这个术语时，其实指的是Hibernate&nbsp;中的session&nbsp;，而 以后会将HttpSesion&nbsp;对象称为用户session&nbsp;。</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; text-indent: 21pt; line-height: 15.555556297302246px;">&#183;SessionFactory&nbsp;接口:SessionFactory&nbsp;接口负责初 始化Hibernate&nbsp;。它充当数据存储源的代理，并负责创建Session&nbsp;对象。这里用到了工厂模式。需要注意的是SessionFactory&nbsp;并不是轻量级的，因为一般情况下，一个项目通常只需要一个SessionFactory&nbsp;就够，当需要操作多个数据库时，可以为每个数据库指定一个SessionFactory&nbsp;。</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; text-indent: 21pt; line-height: 15.555556297302246px;">&#183;Configuration&nbsp;接口:Configuration&nbsp;接口负责配置并启动Hibernate&nbsp;，创建SessionFactory&nbsp;对象。在Hibernate&nbsp;的启动的过程中，Configuration&nbsp;类的实例首先定位映射文档位置、读取配置，然后创建SessionFactory&nbsp;对象。</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; text-indent: 21pt; line-height: 15.555556297302246px;">&#183;Transaction&nbsp;接口:Transaction&nbsp;接口负责事务相关的操作。它是可选的，开发人员也可以设计编写自己的底层事务处理代码。</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; text-indent: 21pt; line-height: 15.555556297302246px;">&#183;Query&nbsp;和Criteria&nbsp;接口:Query&nbsp;和Criteria&nbsp;接口负责执行各种数据库查询。它可以使用HQL&nbsp;语言或SQL&nbsp;语句两种表达方式。</p><p style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;"><span style="color: #ff0000;">6.J2EE&nbsp;架构图</span></p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; text-indent: 21pt; line-height: 15.555556297302246px;">J2EE&nbsp;是一套全然不同于传统应用开发的技术架构，包含许多组件，主要可简化且规范应用系统的开发与部署，进而提高可移植性、安全与再用价值。</p><p align="left" style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; text-indent: 21pt; line-height: 15.555556297302246px;">J2EE&nbsp;核心是一组技术规范与指南，其中所包含的各类组件、服务架构及技术层次，均有共通的标准及规格，让各种依循J2EE&nbsp;架构的不同平台之间，存在良好的兼容性，解决过去企业后端使用的信息产品彼此之间无法兼容，导致企业内部或外部难以互通的窘境。</p><div style="font-family: Arial; font-size: 14.44444465637207px; line-height: 25.98958396911621px;"><p style="margin: 0px; padding: 0px; line-height: 15.555556297302246px;"><a href="http://space.itpub.net/batch.download.php?aid=17007" target="_blank" style="color: #ca0000; text-decoration: none;"><img src="http://space.itpub.net/attachments/2009/07/6517_200907200031346.jpg" border="0" alt="" style="border: none;" /></a></p></div><p style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 25.98958396911621px;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;">&nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Arial; font-size: 14.44444465637207px; line-height: 15.555556297302246px;"><span style="color: #ff0000;">7.Oracle&nbsp;架构图</span></p><div style="font-family: Arial; font-size: 14.44444465637207px; line-height: 25.98958396911621px;"><p style="margin: 0px; padding: 0px; line-height: 15.555556297302246px;"><a href="http://space.itpub.net/batch.download.php?aid=17008" target="_blank" style="color: #220000; text-decoration: none;"><img src="http://space.itpub.net/attachments/2009/07/6517_200907200031347.jpg" border="0" alt="" style="border: none;" /></a></p></div><br /><br /></a></p><img src ="http://www.blogjava.net/qileilove/aggbug/409826.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-02-13 17:12 <a href="http://www.blogjava.net/qileilove/articles/409826.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试之性能测试流程</title><link>http://www.blogjava.net/qileilove/articles/409770.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 12 Feb 2014 06:08:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/articles/409770.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/409770.html</wfw:comment><comments>http://www.blogjava.net/qileilove/articles/409770.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/409770.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/409770.html</trackback:ping><description><![CDATA[<p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">需要论文的可以看这个<a href="http://www.blogjava.net/qileilove/archive/2011/10/12/361081.html">http://www.blogjava.net/qileilove/archive/2011/10/12/361081.html</a><br />　看到好多新手，在性能需求模糊的情况下，随便找一个性能测试工具，然后就开始进行性能测试了，在这种情况下得到的性能测试结果很难体现系统真实的能力，或者可能与系统真实的性能相距甚远。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　与功能测试相比，性能测试在技术层面具有更大的复杂性。在以往的测试流程中，性能测试只是测试流程的一部分，是系统或验收测试的一个可选项。但随着测试技术的发展。许多公司也单独把性能测试独立出来，建立专门的性能测试小组或团队。那么性能测试在实施的过程中也需要建立独立的流程与规范。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　虫师提出了自己性能测试流程，与其它书本提出的流程在些小不同。流程的实施没有绝对的对错，适合自身的流程就是正确。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>下面看我所提到的流程</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><img src="http://pic002.cnblogs.com/images/2012/311516/2012080922224462.gif" alt="" style="border: 0px;" /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>&nbsp;</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>性能需求分析</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　性能需求分析是整个性能测试工作开展的基础，如果你连性能的需求都没弄清楚，后面的性能测试工具就无从谈起了。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　在这一阶段，性能测试人员需要与需求人员（客户）、领导及项目相关的人员进行沟通，同时收集各种项目资料，对系统进行分析，确认测试的意图。当然，还需要客户对性能的态度。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　测试需求分析阶段的主要任务是确定测试策略和测试范围。策略主要根据软件类型以及用户对系统的性能的需求来定，测试范围则主要分析系统的功能模块进行调研与分析。最终确认明确的需求。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>性能测试计划</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>&nbsp;</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;&nbsp;&nbsp;确定明确的需求之后，我们要做的工作就是制定性能测试计划。对性能测试过程中所有需要工作制定与规划。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">测试计划的大体内容：</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　项目的简单背景描述，本次性能测试的需求与目的，性能需求分析的结果是什么。测试环境的准备，需要什么样的软硬件配置，网络状况登录。测试数据的准备，对于某些性能测试是需要事先准备测试数据的。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　测试的策略，前面进行需求分析的目的是制定测试策略，也就是设计符合需求的测试场景，需要对系统的哪些业务模块进行测试，如何进行？需要设计哪些场景以及设计这些场景的目的。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">最后会明确一下人员配备，比如需要开发、<span style="font-family: 'Times New Roman';">DBA</span><span style="font-family: 宋体;">、运维都人员的参与协助，性能测试的时间安排。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>测试环境搭建</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">测试环境搭建，分硬件环境与软件环境，硬件环境主要是向上级审批硬件配备，在某些大型性能测试，可能需要公司购置或租用硬件设备来进行。或者是将来原有设置进行调配与重组，这个时候就需要网络工程师的参与或协助。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">软件环境的搭建对于开发人员来说应该毫无压力，比如常见的三大环境，微软的<span style="font-family: 'Times New Roman';">windows&nbsp;+&nbsp;IIS+SQL&nbsp;server&nbsp;2005+.NET</span><span style="font-family: 宋体;">平台、</span><span style="font-family: 'Times New Roman';">windows/linux+tomcat/weblogic+mysql+java&nbsp;</span><span style="font-family: 宋体;">、</span><span style="font-family: 'Times New Roman';">linux+&nbsp;apache+mysql+PHP&nbsp;</span><span style="font-family: 宋体;">等环境。当然身为性能测试人员，不仅也需要会搭建软件平台，更需要对每个平台中的部分有比较深入的了解。因为性能测试的分析并不是死盯着系统应用那一层。中间件、数据库、系统、硬件都有可能成为系统的瓶颈。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>性能工具的引入</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">其实走到这一步进才需要引入性能测试工具，我们在日常的工作中往往是先选定好测试工具然后再分析需求，制定计划进行测试。这样我们在做性能需求分析的时候往往会往往会考虑所选的工具是否能实现，无法实现可能就放弃这个需求或改变这个需求。这样以某一工具为基础点做出的性能测试结果可能是不准确的。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">工具的引入分为自行开发与引入市面上的现有工具。市面上的现有工具又分为收费与开源免费，各有各的优缺点。我们要做的是对需求进行分析，从成本，购买成本，开发成本，现有开源工具的二次开发成本，人员学习使用成本以及时间成本等。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">在这里再强调一点，不是只有压力测试工具属于性能工具，在性能测试过程中所用到的工具都属于性能工具，如测试数据生成工具，性能监控工具等。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>测试的执行</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>&nbsp;</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　测试的执行应该是很大范围的一块内容。也就是我在上一节中性能测试架构所提到的内容。用户行为生成<span style="font-family: 'Times New Roman';">--&gt;</span><span style="font-family: 宋体;">压力产生器</span><span style="font-family: 'Times New Roman';">--&gt;</span><span style="font-family: 宋体;">用户代理</span><span style="font-family: 'Times New Roman';">--&gt;</span><span style="font-family: 宋体;">测试调度</span><span style="font-family: 'Times New Roman';">--&gt;</span><span style="font-family: 宋体;">系统监控等。</span>&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　我们所选择的工具如何来实现我们的需求，这个性能测试工程师对引入的有足够的了解。对协议的了解，可能需要编程的能力等。其实好多新手对性能的学习也是从某一工具的使用开始的。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>测试结果的分析</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　这里再重复一次，测试工具只是提供多种不同的数据揭示和呈现方法而已。工具本身并不能帮我们进行性能结果的分析。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　对于性能测试结果的分析，这个需要性能测试工程师对整个被测环境的各种软硬件都要有深入的了解。当然，在这个过程中我们往往需要各个岗位人员的协助，开发人员、<span style="font-family: 'Times New Roman';">DBA</span><span style="font-family: 宋体;">、运维等。致力成为一位资深的性能测试工程师要走路还很长。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>软件硬件配置调整与优化</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　说的简单点这个环节属于系统调优阶段。这一项不是一个必须的环节。这个要看你本次性能测试的需求与目的。如果只是为了验证系统的能力的话。在分析完测试结果后就可以出性能测试报告了。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　对于我们测试人员来说，我们对一个系统进行功能测试的目的是验证系统功能是否是符合需求并可用的，但发现了缺陷之后是需要对缺陷进行跟踪和修复的，并不是把发现的缺陷写在报告里就完事的。当然，功能缺陷与性能缺陷存在着本质的缺陷。如果在性能测试过程中发现不满足需求的缺陷，进行调优是一个不可缺少的过程。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;　　如果要对系统进行调优的话，测试执行、结果分析、系统调优将会形成一个循环持续的过程。直到满足客户的需求为止。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;-----------------------------------------------</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">对于上面测试流程中所列出的部分，我在后续的博文中会细讲，当然，你也可以对我提出的这个流程进行交流，欢迎留言拍砖，欢迎加性能测试群。</p><img src ="http://www.blogjava.net/qileilove/aggbug/409770.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-02-12 14:08 <a href="http://www.blogjava.net/qileilove/articles/409770.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试系统计数器与硬件分析</title><link>http://www.blogjava.net/qileilove/articles/409715.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Tue, 11 Feb 2014 03:35:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/articles/409715.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/409715.html</wfw:comment><comments>http://www.blogjava.net/qileilove/articles/409715.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/409715.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/409715.html</trackback:ping><description><![CDATA[<p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">性能计数器<span style="font-family: Arial;">(Performance&nbsp;Counter)</span><span style="font-family: 宋体;">，也叫性能监视器</span>。一个人健康状况如何，我们通过对其做各项体检获得相关的状况指标，如血压、心跳，肺活量等。那么在做性能测试过程中，整个系统的软硬件进行监控也必不可少，监控所获得的数据也是我们分析系统性能的主要依据。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　在整个系统中，对于不同的软件和硬件，我们对其监控的指标也不一样，就像一个公司中的所有人员，其每个人的职责不同，评判和考核的标准也是不一样的。下面将从系统的各个方面进行分析。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 18pt;"><strong><span style="background-color: #c0c0c0;">操作系统性能计数器 &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　<span style="font-size: 15px;">操作系统监控器，主要监控操作系统级别上的系统性能表现，这里分析最常见的<span style="font-family: 'Times New Roman';">windows</span><span style="font-family: 宋体;">操作系统与</span><span style="font-family: 'Times New Roman';">Linux</span><span style="font-family: 宋体;">操作系统。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>window&nbsp;操作系统的主要性能计数器</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">Windows<span style="font-family: 宋体;">操作系统的性能监控：</span></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><img src="http://pic002.cnblogs.com/images/2012/311516/2012103023291689.png" alt="" style="border: 0px;" /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">Window<span style="font-family: 宋体;">系统下的计数器比较多，主要技术器如下：</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><img src="http://pic002.cnblogs.com/images/2012/311516/2012103023300235.jpg" alt="" style="border: 0px;" /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><img src="http://pic002.cnblogs.com/images/2012/311516/2012103023302651.jpg" alt="" style="border: 0px;" /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><img src="http://pic002.cnblogs.com/images/2012/311516/2012103023310652.jpg" alt="" style="border: 0px;" /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 18px;"><strong>Linux/UNIX&nbsp;<span style="font-family: 宋体;">操作系统的主要性能计数器</span></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　<span style="font-size: 15px;">　Linux<span style="font-family: 宋体;">系统的命令和</span><span style="font-family: 'Times New Roman';">UXIN</span><span style="font-family: 宋体;">的有些差别，在</span><span style="font-family: 'Times New Roman';">UNIX</span><span style="font-family: 宋体;">系统下的主要计数器监控命令是</span><span style="font-family: 'Times New Roman';">vmstat</span><span style="font-family: 宋体;">、</span><span style="font-family: 'Times New Roman';">iostat</span><span style="font-family: 宋体;">、</span><span style="font-family: 'Times New Roman';">top</span><span style="font-family: 宋体;">、</span><span style="font-family: 'Times New Roman';">sar</span><span style="font-family: 宋体;">、</span><span style="font-family: 'Times New Roman';">sag(</span><span style="font-family: 宋体;">图形方式，需要</span><span style="font-family: 'Times New Roman';">XServer&nbsp;</span><span style="font-family: 宋体;">支持</span><span style="font-family: 'Times New Roman';">)</span><span style="font-family: 宋体;">；而在</span><span style="font-family: 'Times New Roman';">linux</span><span style="font-family: 宋体;">中，没有</span><span style="font-family: 'Times New Roman';">isostat</span><span style="font-family: 宋体;">命令。另外他们的输出结果也稍有差别。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><img src="http://pic002.cnblogs.com/images/2012/311516/2012103023323426.jpg" alt="" style="border: 0px;" /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><img src="http://pic002.cnblogs.com/images/2012/311516/2012103023330082.jpg" alt="" style="border: 0px;" /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><img src="http://pic002.cnblogs.com/images/2012/311516/2012103023342569.jpg" alt="" style="border: 0px;" /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><div style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><p style="margin-top: 10px; margin-bottom: 10px;">　　<span style="font-size: 15px; color: #008000;">上面罗列了<span style="font-family: 'Times New Roman';">windows</span><span style="font-family: 宋体;">与</span><span style="font-family: 'Times New Roman';">linux</span><span style="font-family: 宋体;">系统下的性能计数器，分析一个操作系统的性能，应该查看哪些指标。那么操作系统的载体是系统硬件。那么硬件的性能直接影响着操作系统的性能。下面就简单分析一下系统的硬件。</span><span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">、内存、磁盘。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 18pt;"><strong><span style="background-color: #c0c0c0;">CPU分析 &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;">　　<span style="font-size: 15px;">CPU<span style="font-family: 宋体;">的性能对于计算机整体的性能起着主导作用。对于早期对计算机甚至直呼其</span><span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">的型号，如&nbsp;</span><span style="font-family: 'Times New Roman';">386&nbsp;</span><span style="font-family: 宋体;">、</span><span style="font-family: 'Times New Roman';">486</span><span style="font-family: 宋体;">、奔三，奔四。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　那么我们<span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">性能最直接的评估就是查看其</span><span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">工作频率，就是</span><span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">的时钟频率，单位为是</span><span style="font-family: 'Times New Roman';">Hz</span><span style="font-family: 宋体;">。随着</span><span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">的发展，主频由</span><span style="font-family: 'Times New Roman';">MHz</span><span style="font-family: 宋体;">现在的</span><span style="font-family: 'Times New Roman';">GHz</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　（<span style="font-family: 'Times New Roman';">1GHz=1000MHz=1000000KHz=1000000000Hz</span><span style="font-family: 宋体;">）</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　处理器除了主频指标外，还有另外两个密切相关的概念：倍频与外频。外频是<span style="font-family: 'Times New Roman';">cpu</span><span style="font-family: 宋体;">的基准频率，单位是</span><span style="font-family: 'Times New Roman';">MHz</span><span style="font-family: 宋体;">。外频是</span><span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">与主板之间同步运行的速度，而且目前的绝大部分计算机系统中外频与是内存与主板之间的同步运行速度，在这种方式下，可以理解为</span><span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">的外频直接与内存相连通。实现两都的同步运行状态；倍频即主频与外频之间的倍数。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　主频&nbsp;<span style="font-family: 'Times New Roman';">=&nbsp;</span><span style="font-family: 宋体;">外频&nbsp;</span><span style="font-family: 'Times New Roman';">*&nbsp;</span><span style="font-family: 宋体;">倍数</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 16px;"><strong>如何真对<span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">进行分析</span><span style="font-family: 'Times New Roman';">?</span></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">1<span style="font-family: 宋体;">）查看</span><span style="font-family: 'Times New Roman';">System\%Total&nbsp;Processor&nbsp;Time&nbsp;</span><span style="font-family: 宋体;">性能计数器的计数值。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　该计数值用于体现服务器整体的处理利用率，对于多处理器来讲，该数值体现的是所有<span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">的平均利用率。如果该数值大于持续大于</span><span style="font-family: 'Times New Roman';">90%&nbsp;</span><span style="font-family: 宋体;">，表示</span><span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">有可能存在平静。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">2）查看每个<span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">的</span><span style="font-family: 'Times New Roman';">Processor\%User&nbsp;Time&nbsp;</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　Processor\%User&nbsp;Time<span style="font-family: 宋体;">是指系统的非核心消耗的</span><span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">时间，如果该值较大，可以考虑通过算法优化来降低该值。如果该服务器是数据库服务器，</span><span style="font-family: 'Times New Roman';">Processor\%User&nbsp;Time</span><span style="font-family: 宋体;">值大的原因很可能是数据库的排序或是函数操作消耗了过多的</span><span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">时间，此时可以考虑对数据库进行优化。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">3）查看<span style="font-family: 'Times New Roman';">Processor\%Processor&nbsp;Time&nbsp;</span><span style="font-family: 宋体;">和&nbsp;</span><span style="font-family: 'Times New Roman';">System\Processor&nbsp;Queue&nbsp;Length</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　查看<span style="font-family: 'Times New Roman';">System\Processor&nbsp;Queue&nbsp;Length&nbsp;</span><span style="font-family: 宋体;">计算器，当该计数器的值大于</span><span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">数量的总数加</span><span style="font-family: 'Times New Roman';">1</span><span style="font-family: 宋体;">时，说明</span><span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">产生了赌塞。但产生赌塞时，</span><span style="font-family: 'Times New Roman';">Processor\%Processor&nbsp;Time</span><span style="font-family: 宋体;">的值不一定很大，此时就必须查看</span><span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">赌塞的原因。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">4）查看<span style="font-family: 'Times New Roman';">%DPC&nbsp;Time&nbsp;</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%DPC&nbsp;Time&nbsp;<span style="font-family: 宋体;">是另一个需要关注的内容，该计数值越低越好。在多</span><span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">系统中，如果该值大于</span><span style="font-family: 'Times New Roman';">50%&nbsp;</span><span style="font-family: 宋体;">并且</span><span style="font-family: 'Times New Roman';">Processor\%Processor&nbsp;Time</span><span style="font-family: 宋体;">值非常高，则考虑加一个网卡来提高性能。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 18pt;"><strong><span style="background-color: #c0c0c0;">磁盘<span style="font-family: 'Times New Roman';">I/O</span><span style="font-family: 宋体;">分析 &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;</span></span></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-size: 15px;">硬盘应该是计算机硬件中发展最慢的设备，很多常见瓶颈都是由于硬盘的读<span style="font-family: 'Times New Roman';">/</span><span style="font-family: 宋体;">写速度慢导致的。提高硬盘读</span><span style="font-family: 'Times New Roman';">/</span><span style="font-family: 宋体;">写性能无非是提高转速、提高单碟容量，增加缓存和更新接口，因为传统的硬盘是物理旋转读写数据，所以转速的提高相当困难；而提高单碟容量也存在一写的技术瓶颈，</span><span style="font-family: 'Times New Roman';">1TB</span><span style="font-family: 宋体;">的单碟的容量想要突破还也需要时间。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　对于传统的温氏硬盘到现在速度也只能达到<span style="font-family: 'Times New Roman';">120MB/s</span><span style="font-family: 宋体;">的读取速度，这个速度还真对大文件的读写，而对于服务器大量</span><span style="font-family: 'Times New Roman';">4KB</span><span style="font-family: 宋体;">的小文件读</span><span style="font-family: 'Times New Roman';">/</span><span style="font-family: 宋体;">写速度，会惊人的下跌至</span><span style="font-family: 'Times New Roman';">1MB</span><span style="font-family: 宋体;">不到，而对应的</span><span style="font-family: 'Times New Roman';">IOPS</span><span style="font-family: 宋体;">（每秒磁盘的读</span><span style="font-family: 'Times New Roman';">/</span><span style="font-family: 宋体;">写次数）会低得可怜，大量的数据都在排队从硬盘上读取到内存中，再利用内存的超大带宽完成操作。这也是为什么内存大的系统比较快的原因。但内存的速度虽然比硬盘快得多，也有其致命的缺点，一旦断电，内存中的数据将全部丢失。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　IOPS<span style="font-family: 宋体;">（</span><span style="font-family: 'Times New Roman';">Input/Output&nbsp;Per&nbsp;Second</span><span style="font-family: 宋体;">）每秒磁盘的输入</span><span style="font-family: 'Times New Roman';">/</span><span style="font-family: 宋体;">输出量（或读</span><span style="font-family: 'Times New Roman';">/</span><span style="font-family: 宋体;">写次数），是衡量磁盘性能的主要指标之一。</span><span style="font-family: 'Times New Roman';">IOPS</span><span style="font-family: 宋体;">是指单位时间内系统能处理的</span><span style="font-family: 'Times New Roman';">I/O</span><span style="font-family: 宋体;">请求数量，一般以每秒处理的</span><span style="font-family: 'Times New Roman';">I/O</span><span style="font-family: 宋体;">请求数量为单位。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　另一个重要指标是数据吞吐量（<span style="font-family: 'Times New Roman';">Throughput</span><span style="font-family: 宋体;">），指单位时间内可以成功传输的数据数量。对于大量顺序读</span><span style="font-family: 'Times New Roman';">/</span><span style="font-family: 宋体;">写应用，则更关注吞吐量指标。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">传统的温氏硬盘完成一个<span style="font-family: 'Times New Roman';">I/O</span><span style="font-family: 宋体;">请求所花费的时间包括&nbsp;寻道时间、旋转延迟和数据传输时间三部分。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　*&nbsp;<span style="font-family: 宋体;"><strong>寻道时间</strong>，是指将读写磁头移动至正确的磁道上所需要的时间。目前磁盘的平均寻道时间一般在</span><span style="font-family: 'Times New Roman';">3~15ms</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　*<strong>&nbsp;</strong><span style="font-family: 宋体;"><strong>旋转延迟</strong>，是指盘片旋转将请求数据所在扇区移至读</span><span style="font-family: 'Times New Roman';">/</span><span style="font-family: 宋体;">写磁头下方所需要的时间。</span><span style="font-family: 'Times New Roman';">7200</span><span style="font-family: 宋体;">转速的磁盘，平均旋转言辞大于为</span><span style="font-family: 'Times New Roman';">60&nbsp;*&nbsp;1000/7200/2=4.17ms</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　*&nbsp;<span style="font-family: 宋体;"><strong>数据传输时间</strong>，是指完成传输所请求的数据所需要的时间。目前</span><span style="font-family: 'Times New Roman';">SATA&nbsp;II&nbsp;</span><span style="font-family: 宋体;">可达到</span><span style="font-family: 'Times New Roman';">300MB/s</span><span style="font-family: 宋体;">的接口数据传输速率。数据传输时间通常远小于前两部分时间。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 16px;"><strong>如何分析磁盘<span style="font-family: 'Times New Roman';">I/O</span></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">1）与&nbsp;<span style="font-family: 'Times New Roman';">Processor/Privileged&nbsp;Time&nbsp;</span><span style="font-family: 宋体;">合并进行分析。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">&nbsp; &nbsp; &nbsp;如果在<span style="font-family: 'Times New Roman';">Physical&nbsp;Disk&nbsp;</span><span style="font-family: 宋体;">计算器，只有</span><span style="font-family: 'Times New Roman';">%Disk&nbsp;Time&nbsp;</span><span style="font-family: 宋体;">值较大，其它值都比较适中，则硬盘可能会是瓶颈。若几个值都比较大，且数值持续超过</span><span style="font-family: 'Times New Roman';">80%&nbsp;</span><span style="font-family: 宋体;">，内里可能是内存泄漏。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">2）根据<span style="font-family: 'Times New Roman';">Disk&nbsp;sec/Transfer&nbsp;</span><span style="font-family: 宋体;">进行分析</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">&nbsp; &nbsp; &nbsp; 一般来说，定义<span style="font-family: 'Times New Roman';">Transfer&nbsp;</span><span style="font-family: 宋体;">数值小于</span><span style="font-family: 'Times New Roman';">15</span><span style="font-family: 宋体;">毫秒为优秀，介于</span><span style="font-family: 'Times New Roman';">15~20</span><span style="font-family: 宋体;">毫秒之间为良好，</span><span style="font-family: 'Times New Roman';">30~60</span><span style="font-family: 宋体;">毫秒之间为可以接受，超过</span><span style="font-family: 'Times New Roman';">60</span><span style="font-family: 宋体;">毫秒则需要考虑更换硬盘或硬盘的</span><span style="font-family: 'Times New Roman';">RAID</span><span style="font-family: 宋体;">方式。（注意：各种不同的</span><span style="font-family: 'Times New Roman';">RAID</span><span style="font-family: 宋体;">其计算方式也不完全相同）</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">&nbsp;&nbsp;&nbsp;固态硬盘<span style="font-family: 'Times New Roman';">SSD</span><span style="font-family: 宋体;">是一种电子装置，避免了传统硬盘在寻道和旋转上的时间花费，存储单元寻址开销大大降低，因些</span><span style="font-family: 'Times New Roman';">IOPS</span><span style="font-family: 宋体;">可以非常高。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 18pt;"><strong><span style="background-color: #c0c0c0;">内存分析 &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;">　<span style="font-size: 15px;">　为什么固态硬盘的无法做到内存的存取速度呢？这是因为<span style="font-family: 'Times New Roman';">ROM</span><span style="font-family: 宋体;">固态硬盘和</span><span style="font-family: 'Times New Roman';">RAM</span><span style="font-family: 宋体;">内存的实现原理不同导致的。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　内存的发展速度已经达到了第五代<span style="font-family: 'Times New Roman';">DDR</span><span style="font-family: 宋体;">内存（一般用于显卡上），而我们通常主板上的使用的都是第三代</span><span style="font-family: 'Times New Roman';">DDR</span><span style="font-family: 宋体;">内存，内存的主要性指标是在读写</span><span style="font-family: 'Times New Roman';">/</span><span style="font-family: 宋体;">带宽上，而影响带宽上的指标主要是内存通道及内存频率。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　现在常见的内存一般型号为<span style="font-family: 'Times New Roman';">DDR3&nbsp;1333MHz&nbsp;</span><span style="font-family: 宋体;">，我们可以通过更换更高频率或更低时序的方式来提升内存的带宽。（内存时序是描述内存条性能的一种参数）</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　内存频率比较好理解，现在&#8220;发烧&#8221;级别的内存频率可以做到<span style="font-family: 'Times New Roman';">2400MHz</span><span style="font-family: 宋体;">，相对于</span><span style="font-family: 'Times New Roman';">1333MHz</span><span style="font-family: 宋体;">的默认频率几乎有了一倍的提升，这种频率的提升，可以换来带宽从</span><span style="font-family: 'Times New Roman';">16GB</span><span style="font-family: 宋体;">到</span><span style="font-family: 'Times New Roman';">24GB</span><span style="font-family: 宋体;">的提升，如果再能降低时序，那么结果会进一步提升。（关于内存时序概念请参考其它文献）。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">另外一个提升策略就是通道，简单来说就是让多根内存并行和内存控制器进行交互，从而成倍地提升吞吐能力。对于内存比较了解的朋友，双通道、三通道甚至四通道这些名词应该不会陌生。</span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 16px;"><strong>内存分析指标</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">1）查看<span style="font-family: 'Times New Roman';">Memory\Available&nbsp;Mbytes</span><span style="font-family: 宋体;">指标。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　这个计数器是描述系统可用内存的直接指标，在对系统进行操作系统级别的内存分析时，首先通过这个指标建立一个初步的印象，了解性能测试过程中系统是否仍然有足够的内存可用。</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">如果这个指标的数据比较小，系统可能出现了内存方面的问题。</span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">2）Pages/sec&nbsp;&nbsp;<span style="font-family: 宋体;">、&nbsp;</span><span style="font-family: 'Times New Roman';">Pages&nbsp;Read/sec&nbsp;</span><span style="font-family: 宋体;">和</span><span style="font-family: 'Times New Roman';">Page&nbsp;Faults/sec</span><span style="font-family: 宋体;">指标</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　操作系统经常会利用磁盘交换的方式提高系统可用的内存量或内存的使用效率。这三个指标直接反映了操作系统进行磁盘交换的频度。</span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">　　如果<span style="font-family: 'Times New Roman';">Pages/sec&nbsp;</span><span style="font-family: 宋体;">的计数器持续高于几百，很可能会有内存方面的问题产生，但</span><span style="font-family: 'Times New Roman';">Pages/sec</span><span style="font-family: 宋体;">的值很大不一定表明内存有问题，而可能是运行使用内存映射文件的程序所导致。</span><span style="font-family: 'Times New Roman';">Page&nbsp;Faults/sec&nbsp;</span><span style="font-family: 宋体;">值表示每秒发生页面失效的次数，页面失效次数越多，说明操作系统向内存读取的次数越多。些时还需要查看</span><span style="font-family: 'Times New Roman';">Pages&nbsp;Read/sec&nbsp;</span><span style="font-family: 宋体;">的计数值，该计数器的阀值为</span><span style="font-family: 'Times New Roman';">5</span><span style="font-family: 宋体;">，如果计数值超过</span><span style="font-family: 'Times New Roman';">5</span><span style="font-family: 宋体;">，则可以判断内存存在问题。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">3）根据<span style="font-family: 'Times New Roman';">Physical&nbsp;Disk</span><span style="font-family: 宋体;">计数器的值分析性能瓶颈&nbsp;</span></span></p><p style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 15px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Physical&nbsp;Disk&nbsp;<span style="font-family: 宋体;">计数器的分析包括对</span><span style="font-family: 'Times New Roman';">Pages&nbsp;Read/sec</span><span style="font-family: 宋体;">和&nbsp;</span><span style="font-family: 'Times New Roman';">%Disk&nbsp;Time</span>及<span style="font-family: 'Times New Roman';">Average&nbsp;Disk&nbsp;Queue&nbsp;Length&nbsp;</span><span style="font-family: 宋体;">的分析。如果</span><span style="font-family: 'Times New Roman';">Pages&nbsp;Read/sec&nbsp;</span><span style="font-family: 宋体;">很低，同时</span><span style="font-family: 'Times New Roman';">%Disk&nbsp;Time</span><span style="font-family: 宋体;">和</span><span style="font-family: 'Times New Roman';">Average&nbsp;Disk&nbsp;Queue&nbsp;Length&nbsp;</span><span style="font-family: 宋体;">的值很高，则可能有磁盘瓶颈。但是，如果队列长度增加的同时&nbsp;</span><span style="font-family: 'Times New Roman';">Page&nbsp;Read/sec&nbsp;</span><span style="font-family: 宋体;">并未降低，则是由于内存不足。</span></span></p></div><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">------------------------------<br />补充 &nbsp;其实针对不同的场景 我们应采用不同的分析工具和参数 &nbsp;例如 我们要监控web服务器的网络开销 &nbsp;那么我们可以使用httpwatch 和服务端的分析网络协议的软件 计算出整个系统网络负荷，或者我们监控数据库io &nbsp;我们就要监控系统io 是不是得到负荷 &nbsp;有没有排队的现象等等&nbsp;<br /><br /></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">&nbsp; &nbsp; 由于篇幅问题，进程分析，网络分析被遗漏，后面有必要的话会进行补充。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><img src ="http://www.blogjava.net/qileilove/aggbug/409715.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-02-11 11:35 <a href="http://www.blogjava.net/qileilove/articles/409715.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试测试环境搭建</title><link>http://www.blogjava.net/qileilove/articles/409653.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Mon, 10 Feb 2014 02:52:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/articles/409653.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/409653.html</wfw:comment><comments>http://www.blogjava.net/qileilove/articles/409653.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/409653.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/409653.html</trackback:ping><description><![CDATA[<p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">在进行性能则试前，需要完成性能测试的搭建工作，一般包括硬件环境、软件环境及网络环境，可以要求配置和开发工程师协助完成，但是作为一个优秀性能测试工程师，这也是你的必备技能之一。</span></p><p style="margin-top: 10px; margin-bottom: 10px; background-color: #ffffff;"><font face="Verdana, Lucida Grande, Arial, Helvetica, sans-serif"><span style="font-size: 12px; line-height: 18px;">&nbsp;</span></font><span style="line-height: 17.98611068725586px; font-size: 14px;">性能测试的环境准备&nbsp;</span></p><div><span style="line-height: 17.98611068725586px;">问题描述：在编写脚本的同时，执行场景之前需要完成测试环境的搭建工作，这里包括硬件和软件环境的搭建。根据性能测试计划中的测试环境规划，完成对整个测试环境的搭建。由于性能测试的特殊性，整个测试环境需要在严格的独立监控下管理，避免不受控的情况出现导致性能测试数据的偏差（类似于药品制造中的无菌室概念），而另一方面，在实际应用中很难得到真实的系统环境来完成性能测试。那么到底该如何搭建真实的性能测试环境呢？ 1&nbsp;</span></div><div><span style="line-height: 17.98611068725586px;">简而言之，尽量保持性能测试环境与真实生产环境的一致性。具体从以下三个方面来看，&nbsp;</span></div><div><span style="line-height: 17.98611068725586px;">1. 硬件环境，包括服务器环境、客户端环境与网络环境 如服务器的型号以及是否和其它应用程序共享此服务器；是否在集群环境下；是否通过BIGIP进行负载均衡；客户使用的硬件配置情况；网络速度（可通过LR 模拟限速）。 &nbsp; 2. 软件环境 &nbsp; （1）版本一致性&nbsp;</span></div><div><span style="line-height: 17.98611068725586px;">&nbsp; 包括操作系统、数据库的版本，被测的应用软件的版本（含用到的第三方软件的版本）等。&nbsp;</span></div><div><span style="line-height: 17.98611068725586px;">&nbsp; （2）配置一致性&nbsp;</span></div><div><span style="line-height: 17.98611068725586px;">&nbsp; 系统（操作系统/数据库/应用程序）参数的配置，如数据库的并发读写数，SGA/PGA设置， session 超时配置等。 &nbsp; 3. 使用场景的一致性 &nbsp; （1）基础数据的一致性&nbsp;</span></div><div><span style="line-height: 17.98611068725586px;">&nbsp; 包括预测的业务数据量，业务数据类型的分配，数据库表索引的建立与否，重要的实体包含的明细个数等等。&nbsp;</span></div><div><span style="line-height: 17.98611068725586px;">&nbsp; （2）使用模式的一致性&nbsp;</span></div><div><span style="line-height: 17.98611068725586px;">&nbsp; 尽量模拟真实场景下用户的使用情况（3W1H: What， Who， When， How 哪些功能常用以及被多少用户在多大频率下如何使用）。 2&nbsp;</span></div><div><span style="line-height: 17.98611068725586px;">&nbsp; 如何搭建一个真实性能测试环境？如何搭建一个真实环境其实不难，只要公司有投入，用户允许，都不是问题。&nbsp;</span></div><div><span style="line-height: 17.98611068725586px;">&nbsp; 我觉得应该多考虑如何在现有资源条件下，如何快速搭建一个仿真的性能测试环境。 &nbsp; 先了解一下性能测试环境一般指哪些： &nbsp; 性能测试环境：包括硬件、网络，软件 &nbsp; 硬件：服务器，客户端，交换机，防火墙等 &nbsp; 网络：有线还无线，带宽，网络协议&nbsp;</span></div><div><span style="line-height: 17.98611068725586px;">&nbsp; 软件：数据库，中间件，被测软件，操作系统，防火墙等&nbsp;</span></div><div><span style="line-height: 17.98611068725586px;">&nbsp; 如何无菌：最好办法就是杀掉，那对上面环境来说，最好所有硬件最新的，所有软件是重装，所有参数都是正确的。一般情况是不可能的&#8230;&#8230;&nbsp;</span></div><div><span style="line-height: 17.98611068725586px;">&nbsp; 如何快速：环境日常维护，所维护的性能测试能快速还原。&nbsp;</span></div><div><span style="line-height: 17.98611068725586px;">&nbsp; 以上事情一般测试团队都在做，但我还担心一件事，如何验证我们的环境是有效的。&nbsp;</span></div><div><span style="line-height: 17.98611068725586px;">那就需使用一些监控工具，如网络监控，系统监控，数据库监控，中间件参数捕捉，存储设备检测，一些硬件指标的了解以及当前环境指标等等。当然还少不了性能测试团队的经验。&nbsp;</span></div><div><span style="line-height: 17.98611068725586px;"><br /></span></div><div><span style="line-height: 17.98611068725586px;"><br /></span></div><div><span style="line-height: 17.98611068725586px;">名人堂：众名人带你感受他们的驱动人生马云任志强李嘉诚柳传志史玉柱</span></div><div>&nbsp;</div><div><span style="line-height: 17.98611068725586px;"><br /></span></div><div><span style="line-height: 17.98611068725586px;"><br /></span></div><div><span style="line-height: 17.98611068725586px;">3&nbsp;</span></div><div><span style="line-height: 17.98611068725586px;">完全一致的测试环境是不可能的，但可以尽量模拟，要做到尽量模拟一般从以下几个方面着手：&nbsp;</span></div><div><span style="line-height: 17.98611068725586px;">1、了解目前的现状（即目前线上应用的实际情况） 2、了解未来一般时间的发展趋势&nbsp;</span></div><div><span style="line-height: 17.98611068725586px;">3、选择合适的模型（例如实际线上是两台XX配置的服务器，可能测试环境只有一台，那么可采取压力减半的方式） 4、选择合适的工具&nbsp;</span></div><div><span style="line-height: 17.98611068725586px;">5、合理的设计测试脚本和场景</span></div><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 18pt;"><strong><span style="background-color: #c0c0c0;">性能测试环境与功能测试环境的区别 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　<span style="font-size: 15px;">　那么性能测试环境与功能测试环境有什么不同呢？性能测试对测试环境的干净、独立性要求更高，更为严格。对于一个相对较规范的公司，都会建立其独立的研发环境、测试环境、线网环境（最终运行软件的环境）。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;"><strong>（</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　这里多扯一点，系统可以分为C/S<span style="font-family: 宋体;">架构的系统与</span><span style="font-family: Verdana;">B/S</span><span style="font-family: 宋体;">架构的系统，</span><span style="font-family: Verdana;">C/S</span><span style="font-family: 宋体;">架构的系统又可以分为两种，第一种是基本不用与服务器连接的，比如我们用到的</span><span style="font-family: Verdana;">java</span><span style="font-family: 宋体;">虚拟机</span><span style="font-family: Verdana;">JVM</span><span style="font-family: 宋体;">，</span><span style="font-family: Verdana;">photo&nbsp;shop</span><span style="font-family: 宋体;">平面处理软件，我们可以开启软件更新功能，这时软件向服务器发请求，查当前版本是否是服务器端发布的最新版本，然后，提示用例是否需要更新或下载最新版本的软件。当然，我们也可以关闭更新功能或不检测更新。那么这个软件一样可以在电脑上运行。对于这类软件，我的主要测试环境就是用户的电脑。不同硬件配置、不同操作系统下对软件一系列，从安装使用到卸载。除了验证软件与硬件和系统的兼容性能，还需要验证与其它软件是否兼容。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　第二种类型的<span style="font-family: Verdana;">C/S</span><span style="font-family: 宋体;">软件要时刻与服务器与连接，比如我的在线网游，</span><span style="font-family: Verdana;">QQ</span><span style="font-family: 宋体;">聊天工具等。从软件的启动就需要与服务器进行连接，对于此类软件，我们测试环境的重点依然是用户电脑，但服务器端必须也有一个相对应的测试环境支撑。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　对于<span style="font-family: Verdana;">B/S</span><span style="font-family: 宋体;">的系统，我们测试环境的重点就要由用户电脑转为服务器端了，因为系统的所有功能都是由服务器端传递给用户的，所以需要验证服务器传递来的功能是否可用，以及功能的容错能力等。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;"><strong>）</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　再回到测试环境的问题上，对于一些企业为了节约资源，进行功能测试的测试环境，一台服务器可以运行多个系统，通过技术手段可以使系统之间是不会相互影响的（以前公司就是一台服务器上跑多个<span style="font-family: Verdana;">tomcat</span><span style="font-family: 宋体;">）。因为功能测试的重点大于系统对客户端发来的请求是否可以进行正确的处理。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　那么性能测试为什么对系统的环境要求干净、独立呢？性能测试是要对整个系统运行的软件硬件环境进行测试的，如果某环境下运行多个系统，就很难判断其中的某个环境对资源的占用情况。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 18pt;"><strong><span style="background-color: #c0c0c0;">性能测试环境包含内容 &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;"><strong>一般<span style="font-family: Verdana;">web</span><span style="font-family: 宋体;">应用系统分为</span><span style="font-family: Verdana;">3</span></strong><span style="font-family: 宋体;"><strong>层架构</strong>（在系统架构一章中有介绍）</span></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">* 表现层（<span style="font-family: Verdana;">web</span><span style="font-family: 宋体;">服务器）</span></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">* 业务逻辑层（应用服务器）</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">* 数据层（数据库服务器）</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;"><strong>性能测试环境包含内容</strong>：</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">硬件：服务器、客户端、交换机等。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">软件：数据库、中间件、被测系统、操作系统等。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">网络：有线<span style="font-family: Verdana;">/</span><span style="font-family: 宋体;">无线</span><span style="font-family: Verdana;">/</span><span style="font-family: 宋体;">宽带、网络协议等。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 18pt;"><strong><span style="background-color: #c0c0c0;">如何保证测试环境与真实生产的一致性 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">保证性能测试与真实生产环境的一致性，具体从以下三个方面来看：</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;"><strong>1、硬件环境，包括服务器环境、与网络环境</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　如服务器的型号以及是否和其它应用程序共享此服务器，是否在集群环境下，是否通过<span style="font-family: Verdana;">BIGIP</span><span style="font-family: 宋体;">进行负载均衡，客户使用的硬件配置情况，使用的交换机型号，网络传输速率。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;"><strong>2、软件环境</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">版本一致性</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　包括包括操作系统、数据库、中间件的版本，被测系统的版本。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">配置一致性</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　系统（操作系统<span style="font-family: Verdana;">/</span><span style="font-family: 宋体;">数据库</span><span style="font-family: Verdana;">/</span><span style="font-family: 宋体;">中间件</span><span style="font-family: Verdana;">/</span><span style="font-family: 宋体;">被测试系统）参数的配置一致，这些系统参数的配置有可能对系统造成巨大的影响。所以，除了保证测试环境与真实环境所使用的软件版本一致，也要关注其参数的配置是否一致。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;"><strong>3、使用场景的一致性</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">基础数据的一致性</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　包括预测的业务数据量，以及数据类型的分配。很简单的一个列子，一个系统的数据库只有<span style="font-family: Verdana;">10</span><span style="font-family: 宋体;">条数据和一条数据库里几千万条数据，我们在对其进行性能测试时，得到的性能指标可能会有非常大的差别。</span></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　为了保证每次测试环境的更加一致性，磁盘的使用情况以及磁盘的碎片情况也会或多或少的影响的性能。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">使用模式的一致性</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　尽量模拟真实场景下用户的使用情况，其实，我们在做性能测试前期的需求分析，其主要目的也就是为了更真实的模拟用户的使用情况。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 18pt;"><strong><span style="background-color: #c0c0c0;">性能测试环境的实施策略 &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; &nbsp; &nbsp; &nbsp; &nbsp;</span></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　<span style="font-size: 15px;">　上面讲测试环境与生产环境保持一致所需要注意的内容。其实在实际的测试中，我们很难搭建出与生产环境完全一致的一个测试环境，除非我们暂停生产环境用户于进行性能测试，这往往是不可能。一方面某些生产环境是不允许被暂停的，另一方面也为生产环境的安全性考虑。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　性能测试环境并不像功能测试环境，为了节省资源可以一台服务器上运行多个系统。由于性能测试的特殊性，整个测试环境需要在严格的独立监控下管理，在很多情况下，我们很难申请到足够的且一致的资源（说白了就是老板是否愿意出钱给你买服务器搭建系统）。对于一个并未上线的项目，其生产环境的配置也属于暂定状态，性能测试的目的就是为了确定具体生产环境的硬件配置。这个时候更不可能用过高的配置来搭建性能环境（除非现成的环境放着不用）。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">我们一般通过两种策略来搭建性能测试环境（预估方式均有误差）</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 16px;"><strong>1、通过建模的方式实现低端硬件对高端硬件的模拟</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　<span style="font-size: 15px;">　通过配置测试来计算不同配置下的硬件性能和系统处理能力的关系，从而推导出满足系统性能的真实配置情况，这种模拟需要精确的建模，模型的采样点越多，那么得到的结果越精确，从而将在低端配置下的性能指标通过该模型转化为高端配置下的最终预计性能指标。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　例如：搭建一个低端环境，首先需要对这个环境的CPU和内存进行单独的性能基准测试，同过在不同的配置的性能测试，得到一个基准信息列表，当然，在进行这个性能测试的过程中，我们要确定硬件是系统的瓶颈。如果只用一个CUP，在性能测试过程中，其使用率很低，但得到的性能数据都非常底，这起码说明CUP不是系统的平静，这种情况下就无法得到想要的基准值。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><img src="http://pic002.cnblogs.com/images/2012/311516/2012102023250582.png" alt="" style="border: 0px;" /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　<span style="font-size: 15px;">如上图，在一颗CPU情况下，运行100个用户且CUP使用率接近饱和（100%）。在增加至两颗CUP的情况下，可以运行190个用户且UPU使用率接近饱和（100%），以此做记录，那么我们就可以推算出运行800个用户需要多少颗CUP。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　如果你在实际应用中使用的CUP型号及其频率并非完全一样，这个时候可以使用EVEREST工具计算每种CUP的得分，对其性能进行评估。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　内存也可以使用此方法进行测试推导，这里需要我们多进行试验，对硬件的性能以及对整个项目的结构都要做深入的了解，以便尽量减少误差。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 16px;"><strong>2、通过集群的方式计算</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　<span style="font-size: 15px;">对于较大的系统来说，单台服务器的处理能力是有限的，通常都会采用集群的方式来进行负载均衡，完成对海量请求的处理。虽然无法获得整体集群的测试环境，但是可以对集群上的一个节点进行性能测试，得出该节点的处理能力，再计算每增加一个节点的性能损失，同样也可以能过建模的方式得到大型负载均衡情况下的预计性能指标。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　例如<span style="font-family: Verdana;">:</span><span style="font-family: 宋体;">首先在单台服务器上获得具体的性能指标，每台服务器能够承受</span><span style="font-family: Verdana;">500</span><span style="font-family: 宋体;">用户并发，平均</span><span style="font-family: Verdana;">TPS</span><span style="font-family: 宋体;">为</span><span style="font-family: Verdana;">60</span><span style="font-family: 宋体;">，响应时间为</span><span style="font-family: Verdana;">2</span><span style="font-family: 宋体;">秒，接着，添加负载均衡策略，再次测试负载策略下的数据损耗。得出数据后添加</span><span style="font-family: Verdana;">1</span><span style="font-family: 宋体;">台负载均衡服务器，测试在两台服务器下每台服务器的性能指标，以此类推，可以得到下表：</span></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><img src="http://pic002.cnblogs.com/images/2012/311516/2012102023262990.jpg" alt="" style="border: 0px;" /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　<span style="font-size: 15px;">　随着负载均衡服务器的添加，平均每台服务器的处理能力会逐渐稳定，从而了解在什么情况下需要多少台负载均衡服务器。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　对于测试环境的搭建，建议生成专门的文档进行管理，并进行配置管理，确保对测试环境做到基线控制。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">------------------------------------------</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;">　　这个性能测试系列以理论与性能测试的整体讲解为主，市面上的大部分书籍借着性能测试的表皮在讲性能测试工具loadrunner，那我何不找份loadrunner使用手册来看更好。<br />总结：我们得测试环境尽量要模拟真实环境 如果硬件达不到 我们可以采用概率论的方法 进行估算，但是软件方面环境必须一致，然后根据我们硬件的配置 进行概率分析后推测，有条件的公司可以进行一次验证。<br /><br /></span></p><img src ="http://www.blogjava.net/qileilove/aggbug/409653.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-02-10 10:52 <a href="http://www.blogjava.net/qileilove/articles/409653.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试性能测试工具原理与架构</title><link>http://www.blogjava.net/qileilove/articles/409633.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Sun, 09 Feb 2014 06:39:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/articles/409633.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/409633.html</wfw:comment><comments>http://www.blogjava.net/qileilove/articles/409633.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/409633.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/409633.html</trackback:ping><description><![CDATA[<p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　在性能测试的学习过程中，坚持思想与工具（分开）并行，当前面世面上的性能测试书籍大多把理论与<span style="font-family: 'Times New Roman';">loadrunner</span><span style="font-family: 宋体;">融为一体讲解，这样做是正确的，因为有一些性能名词概念也源于工具。但是，性能测试不是</span><span style="font-family: 'Times New Roman';">loadrunner</span><span style="font-family: 宋体;">，所有的作者也是这么认为的。但他们在讲性能测试的时候讲的就是</span><span style="font-family: 'Times New Roman';">loadrunner</span><span style="font-family: 宋体;">有，只是讲的多少不同罢啦。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;你是否觉得我对<span style="font-family: 'Times New Roman';">loadrunner</span><span style="font-family: 宋体;">有仇？我之所以将其分开来学，只是希望自己在学习性能测试的时候不要被</span><span style="font-family: 'Times New Roman';">loadrunner</span><span style="font-family: 宋体;">局限了而已。只是觉得在做性能测试时不要带</span><span style="font-family: 'Times New Roman';">loadrunner</span><span style="font-family: 宋体;">的思维，这样更容易把握性能测试的本质。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">-----------------------------------------------------&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　性能测试工具，从广义上讲，在性能测试过程中使用到的所有工具都可以称其为性能测试工具。从狭义上来讲，我们可以把性能测试工具分为服务器端性能测试工具与前段性能测试工具。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　服务器端性能测试工具也我们测试人员通常所认为的性能测试工具。<span style="font-family: 'Times New Roman';">LoadRunner</span><span style="font-family: 宋体;">、</span><span style="font-family: 'Times New Roman';">JMeter</span><span style="font-family: 宋体;">、</span><span style="font-family: 'Times New Roman';">SilkPerformance</span><span style="font-family: 宋体;">、服务器端压力性能工具需要支持产生压力和负载，录制和生成脚本，设置和部署场景，产生并发用户和向系统施加持续的压力。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　前端性能测试工具应用比较广泛，开发人员，前端开发人员、测试人员都会经常用到。<span style="font-family: 'Times New Roman';">Firebug&nbsp;</span><span style="font-family: 宋体;">、</span><span style="font-family: 'Times New Roman';">fildder2</span><span style="font-family: 宋体;">、</span><span style="font-family: 'Times New Roman';">Yslow&nbsp;</span><span style="font-family: 宋体;">、前端性能测试工具只需要关于心浏览器等客户端工具对具体需要展现的页面的处理过程。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 18pt;"><strong><span style="background-color: #c0c0c0;">服务器性能测试工具原理 &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; &nbsp; &nbsp;</span></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　性能测试工具的主要作用是通过模拟生产环境中的真实业务操作，对被测试系统实行压力负载测试，监视被&nbsp;测试系统在不同业务、不同压力性能下的性能表现，找出潜在的性能瓶颈进行分析、优化。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　客户端与服务器相当于两个人，通过信息来进行交流。由于初次见面不好意思直接交流，与是找来了中间传话人，客户端把信息告诉给传话人，由传话人来转达给服务器。那么服务器反馈的信息也由传话人转达给客户端。一般性能测试工具都需要录制或编写客户端行为脚本。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp; &nbsp; &nbsp; 这样传达人就有了客户端的行为能力，从而假扮客户端来欺骗服务器，与之进行通信。有了客户端行为了传达人可以进行自我复制。从而变出<span style="font-family: 'Times New Roman';">N</span><span style="font-family: 宋体;">多个传达人对服务器进通信。</span><span style="font-family: 'Times New Roman';">---</span><span style="font-family: 宋体;">这个传达人的行为和能力也就是性能测试工具的基本特质。（突然觉得性能工具像第三者插足，而且是可以自我复制疯狂变态的第三者，哈哈！）</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp; &nbsp; 　对于目前流行的性能测试工具，他们的基本工作原理都是一致的。在客户端通过多线程或多进程模拟虚拟用户访问，对服务器端施加压力，然后在过程中监控和收集性能数据。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><img src="http://pic002.cnblogs.com/images/2012/311516/2012073123081660.png" alt="" style="border: 0px;" /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>性能测试工具应该具备什么的特质呢？</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #008000;">1、工具本身占用系统资源少，可扩展性好，可用性强。&nbsp;&nbsp;&nbsp;&nbsp;</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #008000;">2、能模拟真实业务事务操作，在并发时能真正产生业务压力。（这一点是核心）</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #008000;">3、对压力测试结果能很好地进行性能分析，快速找出被测试系统的瓶颈。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #008000;">4、测试脚本的重复性强。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #008000;"><span style="background-color: #c0c0c0; font-size: 18pt;"><strong><span style="color: #000000;">服务器性能测试工具的架构 &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; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></strong></span><br /></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #008000;">&nbsp; &nbsp;</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #008000;"><strong>用户行为生成部分</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;我为什么说的这么朦胧，对于熟悉<span style="font-family: 'Times New Roman';">loadrunner</span><span style="font-family: 宋体;">的朋友，我说成虚拟用户脚本生成器，你更容易理解，这个脚本，我们可以录制，也可以手工编写。你不要以为这是生成用户行为的唯一方式。因为在</span><span style="font-family: 'Times New Roman';">JMeter</span><span style="font-family: 宋体;">成中是添加各种组件，通过对组件的配置来完成用户行为的，当然也可以通过录制。而在相对简陋的性能测试工具</span><span style="font-family: 'Times New Roman';">curl_loader</span><span style="font-family: 宋体;">（</span><span style="font-family: 'Times New Roman';">linux</span><span style="font-family: 宋体;">环境下的运行的），他是通过编写配置文件的形式来描述用户形为的。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;我前面也有提了，虽然性能测试工具由不同的形式来描述，但他们的原理是一样的，都是通过<span style="font-family: 'Times New Roman';">Proxy</span><span style="font-family: 宋体;">方式来实现，具体来说，</span><span style="font-family: 'Times New Roman';">Proxy</span><span style="font-family: 宋体;">作为客户端和服务器之间的中间人，接收客户端的数据包。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #008000;"><strong>压力产生器</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　压力产生器用于根据脚本内容产生实际的负载，在性能测试工具中，压力产生器扮演着&#8220;产生负载&#8221;的角色。也就根用户的设置，进行自我复制来生成多个客户端向服务器发送请求。对于工具来说，每复制出来的一份就是一个进程或线程，进程和线程的运行是要占用系统资源的。所以，对一台压力测试机来说能运行的虚拟用户数也是有限的。根基测试机的配置而定。那么这个时候就要通过多台测试机合作，来模拟更多的虚拟用户向服务器发请求。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　那么，对于性能测试来说，很重要的一点就是产生&#8220;并发&#8221;的请求，不然就不会对服务器产生压力。那多台机子如何产生&#8220;步调一致&#8221;的虚拟用户呢？使用&#8220;用户代理&#8221;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #008000;"><strong>用户代理</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　用户代理是运行在负载机上的进程，该进程与产生负载压力的进程或线程协作，接收调度系统的命令，调度产生负载压力的进程或线程，从这个意义上看，用户代理也是压力产生器的一部分。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #008000;"><strong>&nbsp;</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #008000;"><strong>调度能力</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　我们在做复杂的性能测试时，常常会设计各种场景，不同的虚拟用户数，不同事务的用户比例，运行时间，设置同步点等，这个时候也需要我们的测试工具有压力调度能力。从而才能更真实的模拟我们所设计的运行场景。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #008000;"><strong>监控系统</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　监控系统是性能测试工具直接与用户进行交互的主要部分，监控系统，主要用户在压力测试过程中对各种软硬件进行监控，如对数据库、应用服务器，服务器的主要性能表现情况进行监控。用于判断系统当前处于什么状态。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　当然，监控系统不是性能工具必须的部分，可以通过软硬件系统自身的监控工具或者第三方监控工具进行监控。但是否有强大的性能计数器监控系统是衡量性能测试工具是否强大的指标之一。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #008000;"><strong>压力结果分析</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　压力结果分析工具可以用来辅助进行测试结果的分析，性能测试工具一般都能将监控系统获取的性能技术数器值生成曲线图，折线图等各种图表。通过展现性能测试过程中的各种参数指标，来供测试人员进行分析。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　但这里需要强调的是，压力结果分析工具本身不能代替分析者进行性能结果分析，而只是提供多种不同的数据揭示和呈现方法而已。对于这些数据进行分析必然要依靠测试工程师对系统性能分析的知识和经验。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">-------------------------------------------------------&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　对上面介绍的性能测试工具架构的组成部分，不是第一个性能测试工具都具备，而所具备的强大程度也不相同。比如，有些性能测试工具不具备用户代理能，有些监控系统能监控的资源很有限或简陋，有些结果分析数据的呈现不够详尽等。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;<div style="display: inline-block;"></div></p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">一：<a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">性能测试</strong></u></a>工具模型</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"></p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　广义地说，性能测试工具是指性能测试过程中使用到所有工具，但是我们习惯上把&#8220;性能测试工具&#8221;定位于<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">LoadRunner</strong></u></a>、SilkPerformer一类的工具。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　关于性能测试的几个误区：</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　1、认为性能测试就是使用性能测试工具进行测试。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　性能测试工具只能帮助你实施性能测试，并不能帮助你完成性能测试的需求、设计和分析。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　2、认为性能测试工具可以完成性能测试结果分析<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">工作</strong></u></a>。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　性能测试工具只是能够根据你的要求以各种方式提供报表，这些报表可以被您用来分析系统性能状况。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　3、不清楚性能测试工具的录制/回放与<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">功能测试</strong></u></a>工具的录制/回放的区别。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　功能测试工具的录制/回放一般是针对GUI的操作录制，脚本中记录的是用户对控件的操作，例如按下了&#8220;确认&#8221;按钮或是在&#8220;姓名文本框&#8221;中输入了ABCD等内容，这时因为功能测试工具主要是通过操作和数据来验证功能的正确性，评价的主要标准是GUI的正确性（界面内容的正确性）。而性能测试工具录制的是服务端和应用之间的通信数据，而不是应用的GUI操作。^_^^_^理解了这一点，就不难明白为什么在进行性能测试脚本录制的时候，需要首先选择录制的协议了。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　4、不清楚何时选择何种协议。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　选择何种协议取决于应用和客户端之间的通信协议。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">二：性能测试工具架构</strong></p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　1、虚拟用户脚本产生器（Virtual User Generator）：通过一个Proxy作为客户端和服务器之间的中间人。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　2、压力产生器(Player)：压力器扮演着&#8220;产生负载&#8221;的角色。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　3、用户代理(Agent)：运行在负载机(LoadMachine)上的进程，该进程于产生负载压力的进程或是线程写作完成&#8220;产生负载&#8221;的功能。如一台PC可以顺利运行200个左右的VU，但对需要1000个VU的情况显然很难指望一台PC，这时就需要通过多台及其进行协作，&#8220;用户代理&#8220;就帮助产生&#8221;步调一致&#8220;的VU。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　4、压力调度和监控系统(Conductor)：直接与用户交互的主要内容，压力调度可以根据用户的场景要求，设置各种不同脚本的VU数量，设置同步点等，而监控系统则可以对各种<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">数据库</strong></u></a>，应用服务器、服务器的主要性能计数器进行监控。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　5、压力结果分析工具(Analysis)：用来辅助进行测试结果的分析。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">三：性能测试脚本录制时的协议类型</strong></p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　^_^^_^不要想当然地根据开发语言来决定协议的选取，这样子极有可能导致录制后的脚本不能回放成功。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　几点说明的内容：</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　1、使用Socket协议可以对任何类型的应用通信进行录制，但这种录制生成的脚本很可能没有任何意义。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　2、在对应用间的通信进行录制生成脚本后，对脚本进行回放，有时会出现回放无法继续的情况（停留在某个步骤无法进行下去），此时应该考虑是否使用了合适的协议。<div style="display: inline-block;"></div></p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;协议选择参考方案&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"></p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　1、Web应用：应用特点：采用J2EE或是dontNet结构，HTTP/HTTPS协议。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　2、C/S应用：</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　a、客户端程序以ADO、OLEDB方式连接后台数据库，选择后台数据库类型选择相应的协议。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　b、客户端程序以ODBC方式连接后台数据库，ODBC协议。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　c、其他协议，根据具体协议类型进行分析。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　3、组件：a、COM/DCOMcom/dcom协议。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　b、EJB，EJB协议。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　4、服务：</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　a、WebService，WebService协议。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　b、Mail服务器，SMTP/POP3协议。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　c、FTP服务器，FTP协议。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　5、应用服务器：</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　a、OracleApplicationServer,OracleApplicationServer协议。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　b、SAP，SAP协议。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　c、Tuexdo,Tuexdo协议。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">四：性能测试工具的选择与评估</strong></p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　这个问题通常会有两个层面的意义：第一，创建还是购买？第二，如果购买，如何选择一种商业工具？</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　1、创建还是购买？</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　总而言之，&#8221;购买&#8220;的方式可以以较低的总体成本快速获得可用的软件，但如果被测试对象本身有一定的特殊需求，最好使用&#8221;创建&#8220;的方式构建适合的测试工具。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　2、测试工具的评估和选择过程。</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　（1）列出需要的工具功能列表</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　（2）工具比较</p><p style="word-break: break-all; margin: 10px 0px; padding: 0px; line-height: 21.59375px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　（3）成本分析</p><img src ="http://www.blogjava.net/qileilove/aggbug/409633.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-02-09 14:39 <a href="http://www.blogjava.net/qileilove/articles/409633.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试之前端性能</title><link>http://www.blogjava.net/qileilove/articles/409609.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Sat, 08 Feb 2014 03:33:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/articles/409609.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/409609.html</wfw:comment><comments>http://www.blogjava.net/qileilove/articles/409609.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/409609.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/409609.html</trackback:ping><description><![CDATA[<p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">我的上一篇博文中讲到了响应时间，我们在做性能测试时，能过工具可以屏蔽客户端呈现时间，通过局域网的高宽带可以忽略数据传输速度的障碍。这并不是说他们不会对系统造成性能影响。相反，从用户的感受来看，虽然传输速度受用户带宽的限制。但我们可以通过很多技术来使用户想要看到的页面更快的显示。这就<span style="font-family: 'Times New Roman';">web</span><span style="font-family: 宋体;">是前端性能。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　如果考虑到<span style="font-family: 'Times New Roman';">web</span><span style="font-family: 宋体;">应用本身的特性，响应时间的构成应该会更加复杂。&nbsp;</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　Web<span style="font-family: 宋体;">应用的基础是超文本传输协议（</span><span style="font-family: 'Times New Roman';">HTTP</span><span style="font-family: 宋体;">）和超文本标记语言（</span><span style="font-family: 'Times New Roman';">HTML</span><span style="font-family: 宋体;">），</span><span style="font-family: 'Times New Roman';">HTTP</span><span style="font-family: 宋体;">协议本身是一种面向非连接的协议，</span><span style="font-family: 'Times New Roman';">HTML</span><span style="font-family: 宋体;">语言则是一种用于制作超文本文档资料的简单标记语言。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　对于一个页面而言，&#8220;请求&#8221;和&#8220;返回数据&#8221;都可能是多次发生的。这个我在《在做性能测试之前需要知道什么》一文中举了一个简单的例子来讲解。由于<span style="font-family: 'Times New Roman';">HTTP</span><span style="font-family: 宋体;">对浏览器下载资源并发请求数量、</span><span style="font-family: 'Times New Roman';">Cache</span><span style="font-family: 宋体;">等方面都进行定义和限制，以及浏览器对于</span><span style="font-family: 'Times New Roman';">HTML</span><span style="font-family: 宋体;">的处理过程。完全可以说，用户所以感受的响应时间中的相当大的一部分并不完全取决于应用的后台处理所需要的时间，而取决于</span><span style="font-family: 'Times New Roman';">web</span><span style="font-family: 宋体;">应用的前端。在</span><span style="font-family: 'Times New Roman';">yahoo</span><span style="font-family: 宋体;">中，到少</span><span style="font-family: 'Times New Roman';">50</span><span style="font-family: 宋体;">个团队通过纯粹的前端性能相关的技巧，将最终用户的响应时间减少了</span><span style="font-family: 'Times New Roman';">25%</span><span style="font-family: 宋体;">以上。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　HTTP<span style="font-family: 宋体;">是一个属于应用层的</span>面向对象的协议，用于传送WWW<span style="font-family: 宋体;">方式的数据，采用请求</span><span style="font-family: Arial;">\</span><span style="font-family: 宋体;">响应模型，客户端向服务器发送一个请求，请求头包含请求的方法、</span><span style="font-family: Arial;">URI</span><span style="font-family: 宋体;">、协议版本，以及包含请求修饰符、客户信息和内容的类似于</span><span style="font-family: Arial;">HTML</span><span style="font-family: 宋体;">的消息结构。服务器以一个状态行作为响应，响应的内容包括消息协议的版本，成功或者错误编码加上包含服务器信息，实体元信息以及可能的实体内容。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　&nbsp;HTML<span style="font-family: 宋体;">是一种用于制作超文本文档资料的简单标记语言，用</span><span style="font-family: Arial;">HTML</span><span style="font-family: 宋体;">编写的超文本文档能够独立于各种操作系统平台。从诞生开始，</span><span style="font-family: Arial;">HTML</span><span style="font-family: 宋体;">语言就一直被用于描述</span><span style="font-family: Arial;">web</span><span style="font-family: 宋体;">页面格式设计，使用</span><span style="font-family: Arial;">HTML</span><span style="font-family: 宋体;">语言描述的文件需要通过</span><span style="font-family: Arial;">WWW</span><span style="font-family: 宋体;">浏览器显示效果。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">用于查看前端性能工具太多的。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　嵌入浏览器的有&nbsp;<span style="font-family: Arial;">yslow&nbsp;</span><span style="font-family: 宋体;">、</span><span style="font-family: Arial;">page&nbsp;speed</span><span style="font-family: 宋体;">、</span><span style="font-family: Arial;">httpwatch</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　独立界面的有&nbsp;<span style="font-family: Arial;">fiddler2</span><span style="font-family: 宋体;">、</span>charles&nbsp;、</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">页面性能测试之一&nbsp;：&nbsp;<a href="http://www.cnblogs.com/fnng/archive/2011/09/19/2181894.html" style="color: #1d58d1; text-decoration: none;">http://www.cnblogs.com/fnng/archive/2011/09/19/2181894.html</a>&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;<a href="http://www.cnblogs.com/fnng/archive/2011/09/24/2186708.html" style="font-family: verdana, 'courier new'; font-size: 14px; line-height: 21.111112594604492px;">http://www.cnblogs.com/fnng/archive/2011/09/24/2186708.html</a></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 14pt;"><strong>下面用两种方式来对比较两种测试响应时间的差别</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　Apache&nbsp;&nbsp;benchmark&nbsp;<span style="font-family: 宋体;">简称</span><span style="font-family: 'Times New Roman';">ab&nbsp;</span><span style="font-family: 宋体;">，是非常有名又小巧的压力测试工具。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　下载安装<span style="font-family: 'Times New Roman';">apache&nbsp;web&nbsp;server&nbsp;</span><span style="font-family: 宋体;">安装或解压之后，在</span><span style="font-family: 'Times New Roman';">bin\</span><span style="font-family: 宋体;">目录下有个</span><span style="font-family: 'Times New Roman';">ab</span><span style="font-family: 宋体;">执行文件。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　打开运行<span style="font-family: 'Times New Roman';">--cmd&nbsp;</span><span style="font-family: 宋体;">打开命令提示符，定位到</span><span style="font-family: 'Times New Roman';">bin\</span><span style="font-family: 宋体;">目录下。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>基本用法：</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">ab&nbsp;&nbsp;-c&nbsp;&nbsp;[<span style="font-family: 宋体;">并发用户数</span><span style="font-family: 'Times New Roman';">]&nbsp;&nbsp;-n&nbsp;&nbsp;[</span><span style="font-family: 宋体;">发送请求数</span><span style="font-family: 'Times New Roman';">]&nbsp;&nbsp;&nbsp;[</span><span style="font-family: 宋体;">被测试页面的</span><span style="font-family: 'Times New Roman';">URL]</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">设置一个用户一个请求，对百度首页加压：</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">http://www.baidu.com/</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><img src="http://pic002.cnblogs.com/images/2012/311516/2012071122493796.gif" alt="" style="border: 0px;" /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">从上表中我们可以看到请求的总字节数为<span style="color: #800080;"><strong><span style="font-family: 'Times New Roman';">8024</span></strong></span><span style="font-family: 宋体;">字节；响应时间为</span><span style="color: #800080;"><strong><span style="font-family: 'Times New Roman';">0.173&nbsp;</span></strong></span><span style="font-family: 宋体;">秒，也就是下面显示的</span><strong><span style="font-family: 'Times New Roman'; color: #800080;">173.010</span></strong><span style="font-family: 宋体;">毫秒。&nbsp;</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;---------------------哥伦布哥----------------------------------------------------------------</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">Firebug<span style="font-family: 宋体;">非常有名的</span><span style="font-family: 'Times New Roman';">debug</span><span style="font-family: 宋体;">工具，</span><span style="font-family: 'Times New Roman';">firefox</span><span style="font-family: 宋体;">浏览器最得意的集成工具。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">在<span style="font-family: 'Times New Roman';">firefox</span><span style="font-family: 宋体;">浏览菜单栏&#8220;工具&#8221;</span><span style="font-family: 'Times New Roman';">---</span><span style="font-family: 宋体;">添加组件</span><span style="font-family: 'Times New Roman';">---</span><span style="font-family: 宋体;">搜索</span><span style="font-family: 'Times New Roman';">firebug</span><span style="font-family: 宋体;">下载安装重启浏览器。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">同样对百度首页的访问：</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">http://www.baidu.com/</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><img src="http://pic002.cnblogs.com/images/2012/311516/2012071123022554.gif" alt="" style="border: 0px;" /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">从上面图中看到请求的大小为<span style="font-family: 'Times New Roman';"><span style="color: #800080;"><strong>10</strong></span>KB</span><span style="font-family: 宋体;">；响应时间</span><span style="color: #800080;"><strong><span style="font-family: 'Times New Roman';">1.4</span></strong></span><span style="font-family: 宋体;">秒。清楚的发现这数据可以远远大于</span><span style="font-family: 'Times New Roman';">ab</span><span style="font-family: 宋体;">工具所得到的数据。仔细观察发现，</span><span style="font-family: 'Times New Roman';">firebug</span><span style="font-family: 宋体;">给出的数据，访问&nbsp;</span>http://www.baidu.com/ 网址时，客户端（浏览器）和应用之间的数据交互并非<span style="font-family: 'Times New Roman';">1</span><span style="font-family: 宋体;">次，而是</span><span style="font-family: 'Times New Roman';">5</span><span style="font-family: 宋体;">次。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　我们再分析其中的一个请求，<span style="font-family: 'Times New Roman';">firefox</span><span style="font-family: 宋体;">给出的的图形中，有红色和蓝色两种颜色的线条。蓝色表示到此刻发生了</span><span style="font-family: 'Times New Roman';">DOMContentLoaded</span><span style="font-family: 宋体;">事件。红色线条表示</span><span style="font-family: 'Times New Roman';">onload</span><span style="font-family: 宋体;">事件被触发。</span><span style="font-family: 'Times New Roman';">DOMContentLoaded</span><span style="font-family: 宋体;">事件</span><span style="font-family: 'Times New Roman';">W3C</span><span style="font-family: 宋体;">推荐的标准事件，它发生在页面的</span><span style="font-family: 'Times New Roman';">DOM</span><span style="font-family: 宋体;">树建成时，而</span><span style="font-family: 'Times New Roman';">onload</span><span style="font-family: 宋体;">则发生在页面所有的资源（图片文件、</span><span style="font-family: 'Times New Roman';">CSS</span><span style="font-family: 宋体;">文件、</span><span style="font-family: 'Times New Roman';">js</span><span style="font-family: 宋体;">文件等）都被下载完成后。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　从上图的右下角，我们会得到两个响应时间，<span style="font-family: 'Times New Roman';">1.41</span><span style="font-family: 宋体;">秒是</span><span style="font-family: 'Times New Roman';">onload</span><span style="font-family: 宋体;">事件被触发的时间，前面的</span><span style="font-family: 'Times New Roman';">1.4</span><span style="font-family: 宋体;">秒则是页面的所有请求都返回所需要的总时间。那么哪个时间才是用户感受到的响应时间呢？准确的说，两个都不是。用户的感受是个不确定的状态，取决于页面本身的类型以及呈现手段。如果某页面仅为用户提供阅读信息，一旦页面上开始出现可供阅读的内容，用户就开始阅读了。那么，用户认为响应时间就是发出请求到页面上出现可阅读信息。如果页面存在大量的交互内容，需要用户填写或在页面上进行拖拽等操作，在这种情况下，只有当页面的所有元素都被下正确的呈现出来，所有的</span><span style="font-family: 'Times New Roman';">js</span><span style="font-family: 宋体;">文件都已经执行完成后，用户才会感受到这个页面已经就绪。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　Web<span style="font-family: 宋体;">前端性能的研究并不是为了准确地得到一个响应时间数据，实际上，根据</span><span style="font-family: 'Times New Roman';">friebug</span><span style="font-family: 宋体;">图表的结果，</span><span style="font-family: 'Times New Roman';">web</span><span style="font-family: 宋体;">性能一部分取决于</span><span style="font-family: 'Times New Roman';">web</span><span style="font-family: 宋体;">服务器和应用服务器（建立连接，下载连接），别一部分取决于浏览器的实现机制、</span><span style="font-family: 'Times New Roman';">web</span><span style="font-family: 宋体;">页面上的</span><span style="font-family: 'Times New Roman';">js</span><span style="font-family: 宋体;">的执行等。取决于</span><span style="font-family: 'Times New Roman';">web</span><span style="font-family: 宋体;">服务器和应用服务器的响应时间与服务器的负载、压力等相关；而取决于浏览器实现机制与</span><span style="font-family: 'Times New Roman';">js</span><span style="font-family: 宋体;">文件执行所需要的时间则几乎与服务器端的负载和压力无关。那么</span><span style="font-family: 'Times New Roman';">web</span><span style="font-family: 宋体;">端的响应时间也是总响应时间的一部分，那么有必要</span><span style="font-family: 'Times New Roman';">web</span><span style="font-family: 宋体;">端的性能进行了解。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　那么前端性能这么见效，为什么还要去做后端性能测试呢？因为他们关注点不同，前端性能关注单个用户的感受。后端性能关注是更多用户访问系统时，服务器能更稳定、更快的处理用户发来的请求。一个强大的后台是前台的基础。</p><img src ="http://www.blogjava.net/qileilove/aggbug/409609.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-02-08 11:33 <a href="http://www.blogjava.net/qileilove/articles/409609.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试之响应时间</title><link>http://www.blogjava.net/qileilove/articles/409570.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Fri, 07 Feb 2014 03:22:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/articles/409570.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/409570.html</wfw:comment><comments>http://www.blogjava.net/qileilove/articles/409570.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/409570.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/409570.html</trackback:ping><description><![CDATA[<h2><span style="line-height: 24px; display: block; float: left; padding: 0px 8px 0px 5px;">网络</span><span editable-title"="" data-edit-id="84619:84619:1" style="display: block; float: right; padding: 6px 0px 0px 8px; margin-left: 10px;"><a href="http://baike.baidu.com/link?url=Y-4ssDZFZ8uTsBL7mzgKMH66f5M8m_1cEaSJhyOqX_XLGVYhSYgBmscJ2cO6rOD8#" title="编辑本段" style="text-decoration: none; color: #888888; height: 15px; line-height: 16px; padding-left: 18px; background-image: url(http://baike.bdimg.com/static/lemma/view3/img/icon-view_4b787901.gif); font-size: 12px; font-family: 宋体; display: block; background-position: -85px 1px; background-repeat: no-repeat no-repeat;">编辑</a></span></h2><h3><a name="1_1" style="color: rgb(19, 110, 194); position: relative; top: -50px; display: block;"></a><a name="sub84619_1_1" style="color: rgb(19, 110, 194); position: relative; top: -50px; display: block;"></a>简介</h3><div style="color: #333333; margin-bottom: 5px; text-indent: 2em; line-height: 24px; font-family: arial, 宋体, sans-serif; font-size: 14px;">网络对整体<a target="_blank" href="http://baike.baidu.com/view/84619.htm" style="text-decoration: none; color: #136ec2;">响应时间</a>的影响是是通过不同机制完成的。所选择的协议(例如帧中继或ATM，EIGRP或OSPF)会很大程度地影响数据在网络中传输的延迟时间。这些时间包括处理的时延(主机接收到数据包并获得各种信息), 排队时延(当出现了其它的信息包时)，传送或连续传输时延(传输帧中的第一位和最后一位的时间), 传输时延(一个数据位通过链路的时间，他取决于物理的介质和距离)。包的损坏和丢失也会降低信息的质量或增加额外的时延，因为需要重新传输。地面传输的企业网络，等待和传输时延是网络时延的主要问题。对于卫星网络，传输时延(加上访问协议)是主要问题。服务器时延的影响有服务器本身和应用设计两个方面。服务器本身的性能包括处理器的速度，<a target="_blank" href="http://baike.baidu.com/view/87697.htm" style="text-decoration: none; color: #136ec2;">存储器</a>和I/O性能，硬盘驱动速度以及其它设置。应用设计包括结构和算法。</div><h3><a name="1_2" style="color: rgb(19, 110, 194); position: relative; top: -50px; display: block;"></a><a name="sub84619_1_2" style="color: rgb(19, 110, 194); position: relative; top: -50px; display: block;"></a>结构</h3><div style="color: #333333; margin-bottom: 5px; text-indent: 2em; line-height: 24px; font-family: arial, 宋体, sans-serif; font-size: 14px;">应用时延受几个独立的因素影响，例如应用设计(例如通话的稳定性)，交易的大小，选择的协议(例如<a target="_blank" href="http://baike.baidu.com/view/30509.htm" style="text-decoration: none; color: #136ec2;">UDP</a>或TCP)，以及网络的结构。完成一个确定的交易时，一个应用所需要的往返次数越少，它受到网络结构的影响也越小。然而，由于需要重新传输，所以往返的次数本身可能取决于网络结构。</div><h3><a name="1_3" style="color: rgb(19, 110, 194); position: relative; top: -50px; display: block;"></a><a name="sub84619_1_3" style="color: rgb(19, 110, 194); position: relative; top: -50px; display: block;"></a>用户的经验</h3><div style="color: #333333; margin-bottom: 5px; text-indent: 2em; line-height: 24px; font-family: arial, 宋体, sans-serif; font-size: 14px;">计算机的用户最讨厌等待。在大量的处理环境中，超过3秒以上的响应时间将会严重影响工作效率。然而最终用户的感受不仅仅是绝对时间问题，他们对于响应时间的期望是参照以往的经验，而这种期望是相对于他们使用该应用的基准性能。如果使用该应用的当前感受和以往的经验有很大的差别时，抱怨以及需要支持的电话就会成倍地增加。</div><h3><a name="1_4" style="color: rgb(19, 110, 194); position: relative; top: -50px; display: block;"></a><a name="sub84619_1_4" style="color: rgb(19, 110, 194); position: relative; top: -50px; display: block;"></a>重要性</h3><div style="color: #333333; margin-bottom: 5px; text-indent: 2em; line-height: 24px; font-family: arial, 宋体, sans-serif; font-size: 14px;">应用响应时间的问题随着基于服务器应用的大量增加而迅速增多。确定造成应用延迟的原因成为很困难的任务。财富500强中一个财务公司的网络管理经理说他们花了太多的时间用来查找问题，该经理补充说：&#8220;甚至技术人员已经把故障确定为网络中问题的情况下，也只有50%的情况真是网络的问题。有时我们不得不将所有人都派出去而只是为了找到问题在哪里&#8221;。</div><h3><a name="1_5" style="color: rgb(19, 110, 194); position: relative; top: -50px; display: block;"></a><a name="sub84619_1_5" style="color: rgb(19, 110, 194); position: relative; top: -50px; display: block;"></a>维护和管理</h3><div style="color: #333333; margin-bottom: 5px; text-indent: 2em; line-height: 24px; font-family: arial, 宋体, sans-serif; font-size: 14px;">企业要求其网络，应用以及MIS的经理要保证那些与业务相关的关键应用必须在网络上平稳运行。确定影响应用性能的问题在哪里以及谁负责解决该问题是IT部门面临的十分费时且具有挑战性的工作。由于缺少有经验的人员和人力资源的限制，所有企业都希望以省时省力的方法来维护和管理响应时间。<sup style="white-space: nowrap; margin-left: 2px; color: #3366cc; cursor: pointer; padding: 0px 2px; position: relative; vertical-align: baseline; top: -0.5em;">[1-2]</sup><a name="ref_[1&amp;2]_84619" data-collapsed="1" style="color: rgb(19, 110, 194);"></a></div><h2><span style="width: 25px; height: 24px; line-height: 24px; font-size: 16px; display: block; float: left; margin: 1px 0px 0px; background-color: #519cea; color: #ffffff; text-align: center; border-top-left-radius: 0px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 0px; background-position: initial initial; background-repeat: initial initial;">2</span><a name="2" style="color: rgb(19, 110, 194); position: absolute; top: -50px; display: block;"></a><a name="sub84619_2" style="color: rgb(19, 110, 194); position: absolute; top: -50px; display: block;"></a><span style="line-height: 24px; display: block; float: left; padding: 0px 8px 0px 5px;">操作系统</span><span editable-title"="" data-edit-id="84619:84619:2" style="display: block; float: right; padding: 6px 0px 0px 8px; margin-left: 10px;"><a href="http://baike.baidu.com/link?url=Y-4ssDZFZ8uTsBL7mzgKMH66f5M8m_1cEaSJhyOqX_XLGVYhSYgBmscJ2cO6rOD8#" title="编辑本段" style="text-decoration: none; color: #888888; height: 15px; line-height: 16px; padding-left: 18px; background-image: url(http://baike.bdimg.com/static/lemma/view3/img/icon-view_4b787901.gif); font-size: 12px; font-family: 宋体; display: block; background-position: -85px 1px; background-repeat: no-repeat no-repeat;">编辑</a></span></h2><div style="color: #333333; margin-bottom: 5px; text-indent: 2em; line-height: 24px; font-family: arial, 宋体, sans-serif; font-size: 14px;"><strong>操作系统的反映时间</strong></div><div style="color: #333333; margin-bottom: 5px; text-indent: 2em; line-height: 24px; font-family: arial, 宋体, sans-serif; font-size: 14px;">在操作系统中，响应时间指用户发出请求或者指令到系统做出反应（响应）的时间。</div><div style="color: #333333; margin-bottom: 5px; text-indent: 2em; line-height: 24px; font-family: arial, 宋体, sans-serif; font-size: 14px;">系统响应时间包括两个方面：</div><div style="color: #333333; margin-bottom: 5px; text-indent: 2em; line-height: 24px; font-family: arial, 宋体, sans-serif; font-size: 14px;">时间长度和时间的易变性。用户响应时间应该适中，系统响应时间过长，用户就会感到不安和沮丧，而响应时间过短有时会造成用户加快操作节奏，从而导致错误。系统响应时间的易变性是指相对于平均响应时间的偏差。即使响应时间比较长，低的响应时间易变性也有助于用户建立稳定的节奏。因此在系统响应时间上坚持如下原则：</div><div style="color: #333333; margin-bottom: 5px; text-indent: 2em; line-height: 24px; font-family: arial, 宋体, sans-serif; font-size: 14px;">响应时间长度 界面设计</div><div style="color: #333333; margin-bottom: 5px; text-indent: 2em; line-height: 24px; font-family: arial, 宋体, sans-serif; font-size: 14px;">0-10 秒 鼠 标 显 示 成 为 沙 漏</div><div style="color: #333333; margin-bottom: 5px; text-indent: 2em; line-height: 24px; font-family: arial, 宋体, sans-serif; font-size: 14px;">10 到18 秒 由微帮助来显示处理进度</div><div style="color: #333333; margin-bottom: 5px; text-indent: 2em; line-height: 24px; font-family: arial, 宋体, sans-serif; font-size: 14px;">18 秒 以 上 显示处理窗口，或显示进度条</div><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #333333; font-family: arial, 宋体, sans-serif; font-size: 14px; line-height: 24px; text-indent: 2em;">一个长时间的处理完成时 应给予完成警告信息</span>　<br /><br />　从用户角度来说，软件性能就是软件对用户操作的响应时间。说得更明确一点，对用户来说，当用户单击一个按钮，发出一条指令或在<span style="font-family: 'Times New Roman';">web</span><span style="font-family: 宋体;">页面上单击一个链接，从用户单击开始到应用系统把本次操作的结果以用户能察觉的方式展示出来，这个过程所消耗的时间就是用户对软件性能的直观印象。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><img src="http://pic002.cnblogs.com/images/2012/311516/2012070115164456.jpg" alt="" style="border: 0px;" /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 16px;"><strong><span style="background-color: #c0c0c0;">响应时间过程分析</span></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　我们需要对这个过程进行分解，才能得到你真正想要的响应时间。我把整个过程分三个部分，<span style="color: #008000;">呈现时间，数据传输时间和系统处理时间</span>。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #008000; font-size: 15px;"><strong>呈现时间</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　其实主要说的浏览器对接收到数据的一个处理展示的过程。几年前大家都在用<span style="font-family: 'Times New Roman';">IE</span><span style="font-family: 宋体;">，如果页面显示比较慢，我们肯定不会怪罪</span><span style="font-family: 'Times New Roman';">IE</span><span style="font-family: 宋体;">，只会怪罪电信运营商的网速或被访问的系统（其实，大多情况我们不会考虑是被访问系统的问题）。现在</span><span style="font-family: 'Times New Roman';">chrome</span><span style="font-family: 宋体;">来了，我们会发现同一台电脑同一个网站，通过</span><span style="font-family: 'Times New Roman';">chrome</span><span style="font-family: 宋体;">去访问，页面的呈现速度会比</span><span style="font-family: 'Times New Roman';">IE</span><span style="font-family: 宋体;">略快。这是各种评测及大众用户的整体感受。当然，我个人感觉，</span><span style="font-family: 'Times New Roman';">opera</span><span style="font-family: 宋体;">浏览器的呈现速度最快，但它的显示效果一直不太好。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　当然，我说这个呈现时间总不能全怪罪与浏览器的身上吧！当然还和承载它的操作系统有关，以及电脑硬件（比如<span style="font-family: 'Times New Roman';">cpu&nbsp;</span><span style="font-family: 宋体;">内存）。假如你有超快的浏览器，如果是一台极其垃圾的电脑，我想你多打开两个网页就有可能使电脑卡掉。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #008000; font-size: 15px;"><strong>数据传输时间</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　千万不要忽视数据传输时间。如果你要寄信给你一个远方的朋友，你想是什么影响你将信息传递给远方的朋友？不是你写信的过程（如果你写的信不像书一样厚的话），也不是你朋友读信的过程，而是送信的过程。（<span style="font-family: 'Times New Roman';">ps,&nbsp;</span><span style="font-family: 宋体;">我</span><span style="font-family: 'Times New Roman';">10</span><span style="font-family: 宋体;">天前在</span><span style="font-family: 'Times New Roman';">china-pub</span><span style="font-family: 宋体;">订购的一本书现在还没到货！</span><span style="font-family: 'Times New Roman';">XXX</span><span style="font-family: 宋体;">）</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　拿我们系统的数据传输过程来说，我们发送一个请求需要时间，系统处理完后返回给我们也需要时间。初学性能测试工具的同学喜欢拿工具去测试互联网上的一些系统，甚至不懂性能的同学认为可以用性能测试工具将互联网上的一些网站压崩溃。貌似这一招比任何黑客攻击厉害多去。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　那么，我觉得这些同学应该补补网络知识了，你的带宽是多少？互联网是个网，就是算是相同的起点与终点，它有可能走的不同的路线。有没有考虑网络延迟？就算你的并发请求都能成功的发出，但到目的地的时候，已经不能叫并发了。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　这也是为什么我们在一般做性能测试时，一般要强调要在局域网中进行。当然，也有特殊的性能测试需要在互联网中时行。它们重点不是求用户的最大的并发量。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #008000; font-size: 15px;"><strong>系统处理时间</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">系统得到请求后对请求进行处理并将结果返回。那我进行性能测试主要就是验证系统的处理时间，因为前面的呈现时间和数据传输时间都我们不可控制的，用户使用的电脑及浏览器千差万别，用户的网络状况千差万别。我们唯一能控制的就是将系统的处理请求的时间缩到最短暂。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">如果我们对系统的的处理进行分析和讲解的话，它会是一个非常庞大与复杂的过程。语言、语言框架、中间件，数据库、系统架构以及服务器系统。所以，想成为一个优秀的性能测试工程师我们的路还很长。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;"><strong>实际性的能测试</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp; &nbsp; &nbsp; 听了上面的分析，貌似每个过程都挺&#8220;浪费&#8221;时间，那么我们如何只测试系统的处理时间呢？</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　其实现在的测试工具都屏蔽呈现过程，只是模拟多用户并发请求，计算用户得到响应的时间，页不会将服务器的每个响应都向客户端呈现。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　对于数据传输的问题，这也是我要强调的性能测试要在局域网中进行，在局域网中一般不会受到数据带宽的限制。所以，可以对数据的传输时间忽略不计。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;<span style="font-size: 16px; background-color: #c0c0c0;"><strong>响应时间的定义：</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;"><strong>响应时间</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　指的是客户发出请求到得到响应的整个过程的时间。在某些工具中，请求响应时间通常会被称为&#8220;<span style="font-family: 'Times New Roman';">TTLB</span><span style="font-family: 宋体;">&#8221;</span><span style="font-family: 'Times New Roman';">(Time&nbsp;to&nbsp;laster&nbsp;byte)&nbsp;,</span><span style="font-family: 宋体;">意思是从发起一个请求开始，到客户端收到最后一个字节的响应所耗费的时间。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;"><strong>系统响应时间</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　应用系统从发出请求开始到客户端接收到响应所消耗的时间。<span style="color: #ff0000;">需要注明的是，这样的定义完全是个人喜好。你可以提异议。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>&nbsp;</strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong>我们来看两种情况</strong>：</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　我要访问百度首页，发出了一个请求，百度开始给我返回页面数据，当搜索框与搜索按钮都已经返回到页面上了，但那个图标还在发送中。我不认为这个响应是完整的。必须把页面上的所有信息都返回给我才是完整的，我要的也是所有结果返回给我的时间。这种情况更符合&#8220;相应时间&#8221;的定义</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp; &nbsp; &nbsp;某系统有一个信息查询功能，当我输入某条件查询时，可能要查询几百万条数据，如果数据库，要查询所有的数据并把所有的数据全部完整的返回给我。可能服务器要查询很久，而我的电脑全部接收这些数据也可能只直接挂掉。那么服务器可能只查询<span style="font-family: 'Times New Roman';">100</span><span style="font-family: 宋体;">条数据并把数据返回给我，当我点击&#8220;下一页&#8221;时，服务器再次查询并将第二页的数据返回给我。这种情况更符合&#8220;系统响应时间&#8221;的定义。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　关于响应时间，要特别说明的一点是，对客户来说，该值是否能够被接受是带有一定的用户主观色彩，也就是说，响应时间的&#8220;长&#8221;和&#8220;短&#8221;没有绝对的区别。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 16px;"><strong>&nbsp;</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 16px; background-color: #c0c0c0;"><strong>合理的响应时间</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　在互联网上对于用户响应时间，有一个普遍的标准。<span style="font-family: 'Times New Roman';">2/5/10</span><span style="font-family: 宋体;">秒原则。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　也就是说，在<span style="font-family: 'Times New Roman';">2</span><span style="font-family: 宋体;">秒之内给客户响应被用户认为是&#8220;非常有吸引力&#8221;的用户体验。在</span><span style="font-family: 'Times New Roman';">5</span><span style="font-family: 宋体;">秒之内响应客户被认为&#8220;比较不错&#8221;的用户体验，在</span><span style="font-family: 'Times New Roman';">10</span><span style="font-family: 宋体;">秒内给用户响应被认为&#8220;糟糕&#8221;的用户体验。如果超过</span><span style="font-family: 'Times New Roman';">10</span><span style="font-family: 宋体;">秒还没有得到响应，那么大多用户会认为这次请求是失败的。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　这里我们还要考虑一个使用频率的概念。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　我最早安装<span style="font-family: 'Times New Roman';">windows</span><span style="font-family: 宋体;">系统可能要</span><span style="font-family: 'Times New Roman';">1</span><span style="font-family: 宋体;">个小时，我们为什么觉得这很正常，因为我们要很久才装一次系统，如果系统使用得当，可能一个系统用几年不用重装，假如，我们在系统上装个任何小软件都要这么长时间，那我们一定是无法忍受的。对于软件控来说，他们会时常安装各种新鲜有趣的软件进行使用。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">对于一个税务报账系统，该系统的用户每月使用一次，一次花费<span style="font-family: 'Times New Roman';">3</span><span style="font-family: 宋体;">小时进行数据的录入，</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">当用户单击&#8220;提交&#8221;按钮后，即使系统在<span style="font-family: 'Times New Roman';">10</span><span style="font-family: 宋体;">分钟后才给出&#8220;处理成功&#8221;的消息，我们也觉得是可以接受的。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;因此，在进行性能测试时，&#8220;合理的响应时间&#8221;取决于用户的需求，而不能依据测试人员自己设想来决定。</p><img src ="http://www.blogjava.net/qileilove/aggbug/409570.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-02-07 11:22 <a href="http://www.blogjava.net/qileilove/articles/409570.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试之吞吐量</title><link>http://www.blogjava.net/qileilove/articles/409458.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 30 Jan 2014 04:25:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/articles/409458.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/409458.html</wfw:comment><comments>http://www.blogjava.net/qileilove/articles/409458.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/409458.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/409458.html</trackback:ping><description><![CDATA[<strong style="margin: 0px; font-weight: bolder; color: #333333; font-family: sans-serif; line-height: 19.484375px;">系统吞吐量</strong><span style="color: #333333; font-family: sans-serif; line-height: 19.484375px;">：系统吞吐量是指</span><a href="http://wiki.mbalib.com/wiki/%E7%B3%BB%E7%BB%9F" title="系统" style="margin: 0px; color: #173abd; text-decoration: none; font-family: sans-serif; line-height: 19.484375px;">系统</a><span style="color: #333333; font-family: sans-serif; line-height: 19.484375px;">在单位时间内所处理的</span><a href="http://wiki.mbalib.com/wiki/%E4%BF%A1%E6%81%AF%E9%87%8F" title="信息量" style="margin: 0px; color: #173abd; text-decoration: none; font-family: sans-serif; line-height: 19.484375px;">信息量</a><span style="color: #333333; font-family: sans-serif; line-height: 19.484375px;">，它以每小时或每天所处理的进程数来度量。</span><span style="color: #333333; font-family: arial, 宋体, sans-serif; line-height: 24px; text-indent: 28px; background-color: #ffffff;">吞吐量是指对网络、设备、端口、虚电路或其他设施，单位时间内成功地传送数据的数量（以</span><a target="_blank" href="http://baike.baidu.com/view/189728.htm" style="text-decoration: none; color: #136ec2; font-family: arial, 宋体, sans-serif; line-height: 24px; text-indent: 28px; background-color: #ffffff;">比特</a><span style="color: #333333; font-family: arial, 宋体, sans-serif; line-height: 24px; text-indent: 28px; background-color: #ffffff;">、</span><a target="_blank" href="http://baike.baidu.com/view/60408.htm" style="text-decoration: none; color: #136ec2; font-family: arial, 宋体, sans-serif; line-height: 24px; text-indent: 28px; background-color: #ffffff;">字节</a><span style="color: #333333; font-family: arial, 宋体, sans-serif; line-height: 24px; text-indent: 28px; background-color: #ffffff;">、分组等测量）。<br /><br /><br /></span><br /><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">对于交互式应用来说，吞吐量指标反映的是服务器承受的压力，在容量规划的测试中，吞吐量是一个重点关注的指标，因为它能够说明系统级别的负载能力，另外，在性能调优过程中，吞吐量指标也有重要的价值。如一个大型工厂，他们的生产效率与生产速度很快，一天生产<span style="font-family: 'Times New Roman';">10W</span><span style="font-family: 宋体;">吨的货物，结果工厂的运输能力不行，就两辆小型三轮车一天拉</span><span style="font-family: 'Times New Roman';">2</span><span style="font-family: 宋体;">吨的货物，比喻有些夸张，但我想说明的是这个运输能力是整个系统的瓶颈。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　提示，用吞吐量来衡量一个系统的输出能力是极其不准确的，用个最简单的例子说明，一个水龙头开一天一夜，流出<span style="font-family: 'Times New Roman';">10</span><span style="font-family: 宋体;">吨水；</span><span style="font-family: 'Times New Roman';">10</span><span style="font-family: 宋体;">个水龙头开</span><span style="font-family: 'Times New Roman';">1</span><span style="font-family: 宋体;">秒钟，流出</span><span style="font-family: 'Times New Roman';">0.1</span><span style="font-family: 宋体;">吨水。当然是一个水龙头的吞吐量大。你能说</span><span style="font-family: 'Times New Roman';">1</span><span style="font-family: 宋体;">个水龙头的出水能力是</span><span style="font-family: 'Times New Roman';">10</span><span style="font-family: 宋体;">个水龙头的强？所以，我们要加单位时间，看谁</span><span style="font-family: 'Times New Roman';">1</span><span style="font-family: 宋体;">秒钟的出水量大。这就是吞吐率。<br /></span><strong style="margin: 0px; font-weight: bolder; color: #333333; font-family: sans-serif; font-size: 14px; line-height: 19.484375px;">系统吞吐量</strong><span style="color: #333333; font-family: sans-serif; font-size: 14px; line-height: 19.484375px;">：系统吞吐量是指</span><a href="http://wiki.mbalib.com/wiki/%E7%B3%BB%E7%BB%9F" title="系统" style="margin: 0px; color: #173abd; text-decoration: none; font-family: sans-serif; font-size: 14px; line-height: 19.484375px;">系统</a><span style="color: #333333; font-family: sans-serif; font-size: 14px; line-height: 19.484375px;">在单位时间内所处理的</span><a href="http://wiki.mbalib.com/wiki/%E4%BF%A1%E6%81%AF%E9%87%8F" title="信息量" style="margin: 0px; color: #173abd; text-decoration: none; font-family: sans-serif; font-size: 14px; line-height: 19.484375px;">信息量</a><span style="color: #333333; font-family: sans-serif; font-size: 14px; line-height: 19.484375px;">，它以每小时或每天所处理的进程数来度量。<br /><br /></span><p style="margin: 1em 0px; unicode-bidi: embed; color: #333333; font-family: sans-serif; font-size: 14px; line-height: 19.484375px;">系统吞吐量是指系统在单位时间内所处理的信息量，它以每小时或每天所处理的进程数来度量。</p><p style="margin: 1em 0px; unicode-bidi: embed; color: #333333; font-family: sans-serif; font-size: 14px; line-height: 19.484375px;">　　影响吞吐量因素：</p><p style="margin: 1em 0px; unicode-bidi: embed; color: #333333; font-family: sans-serif; font-size: 14px; line-height: 19.484375px;">　　1、存储设备的存取速度，即从存储器读出数据或数据写入存储器所需时间；</p><p style="margin: 1em 0px; unicode-bidi: embed; color: #333333; font-family: sans-serif; font-size: 14px; line-height: 19.484375px;">　　2、CPU性能：1）时钟频率；2）每条指令所花的时钟周期数（即CPI）；3）指令条数；</p><p style="margin: 1em 0px; unicode-bidi: embed; color: #333333; font-family: sans-serif; font-size: 14px; line-height: 19.484375px;">　　3、系统结构，如并行处理结构可增大吞吐量。</p><div class="editsection" style="margin: 1em 0px 0px 5px; unicode-bidi: embed; color: #333333; font-family: sans-serif; font-size: 14px; line-height: 19.484375px; float: right;">[<a href="http://wiki.mbalib.com/w/index.php?title=%E5%90%9E%E5%90%90%E9%87%8F&amp;action=edit&amp;section=4" title="编辑段落: 港口吞吐量" style="margin: 0px; color: #2153b0; text-decoration: none;">编辑</a>]</div><div><p style="margin-top: 10px; margin-bottom: 10px;"><span style="color: #0000ff; font-size: 16px;"><strong>吞吐率</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px;">　　单位时间内网络上传输的数据量，也可以指单位时间内处理客户请求数量。它是衡量网络性能的重要指标，通常情况下，吞吐率用&#8220;字节数<span style="font-family: 'Times New Roman';">/</span><span style="font-family: 宋体;">秒&#8221;来衡量，当然，你可以用&#8220;请求数</span><span style="font-family: 'Times New Roman';">/</span><span style="font-family: 宋体;">秒&#8221;和&#8220;页面数</span><span style="font-family: 'Times New Roman';">/</span><span style="font-family: 宋体;">秒&#8221;来衡量。<span style="color: #ff6600;">其实，</span></span><span style="color: #ff6600;">不管是一个请求还是一个页面，它的本质都是在网络上传输的数据，那么来表示数据的单位就是字节数。</span></p><p style="margin-top: 10px; margin-bottom: 10px;">　　不过以不同的方式表达的吞吐量可以说明不同层次的问题。例如，以字节数<span style="font-family: 'Times New Roman';">/</span><span style="font-family: 宋体;">秒方式表示的吞吐量主要受网络基础设置、服务器架构、应用服务器制约；以请求数</span><span style="font-family: 'Times New Roman';">/</span><span style="font-family: 宋体;">秒方式表示的吞吐量主要受应用服务器和应用代码的制约。</span></p><p style="margin-top: 10px; margin-bottom: 10px;">　　但是从业务的角度看，吞吐率也可以用&#8220;业务数<span style="font-family: 'Times New Roman';">/</span><span style="font-family: 宋体;">小时或天&#8221;、&#8220;访问人数</span><span style="font-family: 'Times New Roman';">/</span><span style="font-family: 宋体;">小时或天&#8221;、&#8220;页面访问量</span><span style="font-family: 'Times New Roman';">/</span><span style="font-family: 宋体;">小时或天&#8221;来衡量。例如，在银行卡审批系统中，可以用&#8220;千件</span><span style="font-family: 'Times New Roman';">/</span><span style="font-family: 宋体;">小时&#8221;来衡量系统的业务处理能力。那么，从用户的角度，一个表单提交可以得到一次审批。又引出来一个概念</span><span style="font-family: 'Times New Roman';">---</span><span style="font-family: 宋体;">事务。<br /></span><div class="para" style="color: #333333; margin-bottom: 5px; text-indent: 2em; line-height: 24px; font-family: arial, 宋体, sans-serif; font-size: 14px;">throughput</div><div class="para" style="color: #333333; margin-bottom: 5px; text-indent: 2em; line-height: 24px; font-family: arial, 宋体, sans-serif; font-size: 14px;">吞吐率原指一个业务系统在单位时间内提供的产量（或服务量）。在<a target="_blank" href="http://baike.baidu.com/view/3314.htm" style="text-decoration: none; color: #136ec2;">计算机</a>或数据通信系统，指的是单位时间内通过某通信信道（a communication channel）或某个节点成功交付数据的平均速率，通常以每秒比特数（bps， bits per second ）为单位。</div><div class="para" style="color: #333333; margin-bottom: 5px; text-indent: 2em; line-height: 24px; font-family: arial, 宋体, sans-serif; font-size: 14px;">吞吐率是一种关于计算机或数据通信系统(如网桥、<a target="_blank" href="http://baike.baidu.com/view/1360.htm" style="text-decoration: none; color: #136ec2;">路由器</a>、<a target="_blank" href="http://baike.baidu.com/view/807.htm" style="text-decoration: none; color: #136ec2;">网关</a>或<a target="_blank" href="http://baike.baidu.com/view/21956.htm" style="text-decoration: none; color: #136ec2;">广域网</a>连接等)数据传输率的测度。吞吐率通常是对一个系统和它的部件处理传输数据请求能力的总体评价。例如，一个服务器的吞吐率依赖于它的处理器类型、网络接口卡的类型、数据传输<a target="_blank" href="http://baike.baidu.com/view/1389.htm" style="text-decoration: none; color: #136ec2;">总线</a>的大小、<a target="_blank" href="http://baike.baidu.com/view/157418.htm" style="text-decoration: none; color: #136ec2;">磁盘</a>速度、内存缓冲器的体积，以及软件对这些部件进行管理的有效程度。在通信系统中，这个测度通常基于每秒能处理的数据位数或分组的数目，它依赖于网络的<a target="_blank" href="http://baike.baidu.com/view/10821.htm" style="text-decoration: none; color: #136ec2;">带宽</a>和交换部件(如<a target="_blank" href="http://baike.baidu.com/view/1360.htm" style="text-decoration: none; color: #136ec2;">路由器</a>或<a target="_blank" href="http://baike.baidu.com/view/7770.htm" style="text-decoration: none; color: #136ec2;">集线器</a>)的速度。网络上两个端点<a target="_blank" href="http://baike.baidu.com/view/497412.htm" style="text-decoration: none; color: #136ec2;">设备间</a>的吞吐率依赖于计算机、网络接口卡和连接它们的网络。</div><div class="para" style="color: #333333; margin-bottom: 5px; text-indent: 2em; line-height: 24px; font-family: arial, 宋体, sans-serif; font-size: 14px;">吞吐率作为一个重要的衡量指标，最主要应用在<a target="_blank" href="http://baike.baidu.com/view/494465.htm" style="text-decoration: none; color: #136ec2;">并行处理</a>上，属于<a target="_blank" href="http://baike.baidu.com/view/591160.htm" style="text-decoration: none; color: #136ec2;">系统结构</a>中最重要的一个变量，它的定义是：单位时间的<a target="_blank" href="http://baike.baidu.com/view/4316.htm" style="text-decoration: none; color: #136ec2;">吞吐量</a>。所以它的详细定义参见<a target="_blank" href="http://baike.baidu.com/view/4316.htm" style="text-decoration: none; color: #136ec2;">吞吐量</a>。</div><div class="para" style="color: #333333; margin-bottom: 5px; text-indent: 2em; line-height: 24px; font-family: arial, 宋体, sans-serif; font-size: 14px;">吞吐率在<a target="_blank" href="http://baike.baidu.com/view/106187.htm" style="text-decoration: none; color: #136ec2;">性能测试</a>中指单位时间内在网络上传输的数据量。是衡量网络性能的主要指标。</div><span style="font-family: 宋体;"><br /></span><p class="p0" style="margin-top: 10px; margin-bottom: 10px;"><span style="color: #0000ff; font-size: 16px;"><strong>事务</strong></span></p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;">　　就是用户某一步或几步操作的集合。不过，我们要保证它有一个完整意义。比如用户对某一个页面的一次请求，用户对某系统的一次登录，淘宝用户对商品的一次确认支付过程。这些我们都可以看作一个事务。那么如何衡量服务器对事务的处理能力。又引出一个概念<span style="font-family: 'Times New Roman';">----TPS</span></p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;"><span style="color: #0000ff; font-size: 16px;"><strong>TPS&nbsp;(Transaction&nbsp;Per&nbsp;second)&nbsp;</strong></span></p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;">每秒钟系统能够处理事务或交易的数量，它是衡量系统处理能力的重要指标。</p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;">&nbsp;<span style="color: #333333; font-family: arial, 宋体, sans-serif; font-size: 14px; line-height: 24px; text-indent: 2em;">每秒事务处理量 - 性能测试的术语介绍</span></p><div style="color: #333333; margin-bottom: 5px; text-indent: 2em; line-height: 24px; font-family: arial, 宋体, sans-serif; font-size: 14px;">TPS(Transaction Per Second)</div><div style="color: #333333; margin-bottom: 5px; text-indent: 2em; line-height: 24px; font-family: arial, 宋体, sans-serif; font-size: 14px;">每秒钟系统能够处理的交易或事务的数量。它是衡量系统处理能力的重要指标。TPS是LoadRunner中重要的性能参数指标。</div><p class="p0" style="margin-top: 10px; margin-bottom: 10px;"><span style="color: #0000ff; font-size: 16px;"><strong>点击率（<span style="font-family: 'Times New Roman';">Hit&nbsp;Per&nbsp;Second</span><span style="font-family: 宋体;">）</span></strong></span></p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;">点击率可以看做是<span style="font-family: 'Times New Roman';">TPS</span><span style="font-family: 宋体;">的一种特定情况。点击率更能体现用户端对服务器的压力。</span><span style="font-family: 'Times New Roman';">TPS</span><span style="font-family: 宋体;">更能体现服务器对客户请求的处理能力。</span></p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;">每秒钟用户向<span style="font-family: 'Times New Roman';">web</span><span style="font-family: 宋体;">服务器提交的</span><span style="font-family: 'Times New Roman';">HTTP</span><span style="font-family: 宋体;">请求数。这个指标是</span><span style="font-family: 'Times New Roman';">web&nbsp;</span><span style="font-family: 宋体;">应用特有的一个指标；</span><span style="font-family: 'Times New Roman';">web</span><span style="font-family: 宋体;">应用是&#8220;请求</span><span style="font-family: 'Times New Roman';">-</span><span style="font-family: 宋体;">响应&#8221;模式，用户发一个申请，服务器就要处理一次，所以点击是</span><span style="font-family: 'Times New Roman';">web</span><span style="font-family: 宋体;">应用能够处理的交易的最小单位。如果把每次点击定义为一个交易，点击率和</span><span style="font-family: 'Times New Roman';">TPS</span><span style="font-family: 宋体;">就是一个概念。容易看出，点击率越大。对服务器的压力也越大，点击率只是一个性能参考指标，重要的是分析点击时产生的影响。</span></p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;">需要注意的是，这里的点击不是指鼠标的一次&#8220;单击&#8221;操作，因为一次&#8220;单击&#8221;操作中，客户端可能向服务器发现多个<span style="font-family: 'Times New Roman';">HTTP</span><span style="font-family: 宋体;">请求。</span></p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;"><strong>吞吐量指标的作用</strong>：</p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;">　　再次将话题回归到吞吐量上，在我们的性能测试中查看吞吐量对我们的测试有什么意义呢。</p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;">　　1.&nbsp;用户协助设计性能测试场景，以及衡量性能测试场景是否达到了预期的设计目标：在设计性能测试场景时，吞吐量可被用户协助设计性能测试场景，根据估算的吞吐量数据，可以对应到测试场景的事务发生频率，事务发生次数等；另外，在测试完成后，根据实际的吞吐量可以衡量测试是否达到了预期的目标。</p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;">　　2.&nbsp;用于协助分析性能瓶颈：吞吐量的限制是性能瓶颈的一种重要表现形式，因此，有针对性地对吞吐量设计测试，可以协助尽快定位到性能冰晶所在位置。</p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;">&nbsp;</p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;"><span style="background-color: #c0c0c0;"><strong>扩展</strong></span>：</p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;"><span style="font-size: 16px;"><strong><span style="color: #0000ff;">RBI<span style="font-family: 宋体;">（</span><span style="font-family: 'Times New Roman';">rapid&nbsp;bottleneck&nbsp;identify</span><span style="font-family: 宋体;">）</span></span></strong></span></p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;">是<span style="font-family: 'Times New Roman';">Empirix</span><span style="font-family: 宋体;">公司提出的快速识别系统性能瓶颈的方法。该方法基于以下事实。</span></p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;">&nbsp;&nbsp;&nbsp;&nbsp;1.&nbsp;<span style="font-family: 宋体;">发现的</span><span style="font-family: Arial;">80%</span><span style="font-family: 宋体;">系统的性能瓶颈都由吞吐量制约；</span></p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;">&nbsp;&nbsp;&nbsp;&nbsp;2.&nbsp;<span style="font-family: 宋体;">并发用户数和吞吐量瓶颈之间存在一定的关联；</span></p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;">&nbsp;&nbsp;&nbsp;&nbsp;3.&nbsp;<span style="font-family: 宋体;">采用吞吐量测试可以更快速定位问题。</span>&nbsp;</p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;">通过不断增加并发用户数和吞吐量观察系统的性能瓶颈。然后，从网络、数据库、应用服务器和代码本身<span style="font-family: 'Times New Roman';">4</span><span style="font-family: 宋体;">个环节确定系统的的性能瓶颈。</span></p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;"><span style="font-family: 宋体;">&nbsp;</span></p><p class="p0" style="margin-top: 10px; margin-bottom: 10px;"><span style="font-family: 宋体;">　　其实，我讲了这么多概念，我们无非是站在不同的角度去分解系统的性能，站在用户的角度，服务器的角度、系统的各种角度。了解一个人需要多方面，了解一个系统也需要多方面。我在尽量把这些东西讲的不枯燥，而且易懂。其实，自己写的过程也是思考的过程。</span></p><span style="font-family: 宋体;"><br /></span></p></div><a name=".E6.B8.AF.E5.8F.A3.E5.90.9E.E5.90.90.E9.87.8F" style="margin: 0px; color: #2153b0; font-family: sans-serif; font-size: 14px; line-height: 19.484375px; width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); background-repeat: no-repeat no-repeat;"></a></p><img src ="http://www.blogjava.net/qileilove/aggbug/409458.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-01-30 12:25 <a href="http://www.blogjava.net/qileilove/articles/409458.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试---并发用户</title><link>http://www.blogjava.net/qileilove/articles/409432.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 29 Jan 2014 07:56:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/articles/409432.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/409432.html</wfw:comment><comments>http://www.blogjava.net/qileilove/articles/409432.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/409432.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/409432.html</trackback:ping><description><![CDATA[<p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #3366ff; font-size: 16px;"><strong>并发用户数</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　大家都知道我们的性能测试就通过工具模拟多用户对系统进行操作，对系统造成压力，来验证系统的性能（不太标准的解释）。好多人也简单的把性能测试当成并发测试。那么这个&#8220;多用户&#8221;和&#8220;同时&#8221;两个因素缺一不可。只多用户不同时，很难对系统构成压力；没有多个用户，同时的概念也就自然不存在了</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 14px;"><strong>并发的两种情况</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　一种是严格意义上的并发，即所有的用户在同一时刻做同一件事或操作，这种操作一般指做同一类型的业务。比如，所有用户同一时刻做并发登陆，同一时刻做表单提交。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　另外一种并发是广义范围的并发，这种并发与前一种并发的区别是，尽管多个用户对系统发出了请求或者进行了操作，但是这些请求或都操作可以是相同的，也可以是不同的。比如，在同一时刻有用户在登录，有用户在提交表单。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 15px;"><strong>从服务器的角度来看并发</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　前面的两种解释都是从用户业务的角度来解释并发的，因为我们平时所做的性能测试也是从用户端对业务层的操作来进行并发测试的。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　如果考虑整个系统运行过程中服务器所承受的压力是这样的：在该系统的运行过程中，把整个运行过程划分为离散的时间点，在每个点上，都有一个&#8220;同时向服务端发送请求的客户数&#8221;，这个就是所谓的服务器所承受的最大并发访问数。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #3366ff; font-size: 16px;"><strong>真正意义上的并发不存在</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　上面试谈了这么多并发，现在又说真正意义上的并发不存在。何解？学操作系统原理的同学都知道，<span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">在一个时间点上只能干一件事儿。为什么我们可以边看电影，边打字，边语音。因为</span><span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">很快很快，他可以处理一下电影，再处理一下打字，再处理一下语音。因为它很快，所以，它可以在多个程序之间快速瞬间的切换，给你造成的假象就是它在同时做这些事情。（现在的双核、四核的</span><span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">另说）</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　那么我们的系统在接到用户的请求后也要调用<span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">来完成某些处理，然后返回给用户。那么我们对系统有做并发测试是测什么呢？举个简单的例子。假如有一位神医，他的看病速度非常快，假设他的看病速度是不变的；然后有一群接待人员来接待看病的客人，有成千上万的病人来看病，接待人员要想各种办法来做好接待工作，使病人更快的看到病。比如，可以事先咨询病人得的什么病，然后将病人进行分类，比如可以扩大接待室，让更多的病人可以进到医院来看病等。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　神医就是我们的<span style="font-family: 'Times New Roman';">CPU</span><span style="font-family: 宋体;">，接待人员就是我们的系统，病人就用户，我们做性能测试的目的就是了解接待人员哪个地方给医院看病造成了瓶颈。只来一个病人，医院的看病速度与服务很好。一下子来十万个病人各种问题就出来了。接待人员的服务态度下降，多余的人员跟本进不到医院去，医院的洗手间不够用，造成病人无法上厕所而离开，这些都属于系统问题。所以，我们一般测试的目的是看医院的接待能力。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 16px;"><strong><span style="color: #3366ff;">系统用户数与同时在线人数</span></strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　在实际的性能测试中，经常接触到与并发用户相关的概念还有&#8220;系统用户数&#8221;与&#8220;同时在线人数&#8221;下面通过一个实例来描述他们之间的差别。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　假设有一个网站，注册用户才能登录使用各种功能，如上传头像，阅读专家文章等。该系统有<span style="font-family: 'Times New Roman';">20</span><span style="font-family: 宋体;">万注册用户，这就是说有</span><span style="font-family: 'Times New Roman';">20</span><span style="font-family: 宋体;">万用户可以使用这个网站的所有功能，</span><span style="font-family: 'Times New Roman';">20</span><span style="font-family: 宋体;">万就是这个网站的&#8220;系统用户数&#8221;，网站有一个在线统计功能，从统计数据中可以看到，同时登录网站的人数的最高记录是</span><span style="font-family: 'Times New Roman';">2</span><span style="font-family: 宋体;">万，就是有</span><span style="font-family: 'Times New Roman';">2</span><span style="font-family: 宋体;">万人同时用浏览器打开着这个网站。</span><span style="font-family: 'Times New Roman';">2</span><span style="font-family: 宋体;">万就是&#8220;同时在线人数&#8221;</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　那么系统的并发用户数是多少呢<span style="font-family: 'Times New Roman';">?2</span><span style="font-family: 宋体;">万么？</span><span style="font-family: 'Times New Roman';">NO!</span><span style="font-family: 宋体;">这</span><span style="font-family: 'Times New Roman';">2</span><span style="font-family: 宋体;">万只表示在系统最高峰时有这么多用户登录了网站，并不表示实际服务器的承受压力。因为服务器承受压力还与具体的用户访问模式相关，在这</span><span style="font-family: 'Times New Roman';">2</span><span style="font-family: 宋体;">万用户中考察某一个时间点对用户发出请求数，可以会大大缩水。那么，该系统的服务端承受的最大并发访问数是多少呢？这个取决于业务并发用户数和业务场景，一般可以通过服务器日志的分析得到。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #3366ff; font-size: 16px;"><strong>求并发用户数公式</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">在实际的性能测试工作中，测试人员一般比较关心的是业务并发用户数，也就是从业务的角度关注应该设置多少个并发数比较合理。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">下面找一个典型的上班签到系统，早上<span style="font-family: 'Times New Roman';">8</span><span style="font-family: 宋体;">点上班，</span><span style="font-family: 'Times New Roman';">7</span><span style="font-family: 宋体;">点半到</span><span style="font-family: 'Times New Roman';">8</span><span style="font-family: 宋体;">点的</span><span style="font-family: 'Times New Roman'; color: #ff0000;">30</span><span style="font-family: 宋体;">分钟的时间里用户会登录签到系统进行签到。公司员工为</span><span style="font-family: 'Times New Roman'; color: #ff0000;">1000</span><span style="font-family: 宋体;">人，平均每个员上登录签到系统的时长为</span><span style="font-family: 'Times New Roman'; color: #ff0000;">5</span><span style="font-family: 宋体;">分钟。可以用下面的方法计算。</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><strong><span style="color: #ff0000;">　　　　C=1000/30<strong><strong><strong>*5</strong></strong></strong>=166.7</span></strong></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #ff0000;"><strong>C</strong></span><span style="font-family: 宋体;">表示平均并发用户数，那么对这个签到系统每分钟的平均在线用户数为</span><span style="font-family: 'Times New Roman';">166</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">当然，在性能测试上，任何公式都不是严谨的，最重要的是对系统做出有效正确的分析。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;--------------------------</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp; &nbsp; &nbsp;<span style="color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 22.390625px;">估算并发用户并发数公式：</span></p><span style="color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 22.390625px;">1、用户从登陆系统到退出系统的间隔时间L</span><br style="margin: 0px; padding: 0px; word-wrap: break-word; line-height: normal; color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px;" /><span style="color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 22.390625px;">2、登陆系统的用户数量n</span><br style="margin: 0px; padding: 0px; word-wrap: break-word; line-height: normal; color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px;" /><span style="color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 22.390625px;">3、被考察的时间长度T</span><br style="margin: 0px; padding: 0px; word-wrap: break-word; line-height: normal; color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px;" /><span style="color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 22.390625px;">并发用户数C=nL/T</span><br style="margin: 0px; padding: 0px; word-wrap: break-word; line-height: normal; color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px;" /><span style="color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 22.390625px;">举例：</span><br style="margin: 0px; padding: 0px; word-wrap: break-word; line-height: normal; color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px;" /><span style="color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 22.390625px;">如果系统有3000个注册用户，平均每天400个用户要访问系统，一般一个典型用户在系统中停留4小时（从登陆到退出），在一天内，用户在8小时内使用该系统</span><br style="margin: 0px; padding: 0px; word-wrap: break-word; line-height: normal; color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px;" /><span style="color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 22.390625px;">并发用户数=400X4/8=200<br /></span><span style="color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 22.390625px; background-color: #ffffff;">如果你要计算峰值用户数的话，用另外一个公式</span><br style="margin: 0px; padding: 0px; word-wrap: break-word; line-height: normal; color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px; background-color: #ffffff;" /><span style="color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 22.390625px; background-color: #ffffff;">C1=C+3 X sqr(C)</span><br style="margin: 0px; padding: 0px; word-wrap: break-word; line-height: normal; color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px; background-color: #ffffff;" /><span style="color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 22.390625px; background-color: #ffffff;">C表示并发用户数</span><br style="margin: 0px; padding: 0px; word-wrap: break-word; line-height: normal; color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px; background-color: #ffffff;" /><span style="color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 22.390625px; background-color: #ffffff;">根据我之前算出的结果，并发用户数是200，那么公式为：</span><br style="margin: 0px; padding: 0px; word-wrap: break-word; line-height: normal; color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px; background-color: #ffffff;" /><span style="color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 22.390625px; background-color: #ffffff;">C1=200+3 x sqr(200)=242</span><img src ="http://www.blogjava.net/qileilove/aggbug/409432.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-01-29 15:56 <a href="http://www.blogjava.net/qileilove/articles/409432.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试分类</title><link>http://www.blogjava.net/qileilove/articles/409413.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Tue, 28 Jan 2014 14:33:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/articles/409413.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/409413.html</wfw:comment><comments>http://www.blogjava.net/qileilove/articles/409413.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/409413.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/409413.html</trackback:ping><description><![CDATA[<span style="font-size: 12pt;">什么性能测试还有分类？不是就看快慢么? 大哥你要是这么理解那就外行的不能在外行了~</span><br /><span style="font-size: 12pt;">其实也不怪大家，</span><span style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 18px; background-color: #ffffff;">常会别人说到性能测试、负载测试、压力测试、并发测试，很多人都是混合使用，或者一会叫压力测试，一会叫并发测试。这些概念除了非测试人员分不清楚，甚至许多专业测试人员也对这些名词也很模糊。<br />下来我们就说性能测试的分类。<br /></span><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #008000; font-size: 16px;"><strong>先说说性能测试（狭义）的定义</strong></span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">　　性能测试方法是通过模拟生产运行的业务压力量和使用场景组合，测试系统的性能是否满足生产性能要求。通俗地说，这种方法就是要在特定的运行条件下验证系统的能力状态。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">特点：<br /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">1、这种方法的主要目的是验证系统是否有系统宣称具有的能力。<br />2、这种方法要事先了解被测试系统经典场景，并具有确定的性能目标。<br />3、这种方法要求在已经确定的环境下运行。</p><span style="color: #008000; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">也就是说，这种方法是对系统性能已经有了解的前提，并对需求有明确的目标，并在已经确定的环境下进行的。<br /></span>下来说说广义面的定义和类型<br />基本上有以下几种<br />一&#183;负载测试<br /><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">通过在被测系统上不断加压，直到性能指标达到极限，例如&#8220;响应时间&#8221;超过预定指标或都某种资源已经达到饱和状态。<br /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">特点：</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">1、这种性能测试方法的主要目的是找到系统处理能力的极限。<br />2、这种性能测试方法需要在给定的测试环境下进行，通常也需要考虑被测试系统的业务压力量和典型场景、使得测试结果具有业务上的意义。<br />3、这种性能测试方法一般用来了解系统的性能容量，或是配合性能调优来使用。<br /><br /><font color="#008000">打个比方 例如 每次吃饭只吃一碗米饭，结果为了检测你最多能吃多，那就不停地让你吃，直到你实在吃不下去，哈哈 崩溃了吧~<br /><br />压力测试<br /><br /></font></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">压力测试方法测试系统在一定饱和状态下，例如cpu、内存在饱和使用情况下，系统能够处理的会话能力，以及系统是否会出现错误</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">特点：</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">1、这种性能测试方法的主要目的是检查系统处于压力性能下时，应用的表现。<br />2、这种性能测试一般通过模拟负载等方法，使得系统的资源使用达到较高的水平。<br />3、这种性能测试方法一般用于测试系统的稳定性。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="color: #008000;">打个比方，CPU在满负荷的状态下 你在去打开几个应用 看系统会不会崩溃 等等~</span></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><font color="#008000">并发测试&nbsp;<br /></font></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">并发测试方法通过模拟用户并发访问，测试多用户并发访问同一个应用、同一个模块或者数据记录时是否存在死锁或其者他性能问题。<br /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">特点：</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">1、这种性能测试方法的主要目的是发现系统中可能隐藏的并发访问时的问题。<br />2、这种性能测试方法主要关注系统可能存在的并发问题，例如系统中的内存泄漏、线程锁和资源争用方面的问题。<br />3、这种性能测试方法可以在开发的各个阶段使用需要相关的测试工具的配合和支持。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><font color="#008000">打个比方 &nbsp;例如 一个饭堂最多能容纳100人吃饭，结果中午去了 200个在同一时刻去吃饭，结果100只能等着别人吃完饭 所以最大并发数为100<br /></font></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><span style="font-size: 16px;"><strong><span style="color: #008000;">配置测试</span></strong></span><br /><br />配置测试方法通过对被测系统的软\硬件环境的调整，了解各种不同对系统的性能影响的程度，从而找到系统各项资源的最优分配原则。<br /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">特点：</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;">1、这种性能测试方法的主要目的是了解各种不同因素对系统性能影响的程度，从而判断出最值得进行的调优操作。<br />2、这种性能测试方法一般在对系统性能状况有初步了解后进行。<br />3、这种性能测试方法一般用于性能调优和规划能力。</p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><font color="#008000">打个比方 &nbsp;例如 我们玩一个款大型网络3D游戏 你拿很烂的双核1G机器玩 &nbsp;赶紧很卡 &nbsp; 但是你拿4核4g的机器玩 我靠 怎么这么流程 这就叫配置测试<br /></font></p><p style="margin: 0px; padding: 0px; color: #454545; font-family: tahoma, helvetica, arial; background-color: #ffffff;"><strong>可靠性测试</strong></p><p style="margin: 0px; padding: 0px; color: #454545; font-family: tahoma, helvetica, arial; background-color: #ffffff;">在给系统加载一定业务压力的情况下，使系统运行一段时间，以此检测系统是否稳定。<br /></p><p style="margin: 0px; padding: 0px; color: #454545; font-family: tahoma, helvetica, arial; background-color: #ffffff;">特点：<br /></p><p style="margin: 0px; padding: 0px; color: #454545; font-family: tahoma, helvetica, arial; background-color: #ffffff;">1、这种性能测试方法的主要目的是验证是否支持长期稳定的运行。<br />2、这种性能测试方法需要在压力下持续一段时间的运行。（2~3天）<br />3、测试过程中需要关注系统的运行状况。<br /><br /><span style="color: #008000; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px;">打个比方 例如 老板说这一个月你都要每天加班到晚上10点，OK 如果你这一个月能扛下来的话，那通过测试，结果你干了2星期 身体垮了 测试失败们哈哈 是不是有点变态</span><br style="color: #008000; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px;" /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; background-color: #ffffff;"><font color="#008000"><br /></font></p><img src ="http://www.blogjava.net/qileilove/aggbug/409413.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-01-28 22:33 <a href="http://www.blogjava.net/qileilove/articles/409413.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试准备二--基础知识</title><link>http://www.blogjava.net/qileilove/articles/409290.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 23 Jan 2014 13:20:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/articles/409290.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/409290.html</wfw:comment><comments>http://www.blogjava.net/qileilove/articles/409290.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/409290.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/409290.html</trackback:ping><description><![CDATA[hi 各位看过我上一章的性能介绍了吧，这一章我们着重讲述做性能测试时我都要掌握哪些基础知识~<br />首先弄清楚你测试的对象，硬件，软件，网络，web ，还是移动app，针对不同方面我们要掌握不同知识体系<br />先从硬件来说起，摆在我们面前的一台计算机，我们要弄清楚他的配置，cpu的核数，cpu缓存的大小，架构类型，intel X86 还是 X64 &nbsp;还是AMD系列的，内存的大小，32位系统最多只支持大约3.25G的内存，这点要注意，内存速度等等 虽然我也不太懂 哈哈 &nbsp;还有硬盘 比如他的容量 转速 cache的大小 都决定了硬盘的传输速率，其实硬件很重要，尤其当我们系统需要集群或者大型服务器支持时，就知道好的设备会给系统带来不同的效率，例如刀锋服务器，又很多CPU和很大的内存组成，还有专门的存储阵列服务器，专门做数据存储，这样我们可以通过网络，绕过总线的限制，进行大数据量的交互，其实硬件方面还有很多很多的要点，有兴趣大家可以自己深入。<br />网络方面这里能说的太多了，计算机网络相信大家都学过吧，广域网，局域网，带宽，网络的类型，宽带，光纤等等。讲个常用的例子，比如我们的web服务器接入带宽100M，其实相当于每秒12.5M，也就是说上行速度和下载速度总和为12.5M 也就是吞吐量为12.5M每秒，假如我们向web服务器发送1个请求为10K那么2000个人同时发送消息就会把我们的web服务器带宽占满，无法响应，当然实际工作中我们会有各种手段去防止这种情况发生的。<br />web方面，例如各种协议，http、ftp等等 我们会在工作中接触到各种web知识，其实我也是个半吊子。用到什么学什么。<br />操作系统方面，知道各个操作系统如何查看当前cpu占用率 &nbsp;内存占用率 等等信息，这对我们性能测试很重要，查看那个进程占用资源最多等，好了今天不多说了，状态不好也只能想到这么多了~以后再补充。<img src ="http://www.blogjava.net/qileilove/aggbug/409290.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-01-23 21:20 <a href="http://www.blogjava.net/qileilove/articles/409290.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试前准备</title><link>http://www.blogjava.net/qileilove/articles/408991.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 15 Jan 2014 14:17:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/articles/408991.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/408991.html</wfw:comment><comments>http://www.blogjava.net/qileilove/articles/408991.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/408991.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/408991.html</trackback:ping><description><![CDATA[<span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;">这是一个经常被测试人员忽略的环节，在接到测压任务后，基于种种其它因素的考虑，测试人员往往急于进度，立即投入到具体的测试工作去了，测试、记录、分析，忙的不亦乐乎，工作进行了一半才发现，或是</span><span href="http://www.cnblogs.com/adaym/admin/tag.php?name=%E7%A1%AC%E4%BB%B6" style="line-height: 19px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff;">硬件</span><span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;">配置不符合要求，或是</span><span href="http://www.cnblogs.com/adaym/admin/tag.php?name=%E7%BD%91%E7%BB%9C" style="line-height: 19px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff;">网络</span><span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;">环境不理想，甚至</span><span href="http://www.cnblogs.com/adaym/admin/tag.php?name=%E8%BD%AF%E4%BB%B6" style="line-height: 19px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff;">软件</span><span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;">版本不对，一时弄得骑虎难下，这都是没有做好测试准备惹的祸。那么我们应该如何做好性能测试的准备工作呢？</span><br style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;" /><br style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;" /><span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;">　　做软件项目有</span><span href="http://www.cnblogs.com/adaym/admin/tag.php?name=%E9%9C%80%E6%B1%82" style="line-height: 19px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff;">需求</span><span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;">调查、需要分析，做测试也一样。在拿到测试任务后，首要的任务就是分析测试任务，在开始测试前，我们至少要弄清以下几个问题：</span><br style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;" /><br style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;" /><span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;">　　a) 要测试什么或测试的对象是谁？</span><br style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;" /><br style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;" /><span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;">　　b) 要测试什么问题或我们想要弄清楚或是论证的问题？</span><br style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;" /><br style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;" /><span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;">　　c) 哪些因素会影响测试结果？</span><br style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;" /><br style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;" /><span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;">　　d) 需要怎样的测试环境？</span><br style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;" /><br style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;" /><span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;">　　e) 应该怎样测试？</span><br style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;" /><br style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;" /><span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;">　　只有在认真调查测试需求和仔细分析测试任务后，才有可能弄清以上一系例的问题，只有对测试任务非常清楚，测试目标极其明确的前提下，才可能制定出切实可行的测试计划。<br /></span>调研需求 &nbsp;了解客户的标准 &nbsp;例如我们做的是一个公司内部的CRM系统 &nbsp;基本上只有销售和一些上司在用 大概使用人数在120人左右，基本的使用时间在上班时间，并且集中在早上十点左右，通过调研50人集中在10点--11点间访问crm系统了解客户信息，并且每个人期间向服务器发送请求数不超过50 这样我们就可以估算出一些有用的信息 &nbsp;比如登陆并发用户数 &nbsp;假设他们都在10点2分前登陆了 系统 &nbsp;， 那么120秒内120人 每秒1个人 &nbsp;哇哇 这还不够并发，我们再来狠点 让120个 30秒登陆 &nbsp;那么并发数就4人/秒，具体是并发数多少这就要设计到具体的业务场景了和客户需求了，客户说我要做一个购物网站，你给我分析下，好，假设网站有500万的会员，按照性能测试惯例 并发用户一般占到该功能使用人数的20%左右 &nbsp;500万很多吗 其实不多 有些会员可能只是在浏览网页 并不需要去登陆，我们网购过的人 都有经验 只有在付钱的时候才想起来登陆 假设500万会员中 一天从早上9点到晚上12点 是会员的活跃期，其中有20%r的人 会登陆购物，100万会员 在15个小时内登陆 那么平均下来每秒才18个用户 ，肯定会有人说不对 这只是估计 &nbsp;况且 大部分都是下午买东西，这就要去调研 我们只能把并发数控制在一个范围内 并且要给适当的场景，去模拟才能达到真正的效果，例如100万中 有50万人都会在下午2点--4点去购物，这时候我们的并发数4166个/秒 。 哇 怎么这么多 &nbsp;服务器会不会崩溃啊 别担心 &nbsp;大型门户网站和购物网站的架构都才要集群设计，里面有几十台甚至上百台服务器去负载这些压力 假设我们有20台Web服务器 去均分这4166个请求 下来每天服务器才208并发 对于高性能服务器 这点并发请求数 还不够撒牙缝。<br />所以我做性能测试前一定要了解被测系统的情况和客户的需求，定下一个大概范围去做。<br /><p align="left" style="font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><strong><span style="font-size: 12pt; line-height: 24px; font-family: 宋体;">一个实际的例子</span></strong><strong></strong></p><p align="left" style="text-indent: 21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><span style="font-family: 宋体;">为了便于大家的理解，我们先来看一个性能需求的例子，让大家有一个感性的认识，本文后面的讨论也会再次提到这个例子。</span></p><p align="left" style="text-indent: 21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><span style="font-family: 宋体;">这是一个证券行业系统中某个业务的&#8220;实际需求&#8221;&#8212;&#8212;实际上是我根据通过网络搜集到的数据杜撰出来的，不过看起来像是真实的</span>&nbsp;^_^</p><p align="left" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><span style="font-family: Wingdings;">l<span style="font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style="font-family: 宋体;">系统总容量达到日委托</span>6000<span style="font-family: 宋体;">万笔，成交</span>9000<span style="font-family: 宋体;">万笔</span></p><p align="left" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><span style="font-family: Wingdings;">l<span style="font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style="font-family: 宋体;">系统处理速度每秒</span>7300<span style="font-family: 宋体;">笔，峰值处理能力达到每秒</span>10000<span style="font-family: 宋体;">笔</span></p><p align="left" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><span style="font-family: Wingdings;">l<span style="font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style="font-family: 宋体;">实际股东帐号数</span>3000<span style="font-family: 宋体;">万</span></p><p align="left" style="margin: 0cm 0cm 0pt 21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;">&nbsp;</p><p align="left" style="text-indent: 21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><span style="font-family: 宋体;">这个例子中已经包括几个明确的需求：</span></p><p align="left" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><span style="font-family: Wingdings;">l<span style="font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style="font-family: 宋体;">最佳并发用户数需求：每秒</span>7300<span style="font-family: 宋体;">笔</span></p><p align="left" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><span style="font-family: Wingdings;">l<span style="font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style="font-family: 宋体;">最大并发用户数需求：峰值处理能力达到每秒</span>10000<span style="font-family: 宋体;">笔</span></p><p align="left" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><span style="font-family: Wingdings;">l<span style="font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style="font-family: 宋体;">基础数据容量：实际股东帐号数</span>3000<span style="font-family: 宋体;">万</span></p><p align="left" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><span style="font-family: Wingdings;">l<span style="font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style="font-family: 宋体;">业务数据容量：日委托</span>6000<span style="font-family: 宋体;">万笔，成交</span>9000<span style="font-family: 宋体;">万笔&#8212;&#8212;可以根据这个推算出每周、每月、每年系统容量的增长模型</span></p><p align="left" style="font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;">&nbsp;</p><div style="display: inline-block;"></div><p>&nbsp;</p><p align="left" style=" font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><strong><span style="font-size: 12pt; line-height: 24px; font-family: 宋体;">如何获得有效的性能需求</span></strong><strong></strong></p><p align="left" style="font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"></p><p align="left" style="text-indent: 21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><span style="font-family: 宋体;">上面提到了&#8220;有效的&#8221;性能需求的一个例子和三个条件，下面来我们将看到有哪些途径可以帮助我们获得相关的数据&#8212;&#8212;这些方法我在实际的工作中都用过，并且已经被证实是可行的。这几种方法由易到难排列如下：</span></p><p align="left" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><strong>1.<span style="font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></strong><strong><span style="font-family: 宋体;">客户方提出</span></strong><strong></strong></p><p align="left" style="text-indent: 21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><span style="font-family: 宋体;">这是最理想的一种方式，通常电信、金融、保险、证券以及一些其他运营商级系统的客户&#8212;&#8212;特别是国外的客户都会提出比较明确的性能需求。</span></p><p align="left" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><strong>2.<span style="font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></strong><strong><span style="font-family: 宋体;">根据历史数据来分析</span></strong><strong></strong></p><p align="left" style="text-indent: 21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><span style="font-family: 宋体;">根据客户以往的业务情况来分析客户的业务量以及每年、每月、每周、每天的峰值业务量。如果客户有旧的系统，可以根据已有系统的访问日志，数据库记录，业务报表来分析。要特别注意的是，不同行业、不同应用、不同的业务是有各自的特点的。例如，购物网站在平时的负载主要集中在晚上，但是节假日时访问量和交易量会是平时的数倍；而地铁的售票系统面临的高峰除了周末，还有周一到周五的一早一晚上下班时间。</span></p><p align="left" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><strong>3.<span style="font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></strong><strong><span style="font-family: 宋体;">参考历史项目的数据</span></strong><strong></strong></p><p align="left" style="text-indent: 21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><span style="font-family: 宋体;">如果该产品已有其他客户使用，并且规模类似的，可以参考其他客户的需求。例如在线购物网站，或者超市管理系统，各行业的进销存系统。</span></p><p align="left" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><strong>4.<span style="font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></strong><strong><span style="font-family: 宋体;">参考其他同行类似项目的数据</span></strong><strong></strong></p><p align="left" style="text-indent: 21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><span style="font-family: 宋体;">如果本企业没有做过类似的项目，那么可以参考其他同行企业的公布出来的数据&#8212;&#8212;通常在企业公布的新闻或者成功解决方案中会提到，包括系统容量，系统所能承受的负载以及系统响应能力等。</span></p><p align="left" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><strong>5.<span style="font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></strong><strong><span style="font-family: 宋体;">参考其他类似行业应用的数据</span></strong><strong></strong></p><p align="left" style="text-indent: 21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><span style="font-family: 宋体;">如果无法找打其他同行的数据，也可以参考类似的应用的需求。例如做</span>IPTV<span style="font-family: 宋体;">或者</span>DVB<span style="font-family: 宋体;">计费系统的测试，可以参考电信计费系统的需求&#8212;&#8212;虽然不能完全照搬数据，但是可以通过其他行业成熟的需求来了解需要测试的项目有哪些，应该考虑到的情况有哪些种。</span></p><p align="left" style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><strong>6.<span style="font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></strong><strong><span style="font-family: 宋体;">参考新闻或其他资料中的数据</span></strong><strong></strong></p><p align="left" style="text-indent: 21pt; font-size: 13px; line-height: 19px; font-family: 'Comic Sans MS'; background-color: #ffffff;"><span style="font-family: 宋体;">最后的一招，特别是对于一些当前比较引人关注的行业，涉及到所谓的&#8220;政绩&#8221;的行业，通常可以通过各种新闻媒体找到一些可供参考的数据，但是需要耐心的寻找。例如我们在</span>IPTV<span style="font-family: 宋体;">和</span>DVB<span style="font-family: 宋体;">系统的测试中，可以根据新闻中公布的各省、各市，以及国外各大运营商的用户发展情况和用户使用习惯来估算系统容量和系统各个模块的并发量。</span></p><span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;">二 要测试什么问题或我们想要弄清楚或是论证的问题？</span><br />对系统以及需求有了大致了解后 我们接下来我去分析问题，比如客户说了 我希望我提交订单后在10秒内能够得到响应，那么客户的需求就是从页面向系统发送请求再到系统向数据库发送查询请求到数据库返回信息系统把返回数据展现页面总共的时间是10秒内 这样具体分析后我们就可以对这个点做相应的用例去测试了，这里叙述的并不完全请见谅 例如多少个用户在线，或者多少二哥用户并发提交订单，在什么样的环境下 比如带宽 服务器的性能数量等等 都制约着整个系统的性能，这就要我们去具体的设计不同场景。在这里我们只是讨论如何分析客户给的需求。<br />三&nbsp;<span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;">　　c) 哪些因素会影响测试结果？<br /></span>就这是我刚才讨论的内容，客户的带宽，服务器的性能和数量 ，服务器的带宽，用户并发数的多少 等等 都会影响到测试结果~<br /><span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #ffffff;">四 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;需要怎样的测试环境<br />比如我们只是软件开发公司，我们的客户是财大气粗有很大好设备，但是我们小软件公司，每个人就一台烂笔记本和公司那几台破的不能再破的服务器，我们怎么做性能测试呢，怎么设计测试呢，在有限的条件下我们怎么样才能最出一个合理的评估呢<br /><br /></span><span style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;">如果是用IIS做应用服务器的话，单台可承受的最大并发数不可能达到10万级，那就必须要使用集群，通过多台机器做负载均衡来实现；</span><br style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;" /><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" style="border: 0px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;" alt="" /><span style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;">如果是用websphere之类的应用服务器的话，单台可承受的最大并发数可以达到10万级，但为性能考虑还是必须要使用集群，通过多台机器做负载均衡来实现；</span><br style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;" /><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" style="border: 0px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;" alt="" /><span style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;">那么，你只要集群的服务器足够多，10万并发数当然可以达到了。</span><br style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;" /><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" style="border: 0px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;" alt="" /><span style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;">通常有1个简单的计算方式，1个连接产生1个session，每个session在服务器上有个内存空间大小的设置，在NT上是3M，那么10万并发就需要300G内存，当然实际使用中考虑其他程序也占用内存，所以准备的内存数量要求比这个还要多一些。</span><br style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;" /><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" style="border: 0px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;" alt="" /><span style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;">还有10万个用户同时在线，跟10万个并发数是完全不同的2个概念。这个楼上已经说了。但如何做这个转换将10万个同时在线用户转换成多少个并发数呢？</span><br style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;" /><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" style="border: 0px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;" alt="" /><span style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;">这就必须要有大量的历史日志信息来支撑了。系统日志需要有同时在线用户数量的日志信息，还需要有用户操作次数的日志信息，这2个数据的比例就是你同时在线用户转换到并发数的比例。</span><br style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;" /><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" style="border: 0px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;" alt="" /><span style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;">另外根据经验统计，对于1个JAVA开发的WEB系统（别的我没统计过，给不出数据），一般1台双CPU、2G内存的服务器上可支持的最大并发数不超过500个（这个状态下大部分操作都是超时报错而且服务器很容易宕机，其实没什么实际意义），可正常使用（单步非大数据量操作等待时间不超过20秒）的最大并发数不超过300个。</span><br style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;" /><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" style="border: 0px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;" alt="" /><span style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;">假设你的10万同时在线用户转换的并发数是9000个，那么你最少需要这样的机器18台，建议不少于30台。</span><br style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;" /><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" style="border: 0px; font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;" alt="" /><span style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 12.727272033691406px; line-height: 17.27272605895996px; background-color: #eeeeee;">当然，你要是买个大型服务器，里面装有200个CPU、256G的内存，千兆光纤带宽，就算是10万个并发用户，那速度，也绝对是嗖嗖的。<br /></span>谢谢 http://www.cnblogs.com/jackei/archive/2006/11/16/561846.html 文章很精彩。<br />我总结下 假如我们只有1台服务器，假设我们的项目需要5000个并发，但是我们手头没那么牛的机器，没关系<span style="font-family: Verdana, 'Lucida Grande', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 17.265625px; background-color: #eeeeee;">1台双CPU、2G内存的服务器上可支持的最大并发数不超过500个 如果系统能满足1台机器500个并发的请求 那么正式环境下那么多集群的服务器肯定能抗的过去，这是一个数学分析问题 学过概率论的同学一定会明白其中的奥秘，我就不详说了 今天性能测试第一节课 到此为止 欢迎各位批评~~~~</span><img src ="http://www.blogjava.net/qileilove/aggbug/408991.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-01-15 22:17 <a href="http://www.blogjava.net/qileilove/articles/408991.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>