SOAPUI压力测试的参数配置.docx

上传人:b****6 文档编号:4295426 上传时间:2022-11-29 格式:DOCX 页数:10 大小:390.43KB
下载 相关 举报
SOAPUI压力测试的参数配置.docx_第1页
第1页 / 共10页
SOAPUI压力测试的参数配置.docx_第2页
第2页 / 共10页
SOAPUI压力测试的参数配置.docx_第3页
第3页 / 共10页
SOAPUI压力测试的参数配置.docx_第4页
第4页 / 共10页
SOAPUI压力测试的参数配置.docx_第5页
第5页 / 共10页
点击查看更多>>
下载资源
资源描述

SOAPUI压力测试的参数配置.docx

《SOAPUI压力测试的参数配置.docx》由会员分享,可在线阅读,更多相关《SOAPUI压力测试的参数配置.docx(10页珍藏版)》请在冰豆网上搜索。

SOAPUI压力测试的参数配置.docx

SOAPUI压力测试的参数配置

SOAPUI压力测试的参数配置

ThedifferentLoadStrategiesavailableinsoapUIandsoapUIProallowyoutosimulatevarioustypesofloadovertime,enablingyoueasilytesttheperformanceofyourtargetservicesunderanumberofconditions.SincesoapUIalsoallowsyoutorunmultipleLoadTestssimultaneously (seeanexamplefurtherdown),acombinationofLoadTestscanbeusedtofurtherassertthebehaviourofyourservices.SelectthedesiredStrategyforyourLoadTestfromtheStrategyToolbarintheLoadTestWindow:

LetshavealookatthedifferentLoadStrategiesavailableandseehowtheycanbeusedtododifferenttypesofLoad/Performancetests.

1. SimpleStrategy-Baseline,LoadandSoakTesting

TheSimpleStrategyrunsthespecifiednumberofthreadswiththespecifieddelaybetweeneachruntosimulatea"breathingspace"fortheserver.Forexampleifyouwanttorunafunctionaltestwith10threadswith10secondsdelay,setThreadsto10,delayto10000andrandomtohowmuchofthedelayyouwanttorandomize(iesettingitto0.5willresultindelaysbetween5and10seconds).WhencreatinganewLoadTestthisisthedefaultstrategyandsetatarelativelylowload(5threadswith1000msdelay).

TheSimpleStrategyisperfectforBaselinetesting.Useittoassertthethebasicperformanceofyourserviceandvalidatethattherearenothreadingorresourcelockingissues.Rampupthenumberofthreadswhenyouwantdomoreelaborateloadtestingorusethestrategyforlong-runningsoaktests.

Sinceitisn'tmeanttobringyourservicestotheirknees,asetuplikethiscanbeusedforcontinuousload-testingtoensurethatyourserviceperformsasexpectedundermoderateload;setupabaselinetestwithnorandomizationofthedelay,addLoadTestAssertionsthatactasasafetynetforunexpectedresultsandautomateitsexecutionwiththecommand-lineLoadTestrunnerormavenplugins.

2. FixedRateStrategy–Simplewithatwist

OnethingthattheSimpleStrategydoesnotdoisguaranteeanumberofexecutionswithinacertaintime,forexampleifyoumightwanttostartyourTestCase10timeseachsecondnomatterhowlongittakestoexecute.UsingtheSimpleStrategyyoucouldsetup10ThreadsandadelaycompensatingfortheaveragegapbetweentheendoftheTestCaseandthestartofthenextsecond,butthiswouldbehighlyunreliableovertime.TheFixed-Ratestrategyshouldbeusedinstead;settherateasdesired(10inourcase)andoffyougo;thestrategywillautomaticallystarttherequirednumberthreadsforthissettingattemptingtomaintaintheconfiguredvalue.

Ashintedintheheadline,therearesometwistshere:

whatifourTestCasetakesmorethanonesecondtoexecute?

TomaintaintheconfiguredTPSvalue,thestrategywillinternallystartnewthreadstocompensateforthis;afterawhileyoumighthavemanymorethan10threadsrunningduetothefactthattheoriginaloneshadnotfinishedwithinthesetrate.Andnotsurprisinglythiscouldcausethetargetservicetogetevenslower,resultinginmoreandmorethreadsbeingstartedto"keepup"withtheconfiguredTPSvalue.Asyouprobablyguessedthe"MaxThreads"settingishertopreventsoapUIfromoverloading(bothitselfandthetargetservices)  inthissituation,specifyingavalueherewillputalimitonthemaximumnumberofthreadsthesoapUIwillbeallowedtostarttomaintaintheconfiguredTPS,ifreachedtheexistingthreadswillhavetofinishbeforesoapUIwillstartanynewones.

The"RequestLevel"settingwillattempttomaintaintheTPSnotontheTestCaseexecutionlevelbutontherequestlevelinstead,forexampleifyouhaveadata-drivenLoadTestoraTestCasewithmanyrequests,youwanttheTPSsettingtoapplynotontheexecutionleveloftheentireTestCasebutontherequestlevel.

Inanycase,theFixedRatestrategyisusefulforbaseline,loadandsoak-testingifyoudon’trunintothe"ThreadCongestion"problemdescribedabove.Ontheotherhand,youmightprovokethecongestion(maybeevenincombinationwithanotherLoadTest)toseehowyourserviceshandlethisorhowtheyrecoverafterthecongestionhasbeenhandled.

3. VariableLoadStrategies

Thereareseveralstrategiesthatcanbeusedtovaryload(thenumberofthreads)overtime,eachsimulatingadifferentkindofbehavior.Theycanbeusefulforrecoveryandstresstesting,butjustaswellforbaselinetesting,eitherontheirownorincombinationwithotherstrategies.Let'shaveaquicklook:

1.Variancestrategy –thisvariesthenumberofthreadsovertimeina“sawtooth”manorasconfigured;settheIntervaltothedesiredvalue  andtheVariancetothehowmuchthenumberofthreadsshoulddecreaseandincrease.Forexampleifwestartwith20threads,setintervalto60andVarianceto0.8,thenumberofthreadswillincreasefrom20to36withinthefirst15seconds,thendecreasebackto20andcontinuedownto4threadsafter45seconds,andfinallygobackuptotheinitialvalueafter60seconds.IntheStatisticsDiagramswecanfollowthisvarianceeasily:

2.BurstStrategy -  thisstrategyisspecificallydesignedforRecoveryTestingandtakesvariancetoitsextreme;itdoesnothingfortheconfiguredBurstDelay,thenrunstheconfigurednumberofthreadsforthe“BurstDuration”  andgoesbacktosleep.Hereyoucould(andshould!

)setthenumberofthreadstoahighvalue(20+)tosimulateanonslaughtoftrafficduringashortinterval,thenmeasuretherecoveryofyoursystemwithastandardbase-lineLoadTestcontainingbasicperformance-relatedassertions.Letstrythiswithaburstdelayanddurationof10secondsfor60seconds;

Herecanseetheburstsofactivityinthediagram,pleasealsonotethattheresolutionhasbeenchangedto250ms(fromthedefault"data"value),otherwisewenothavehadanydiagramupdatesduringthe"sleeping"periodsoftheexecution(sincenodatawouldhavebeencollected).

3.The ThreadStrategy letsyoulinearly changethenumberofthreadsfromoneleveltoanotherovertherunoftheLoadTest.It’smainpurposeisasameanstoidentifyatwhichlevelcertainstatisticschangeoreventsoccur,forexampletofindatwhichThreadCountthemaximumTPSorBPScanbeachievedortofindatwhichThreadCountfunctionaltestingerrorsstartoccurring. Setthestartandendthreadvalues(forexample5to50)andsetthedurationtoarelativelylongduration(I  useatleast30secondsperthreadvalue,inthisexamplethatwouldbe1350seconds)togetaccuratemeasurements(moreonthisbelow).

4.GridStrategy –thisstrategyallowstospecificallyconfiguretherelativechangeinnumberofthreadsovertime,itsmainuseforthisismoreadvancedscenarioandrecoverytesting,whereyouneedtoseetheservicesbehaviorundervaryingloadsandloadchanges.Forexampleletssayyouwanttorunfor60secondswith10,20,10,40,10threads.ConfigureyourLoadTesttostartwith10threadsandthenenterthefollowingvaluesintheGrid:

BothvaluesarestoredrelativetothedurationandactualThreadCountoftheLoadTest;ifyouchangethese,thecorrespondingGridStrategyvalueswillberecalculated. Runningthetestshowsthefollowingoutput:

5.ScriptStrategy –thescriptstrategyistheultimatecustomizationpossibility;thescriptyouspecifyiscalledregularly (The"StrategyInterval"settingintheLoadTestOptionsdialog)andshouldreturnthedesirednumberofthreadsatthatcurrenttime.Returningavalueotherthanthecurrentonewillstartorstopthreadstoadjustforthechange.Thisallowsforanykindofvarianceofthenumberofthreads,forexamplethefollowingscriptrandomizesthenumberofthreadsbetween5and15.

Runningthiswiththestrategyintervalsetto5000thenumberofthreadswillchangeevery5seconds:

Thepossibilitieshereareendless.

4. StatisticsCalculationandThreadCountChanges

Manyofthesestrategieswillchangethenumberofthreadswhichhasanimportantimpactonthestatisticscalculationthatyouneedtobeawareof;whenthenumberofthreadschanges,thiswillusuallychangetheresponsetimesofthetargetservices,resultinginachangeinavg,tps,etc. butsincetheLoadTesthasalreadyrunatapreviousnumberofthreadstheresultsforthoserunswillskewtheresultforthenewThreadCount.

Forexampleletssayyouhavebeenrunningat5threadsandgotandaverageto500ms.UsingtheThreadStrategyyouincreasethenumberofthreadsgradually;whenrunning6threadstheaverageincreasesto600msbutsincethe“old”valuescollected  for5threadsarestillthere,thesewillintotalresultinaloweraverage.Therearetwoeasywaystoworkaroundthis;selectthe“ResetStatisticsonThreadCountchange”valueintheLoadTestOptionsdialog,ormanuallyresetthestatisticswiththecorrespondingbuttonintheLoadTesttoolbar;ineithercaseoldstatisticswillbediscarded.ToseethisinactionletsdoaThreadCountStrategytestfrom10to20threadsover300seconds(30secondsperthread),belowyoucanseeresultsbothwiththissettinguncheckedandthenchecked;

Inthelatteryouseethe“jumps”instatisticseachtimetheyareresetwhenthenumberofthreadschanges,graduallylevelingouttoanewvalue.ThefinalTPScalculatedat20threadsdiffersabout10%betweenthesetwo,showinghowthelowerresults“impact”thehigherones.

5. RunningMultipleLoadTestsSimultaneously

Ok,letshaveaquicklookatthis;we'llcreateonebaselinetestwiththesimplestrategyandalownumberofthreads,andatthesametimerunaburststrategytoseehowthebaselinetestperformance"recovers"aftertheburst;

Hereyoucanseethesimplestrategy(bottomdiagram)recoveringgradua

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 幼儿教育 > 育儿知识

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1