📄 200603291559575.html
字号:
<html>
<head><title>性能测试</title></head>
<center><h1>性能测试</h1></center>
<div><P align=right><FONT face=Verdana><FONT color=#f70938><FONT face=黑体><a href="200604112229525.html" tppabs="http://www.itisedu.com/phrase/200604112229525.html" target="_new">中科永联</a>高级技术培训中心(</FONT><FONT face=黑体>www.itisedu.com</FONT><FONT face=黑体>)<IMG src="2006329155732887.jpg" tppabs="http://www.itisedu.com/manage/Upload/image/2006329155732887.jpg" border=0></FONT></FONT></FONT></P>
<P><FONT face=Verdana> <a href="200603291559575.html" tppabs="http://www.itisedu.com/phrase/200603291559575.html" target="_new">性能测试</a>是通过自动化的测试工具模拟多种正常、峰值以及异常负载条件来对系统的各项性能指标进行测试。负载测试和<a href="200604051546475.html" tppabs="http://www.itisedu.com/phrase/200604051546475.html" target="_new">压力测试</a>都属于性能测试,两者可以结合进行。通过负载测试,确定在各种工作负载下系统的性能,目标是测试当负载逐渐增加时,系统各项性能指标的变化情况。压力测试是通过确定一个系统的瓶颈或者不能接收的性能点,来获得系统能提供的最大服务级别的测试。 </FONT></P>
<P><FONT face=Verdana><STRONG>一、概述</STRONG></FONT></P>
<P><FONT face=Verdana> 性能测试在<a href="200604232134205.html" tppabs="http://www.itisedu.com/phrase/200604232134205.html" target="_new">软件</a>的质量保证中起着重要的作用,它包括的测试内容丰富多样。中国软件评测中心将性能测试概括为三个方面:应用在<a href="javascript:if(confirm('http://www.itisedu.com/phrase/200603082208195.html \n\nThis file was not retrieved by Teleport Pro, because it was unavailable, or its retrieval was aborted, or the project was stopped too soon. \n\nDo you want to open it from the server?'))window.location='http://www.itisedu.com/phrase/200603082208195.html'" tppabs="http://www.itisedu.com/phrase/200603082208195.html" target="_new">客户端</a>性能的测试、应用在网络上性能的测试和应用在服务器端性能的测试。通常情况下,三方面有效、合理的结合,可以达到对系统性能全面的分析和瓶颈的预测。</FONT></P>
<P><FONT face=Verdana><STRONG> ·应用在客户端性能的测试</STRONG></FONT></P>
<P><FONT face=Verdana> 应用在客户端性能测试的目的是考察客户端应用的性能,测试的入口是客户端。它主要包括并发性能测试、疲劳强度测试、大数据量测试和速度测试等,其中并发性能测试是重点。</FONT></P>
<P><FONT face=Verdana> 并发性能测试是重点</FONT></P>
<P><FONT face=Verdana> 并发性能测试的过程是一个负载测试和压力测试的过程,即逐渐增加负载,直到系统的瓶颈或者不能接收的性能点,通过综合分析交易执行指标和资源监控指标来确定系统并发性能的过程。负载测试(Load Testing)是确定在各种工作负载下系统的性能,目标是测试当负载逐渐增加时,系统组成部分的相应输出项,例如通过量、响应时间、CPU负载、内存使用等来决定系统的性能。负载测试是一个分析软件应用<a href="200604232224305.html" tppabs="http://www.itisedu.com/phrase/200604232224305.html" target="_new">程序</a>和支撑<a href="200604241328115.html" tppabs="http://www.itisedu.com/phrase/200604241328115.html" target="_new">架构</a>、模拟真实环境的使用,从而来确定能够接收的性能过程。压力测试(<a href="javascript:if(confirm('http://www.itisedu.com/phrase/200604241230245.html \n\nThis file was not retrieved by Teleport Pro, because it was unavailable, or its retrieval was aborted, or the project was stopped too soon. \n\nDo you want to open it from the server?'))window.location='http://www.itisedu.com/phrase/200604241230245.html'" tppabs="http://www.itisedu.com/phrase/200604241230245.html" target="_new">Stress Testing</a>)是通过确定一个系统的瓶颈或者不能接收的性能点,来获得系统能提供的最大服务级别的测试。</FONT></P>
<P><FONT face=Verdana> 并发性能测试的目的主要体现在三个方面:以真实的业务为依据,选择有代表性的、关键的业务操作设计测试案例,以评价系统的当前性能;当扩展应用程序的功能或者新的应用程序将要被部署时,负载测试会帮助确定系统是否还能够处理期望的用户负载,以预测系统的未来性能;通过模拟成百上千个用户,重复执行和运行测试,可以确认性能瓶颈并优化和调整应用,目的在于寻找到瓶颈问题。</FONT></P>
<P><FONT face=Verdana> 当一家企业自己组织力量或委托软件公司代为开发一套应用系统的时候,尤其是以后在生产环境中实际使用起来,用户往往会产生疑问,这套系统能不能承受大量的并发用户同时访问? 这<a href="200603090857555.html" tppabs="http://www.itisedu.com/phrase/200603090857555.html" target="_new">类</a>问题最常见于采用<a href="javascript:if(confirm('http://www.itisedu.com/phrase/200603011740155.html \n\nThis file was not retrieved by Teleport Pro, because it was unavailable, or its retrieval was aborted, or the project was stopped too soon. \n\nDo you want to open it from the server?'))window.location='http://www.itisedu.com/phrase/200603011740155.html'" tppabs="http://www.itisedu.com/phrase/200603011740155.html" target="_new">联机事务处理</a>(<a href="javascript:if(confirm('http://www.itisedu.com/phrase/200604230827105.html \n\nThis file was not retrieved by Teleport Pro, because it was unavailable, or its retrieval was aborted, or the project was stopped too soon. \n\nDo you want to open it from the server?'))window.location='http://www.itisedu.com/phrase/200604230827105.html'" tppabs="http://www.itisedu.com/phrase/200604230827105.html" target="_new">OLTP</a>)方式<a href="200602271218062.html" tppabs="http://www.itisedu.com/phrase/200602271218062.html" target="_new">数据库</a>应用、Web浏览和视频点播等系统。这种问题的解决要借助于科学的<a href="200602271215442.html" tppabs="http://www.itisedu.com/phrase/200602271215442.html" target="_new">软件测试</a>手段和先进的测试工具。</FONT></P>
<P><FONT face=Verdana> 举例说明:电信计费软件</FONT></P>
<P><FONT face=Verdana> 众所周知,每月20日左右是市话交费的高峰期,全市几千个收费网点同时启动。收费过程一般分为两步,首先要根据用户提出的电话号码来查询出其当月产生费用,然后收取现金并将此用户修改为已交费状态。一个用户看起来简单的两个步骤,但当成百上千的终端,同时执行这样的操作时,情况就大不一样了,如此众多的交易同时发生,对应用程序本身、<a href="200602281634075.html" tppabs="http://www.itisedu.com/phrase/200602281634075.html" target="_new">操作系统</a>、中心数据库服务器、<a href="200604241155005.html" tppabs="http://www.itisedu.com/phrase/200604241155005.html" target="_new">中间件</a>服务器、网络设备的承受力都是一个严峻的考验。决策者不可能在发生问题后才考虑系统的承受力, 预见软件的并发承受力, 这是在软件测试阶段就应该解决的问题。</FONT></P>
<P><FONT face=Verdana> 目前,大多数公司企业需要支持成百上千名用户,各类应用环境以及由不同供应商提供的元件组装起来的复杂产品,难以预知的用户负载和愈来愈复杂的应用程序,使公司担忧会发生投放性能差、用户遭受反应慢、系统失灵等问题。其结果就是导致公司收益的损失。</FONT></P>
<P><FONT face=Verdana> 如何模拟实际情况呢? 找若干台<a href="javascript:if(confirm('http://www.itisedu.com/phrase/200604231234155.html \n\nThis file was not retrieved by Teleport Pro, because it was unavailable, or its retrieval was aborted, or the project was stopped too soon. \n\nDo you want to open it from the server?'))window.location='http://www.itisedu.com/phrase/200604231234155.html'" tppabs="http://www.itisedu.com/phrase/200604231234155.html" target="_new">电脑</a>和同样数目的操作人员在同一时刻进行操作,然后拿秒表记录下反应时间? 这样的手工作坊式的测试方法不切实际,且无法捕捉程序内部变化情况,这样就需要压力测试工具的辅助。</FONT></P>
<P><FONT face=Verdana> 测试的基本策略是自动负载测试,通过在一台或几台PC机上模拟成百或上千的虚拟用户同时执行业务的情景,对应用程序进行测试,同时记录下每一事务处理的时间、中间件服务器峰值数据、数据库状态等。通过可重复的、真实的测试能够彻底地<a href="200604231331545.html" tppabs="http://www.itisedu.com/phrase/200604231331545.html" target="_new">度量</a>应用的可扩展性和性能,确定问题所在以及优化系统性能。预先知道了系统的承受力,就为最终用户规划整个运行环境的配置提供了有力的依据。</FONT></P>
<P><FONT face=Verdana> 并发性能测试前的准备工作</FONT></P>
<P><FONT face=Verdana> 测试环境:配置测试环境是测试实施的一个重要阶段,测试环境的适合与否会严重影响测试结果的真实性和正确性。测试环境包括硬件环境和软件环境,硬件环境指测试必需的服务器、客户端、网络连接设备以及打印机/扫描仪等辅助硬件设备所构成的环境;软件环境指被测软件运行时的操作系统、数据库及其他应用软件构成的环境。</FONT></P>
<P><FONT face=Verdana> 一个充分准备好的测试环境有三个优点:一个稳定、可重复的测试环境,能够保证测试结果的正确;保证达到测试执行的技术<a href="200603101518295.html" tppabs="http://www.itisedu.com/phrase/200603101518295.html" target="_new">需求</a>;保证得到正确的、可重复的以及易理解的测试结果。</FONT></P>
<P><FONT face=Verdana> 测试工具:并发性能测试是在客户端执行的<a href="200603101655385.html" tppabs="http://www.itisedu.com/phrase/200603101655385.html" target="_new">黑盒测试</a>,一般不采用手工方式,而是利用工具采用自动化方式进行。目前,成熟的并发性能测试工具有很多,选择的依据主要是测试需求和性能价格比。著名的并发性能测试工具有QALoad、LoadRunner、Benchmark Factory和Webstress等。这些测试工具都是自动化负载测试工具,通过可重复的、真实的测试,能够彻底地度量应用的可扩展性和性能,可以在整个开发生命周期、跨越多种平台、自动执行测试任务,可以模拟成百上千的用户并发执行关键业务而完成对应用程序的测试。</FONT></P>
<P><FONT face=Verdana> 测试数据:在初始的测试环境中需要输入一些适当的测试数据,目的是识别数据状态并且验证用于测试的测试案例,在正式的测试开始以前对测试案例进行调试,将正式测试开始时的错误降到最低。在测试进行到关键过程环节时,非常有必要进行数据状态的备份。制造初始数据意味着将合适的数据存储下来,需要的时候恢复它,初始数据提供了一个<a href="200603130850315.html" tppabs="http://www.itisedu.com/phrase/200603130850315.html" target="_new">基线</a>用来评估测试执行的结果。</FONT></P>
<P><FONT face=Verdana> 在测试正式执行时,还需要准备业务测试数据,比如测试并发查询业务,那么要求对应的数据库和表中有相当的数据量以及数据的种类应能覆盖全部业务。</FONT></P>
<P><FONT face=Verdana> 模拟真实环境测试,有些软件,特别是面向大众的商品化软件,在测试时常常需要考察在真实环境中的表现。如测试杀毒软件的扫描速度时,硬盘上布置的不同<a href="200603051002565.html" tppabs="http://www.itisedu.com/phrase/200603051002565.html" target="_new">类型</a><a href="200602282323195.html" tppabs="http://www.itisedu.com/phrase/200602282323195.html" target="_new">文件</a>的比例要尽量接近真实环境,这样测试出来的数据才有实际意义。</FONT></P>
<P><FONT face=Verdana> 并发性能测试的种类与指标</FONT></P>
<P><FONT face=Verdana> 并发性能测试的种类取决于并发性能测试工具监控的<a href="200603090845215.html" tppabs="http://www.itisedu.com/phrase/200603090845215.html" target="_new">对象</a>,以QALoad自动化负载测试工具为例。软件针对各种测试目标提供了<a href="javascript:if(confirm('http://www.itisedu.com/phrase/200604022243315.html \n\nThis file was not retrieved by Teleport Pro, because it was unavailable, or its retrieval was aborted, or the project was stopped too soon. \n\nDo you want to open it from the server?'))window.location='http://www.itisedu.com/phrase/200604022243315.html'" tppabs="http://www.itisedu.com/phrase/200604022243315.html" target="_new">DB2</a>、<a href="javascript:if(confirm('http://www.itisedu.com/phrase/200604152041495.html \n\nThis file was not retrieved by Teleport Pro, because it was unavailable, or its retrieval was aborted, or the project was stopped too soon. \n\nDo you want to open it from the server?'))window.location='http://www.itisedu.com/phrase/200604152041495.html'" tppabs="http://www.itisedu.com/phrase/200604152041495.html" target="_new">DCOM</a>、<a href="javascript:if(confirm('http://www.itisedu.com/phrase/200604151956245.html \n\nThis file was not retrieved by Teleport Pro, because it was unavailable, or its retrieval was aborted, or the project was stopped too soon. \n\nDo you want to open it from the server?'))window.location='http://www.itisedu.com/phrase/200604151956245.html'" tppabs="http://www.itisedu.com/phrase/200604151956245.html" target="_new">ODBC</a>、<a href="200604040935115.html" tppabs="http://www.itisedu.com/phrase/200604040935115.html" target="_new">ORACLE</a>、NETLoad、<a href="javascript:if(confirm('http://www.itisedu.com/phrase/200604031336425.html \n\nThis file was not retrieved by Teleport Pro, because it was unavailable, or its retrieval was aborted, or the project was stopped too soon. \n\nDo you want to open it from the server?'))window.location='http://www.itisedu.com/phrase/200604031336425.html'" tppabs="http://www.itisedu.com/phrase/200604031336425.html" target="_new">Corba</a>、QARun、<a href="javascript:if(confirm('http://www.itisedu.com/phrase/200604080959005.html \n\nThis file was not retrieved by Teleport Pro, because it was unavailable, or its retrieval was aborted, or the project was stopped too soon. \n\nDo you want to open it from the server?'))window.location='http://www.itisedu.com/phrase/200604080959005.html'" tppabs="http://www.itisedu.com/phrase/200604080959005.html" target="_new">SAP</a>、SQLServer、<a href="200604040934365.html" tppabs="http://www.itisedu.com/phrase/200604040934365.html" target="_new">Sybase</a>、Telnet、TUXEDO、UNIFACE、WinSock、WWW、Java Script等不同的监控对象,支持Windows和UNIX测试环境。</FONT></P>
<P><FONT face=Verdana> 最关键的仍然是测试过程中对监控对象的灵活应用,例如目前三层结构的运行<a href="200603061709535.html" tppabs="http://www.itisedu.com/phrase/200603061709535.html" target="_new">模式</a>广泛使用,对中间件的并发性能测试作为问题被提到议事日程上来,许多系统都采用了国产中间件,选择Java Script监控对象,手工编写脚本,可以达到测试目的。</FONT></P>
<P><FONT face=Verdana> 采用自动化负载测试工具执行的并发性能测试,基本遵循的测试过程有:测试需求与测试内容,测试案例制定,测试环境准备,测试脚本录制、编写与调试,脚本分配、回放配置与加载策略,测试执行跟踪,结果分析与定位问题所在,测试报告与测试评估。</FONT></P>
<P><FONT face=Verdana> 并发性能测试监控的对象不同,测试的主要指标也不相同,主要的测试指标包括交易处理性能指标和UNIX资源监控。其中,交易处理性能指标包括交易结果、每分钟交易数、交易响应时间(Min:最小服务器响应时间;Mean:平均服务器响应时间;Max:最大服务器响应时间;StdDev:事务处理服务器响应的偏差,值越大,偏差越大;Median:中值响应时间;90%:90%事务处理的服务器响应时间)、虚拟并发用户数。</FONT></P>
<P><FONT face=Verdana> 应用实例:“新华社多媒体数据库 V1.0”性能测试</FONT></P>
<P><FONT face=Verdana> 中国软件评测中心(CSTC)根据新华社技术局提出的《多媒体数据库(一期)性能测试需求》和GB/T 17544《<a href="200602281756135.html" tppabs="http://www.itisedu.com/phrase/200602281756135.html" target="_new">软件包</a>质量要求和测试》的国家标准,使用工业标准级负载测试工具对新华社使用的“新华社多媒体数据库 V1.0”进行了性能测试。</FONT></P>
<P><FONT face=Verdana> 性能测试的目的是模拟多用户并发访问新华社多媒体数据库,执行关键检索业务,分析系统性能。</FONT></P>
<P><FONT face=Verdana> 性能测试的重点是针对系统并发压力负载较大的主要检索业务,进行并发测试和疲劳测试,系统采用<a href="javascript:if(confirm('http://www.itisedu.com/phrase/200604291152445.html \n\nThis file was not retrieved by Teleport Pro, because it was unavailable, or its retrieval was aborted, or the project was stopped too soon. \n\nDo you want to open it from the server?'))window.location='http://www.itisedu.com/phrase/200604291152445.html'" tppabs="http://www.itisedu.com/phrase/200604291152445.html" target="_new">B/S</a>运行模式。并发测试设计了特定时间段内分别在中文库、英文库、图片库中进行单检索词、多检索词以及变检索式、混合检索业务等并发测试案例。疲劳测试案例为在中文库中并发用户数200,进行测试周期约8小时的单检索词检索。在进行并发和疲劳测试的同时,监测的测试指标包括交易处理性能以及UNIX(Linux)、Oracle、Apache资源等。</FONT></P>
<P><FONT face=Verdana> 测试结论:在新华社机房测试环境和内网测试环境中,100M带宽情况下,针对规定的各并发测试案例,系统能够承受并发用户数为200的负载压力,最大交易数/分钟达到78.73,运行基本稳定,但随着负载压力增大,系统性能有所衰减。</FONT></P>
<P><FONT face=Verdana> 系统能够承受200并发用户数持续周期约8小时的疲劳压力,基本能够稳定运行。</FONT></P>
<P><FONT face=Verdana> 通过对系统UNIX(Linux)、Oracle和Apache资源的监控,系统资源能够满足上述并发和疲劳性能需求,且系统硬件资源尚有较大利用余地。</FONT></P>
<P><FONT face=Verdana> 当并发用户数超过200时,监控到HTTP 500、connect和超时错误,且Web服务器报内存溢出错误,系统应进一步提高性能,以支持更大并发用户数。</FONT></P>
<P><FONT face=Verdana> 建议进一步优化<a href="200602281706245.html" tppabs="http://www.itisedu.com/phrase/200602281706245.html" target="_new">软件系统</a>,充分利用硬件资源,缩短交易响应时间。</FONT></P>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -