Loadrunner介紹和結果分析_第1頁
Loadrunner介紹和結果分析_第2頁
Loadrunner介紹和結果分析_第3頁
Loadrunner介紹和結果分析_第4頁
Loadrunner介紹和結果分析_第5頁
已閱讀5頁,還剩117頁未讀, 繼續免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、Load runner介紹和結果分析大綱Load runner介紹規劃編寫腳本 腳本錄制、調試、優化場景設計 用戶數、場景類型、場景計劃、運行設置、實時監控場景執行 調試場景、小壓力運行、100%負載測試、壓力測試結果分析 常用指標觀察、生成測試報告第一節LoadRunner 介紹為什么要進行壓力測試The failure of a mission-critical application can be costlyAssure performance and functionality under real-world conditionsLocate potential problems

2、before your customers doReduce development timeReduce infrastructure costs壓力測試分類Find out whether the system can handle the expected load upon deployment under real-world conditions. Find the applications breaking point. Apply testing that measures whether the applications environment is properly con

3、figured to handle expected or potentially unexpected high transaction volumes.Load TestingStress TestingFind the stability of the system with respect to handling large amounts of data over extended time periods. Volume TestingFind the behavior and performance of each tier. Component Testing壓力測試目標舉例A

4、pplication response timeHow long does it take to complete atask? Configuration sizingWhich configuration provides thebest performance level? AcceptanceIs the system stable enough to gointo production? RegressionDoes the new version of the softwareadversely affect response time? ReliabilityHow stable

5、 is the system under aheavy work load? Capacity planningAt what point does degradation inperformance occur? Bottleneck identificationWhat is the cause of degradation inperformance? Product evaluationWhat is the best server for 100users?TestersLoad GenerationSystem Under TestDo you have the testing r

6、esources? Testing personnel Client machinesHow do you synchronize users?How do you collect and analyze results?How do you achieve test repeatability?Everybody, click the SEARCH button again手工測試的問題CoordinatorDatabase serverApplication serverLoadRunner解決方案Overcomes resource limitationsProvides meaning

7、ful results with analysis toolsAllows repeatable tests with scripted actionsAnalysisRuns many Vusers on few machinesReplaces testers with Virtual UsersController manages Virtual UsersDatabase serverControllerVusersVirtual User load generatorApplication serverLoad GenerationSystem Under TestLoadRunne

8、r的實現方法LoadRunner is a complete solution to conduct automated load testing before, during, and after application deployment.LoadRunner allows you to.ScaleIdentifyDiagnosethe application to a predetermined capacity.business processes or system components having trouble.a problem to pinpoint the root c

9、ause.LRVUGENVuser Script Recorder records Vuser scripts that simulate the steps of real users using the application.LR CONTROLLERThe Controller is an administrative center for creating, maintaining and executing Scenarios. The Controller assigns Vusers and load generators to Scenarios, starts and st

10、ops load tests and performs other administrative tasks.LRANALYSIS LR Analysis provides graphs and reports. These graphs and reports summarize the system performance.LoadRunner 組件LoadRunner 支持的環境 Web:HTTP(S)CORBAWAPCOMRMILDAPWinsockStreamingFTPIIOPPOP3iModeRealPlayerMS MediaVoice XMLSMTPDatabases:Ora

11、cleMS SQLServerDB2 SybaseInformixODBCMiddlewareProtocols:CORBACOMEJBsTUXEDOJoltJDBCMQSeriesPlatforms:NT, 2000, XPSunHPIBMLinuxERP/CRM:Oracle Apps.SAPSiebelPeopleSoftClarifyBaanLegacy:32705250VT100Internet/IntranetDatabaseserverAppserversWebserversClients什么是 Scenario?scriptsrun-time settingsload gene

12、ratorsreal-time monitorsvirtual usersElements of a ScenarioScenarioA scenario is a defines which Vusers to execute, the number of Vusers to run, the goals of the test, which computer hosts the Vusers and the conditions under which to run the load test.LoadRunner的工作方式DatabaseserverAppserversWebserver

13、sLR CONTROLLER LOAD GENERATOR 2 (NY)LRANALYSIS LOAD GENERATOR 1 (SF)Create scenarios and assign them to load generators.Generates load and sends performance data to controller. Access the reports and graphs.Generates load and sends performance data to controller.Performance metrics硬件配置需求Win NTWin 20

14、00 Win XP500 MBWin NTWin 2000 Win XP UNIXDepends on the number of Vusers and runtime settings.Win NTWin 2000 Win XP200 MB Operating SystemFree Hard Disk Space256 MB256 MB256 MBMemoryAnalysisLoad GeneratorControllerLR Components壓力測試流程Define GoalsAnalyze systemGather System Usage DataRecord Scripts an

15、d turn scripts into Vusers by adding test data and user behavior Create Scenarios based on your goalsExecute Scenarios for testing first, running 100% and overloadingAnalyze results data and pinpoint bottlenecksFine tune system based on analysis data and re-run the scenarioTweakSystem Basedon Analys

16、isPlan Load Test1Create Virtual Users2Scenario Creation3Scenario Execution4Results Analysis5Rerunning the scenario indicates whether performance has improved and whether goals have been achieved. 壓力測試是一項團隊工作Manages the test application implementation for all phases of load testingProvides expertise

17、on the businessfunctionality of the application under test for planning phaseTeam MemberMain ResponsibilityProject ManagerFunctional ExpertCreates the multi-user load on the system for all phases of load testingLoadRunner ExpertAnalyzes and tunes the application server for results analysis phase App

18、lication Server Performance Basis ExpertAnalyzes and tunes the database server for results analysis phaseDatabase Performance Basis ExpertLoadRunner 團隊工作TweakSystem Basedon AnalysisPlan Load Test1Create Virtual Users2Scenario Creation3Scenario Execution4Results Analysis5LR ExpertFunctional ExpertPro

19、ject ManagerLR ExpertFunctional ExpertProject ManagerLR ExpertLR ExpertSys AdminServer Expert(s)Sys AdminServer Expert(s)LR Expert返回大綱第二節 規劃在創建腳本之前要進行充分的規劃Plan Load Test1Create Virtual Users2Scenario Creation3Scenario Execution4Results Analysis5Goals, business processes, user type, user behaviors, i

20、nput data, system profiling,scenario design, and LoadRunner installation規劃階段的內容 建立負載測試的目標 制定出可以用數量衡量的目標標準 分析被測系統的業務運行狀況確定要錄制哪些商業流程(business processes)確定業務高峰的負載情況和時間把需要測試的BP的操作步驟形成正式文檔準備測試數據 收集系統的技術信息 確定系統的架構 確定系統各部件的軟件情況,使用什么樣的數據庫服務器?Web服務器? 以幫助我們在合理的時間內確定系統瓶頸本次培訓使用的Demo軟件Start Programs Mercury Tour

21、sBefore you access thetraining application:Invoke the ApacheServer (Start Programs StartServer)返回大綱第三節編寫腳本錄制Web腳本的方法1. 運行VuGen,創建新的腳本4. 開始錄制5. 進行正常的業務流程的操作6. 當業務操作完畢后,按Stop Recording將錄制結束7. 保存腳本2. 選擇創建Web(HTTP/HTML) protocol的腳本3. 設定錄制選項 Recording Options.DEMO 老師將會演示如何錄制腳本設定錄制選項 Recording Options Rec

22、ording Browser Recording Proxy Advanced CorrelationDEMO Recording Options 兩種不同查看腳本的方式Tree ViewScript ViewTree view has icons for the recorded user stepsEach Tree View icon represents a C statement viewable in Script View DEMO Tree and Script View Icon and usage examples什么時候選擇不同的錄制方式?This is default

23、mode.If problem encountered with form submission or with link clicking then record with URL option checked under HTML Advanced HTML Recording:URL Recording:Records a separate request for each object requested from the server. Gives best control over traffic.腳本的目錄結構C:web_project-Scripts-Action1.cvuse

24、r_init.cvuser_end.cLab1Script2.usrAs soon as the script is saved, these are the folders that you will seeLab1Script2設置回放的運行時刻設置Run-time SettingsRun LogicPacingLogThink TimeMiscellaneousSpeed SimulationBrowser EmulationProxyPreferencesContentCheckAvailable for all protocols.Specific to Web.DEMO Run-t

25、ime Settings 運行腳本Click the Run button to play back the script.The Execution log lists all messages once the script has stopped running. DEMO Running a script and how to set results directory 常用的調試腳本的工具Test Results windowExecution LogSnapshot Results window Page View Server Response Client RequestRun

26、-Time ViewerDEMO Available debugging tool options本節總結本節介紹了常用的錄制選項本節介紹了兩種錄制Web協議腳本的方法本節介紹了運行時刻的各種設定本節介紹了一般選項的設定本節介紹了進行調試腳本的基本工具ActionA set of recorded user actions in a Vuser that allows you to emulate a particular user task through script iteration.什么是Action?在Web腳本里面使用多個ActionA Web Vuser (script):Se

27、arch for a CDOrder the CDLog inGo to checkoutvuser_initRun onceActionRun 3 timesvuser_endRun onceSearch for a DVDOrder the DVDAction1Run 5 timesSearch for a book Order the book Action2Run 4 timesthenthenthenthen使用多個 Action的典型例子最典型的情況是用戶登錄一次,進行多次業務,然后退出系統:Record Login user steps in vuser_initRecord s

28、electing an item in the first section called ActionRecord placing items in shopping cart user steps in Action1Record Checkout and Logout user steps in vuser_endInternetWebserverDBserver如何把不同的操作錄制到多個 Actions中?Action list1. Start recording2. Select action file3. Record users steps in the appropriate a

29、ction file4. Repeat steps 2 and 3 as necessary5. Stop recordingDEMO Adding creating LR Actions 注意設定好開始和結束的狀態Always end at this page if the next iteration is Sign-On or Register.根據測試目標來確定腳本的Action Emulate three types of users where 50% of the users are logging in, 25% are searching and the remaining

30、25% are booking tickets?Load Testing Goal: Record one script with all three business processes under separate actions and apply weighting.Suggested method:DEMO Creating Weighting如何衡量操作的響應時間?How can I isolatea measurement ofjust the Sign-inresponse time?STEP 1 Start ApplicationSTEP 2 Type username an

31、d passwordSTEP 3 Click on Sign-In buttonSTEP 4 Wait for confirmationSTEP 5 Select a departure and arrival citiesSTEP 6 Enter datesSTEP 7 Enter credit card detailsSTEP 8 Click on Submit 什么是Transaction? LoadRunner TransactionGives an end-to-end measurement of time elapsed in the execution of one or mo

32、re steps in a business process.UserWeb ServerRequest(Transaction starts)Response(Transaction ends)Sign-In transaction took 8 secLoadRunner的Transactions測量什么內容?LoadRunner transactions measure the transmission and response time between client and server.Transaction開始和結束按鈕Common icons and usage examples

33、Start Transaction Set starting point for measurementEnd TransactionSet end point for measurementTransaction的狀態LR_AUTO (default) - use this to detect the transaction status automaticallyLR_PASS / LR_FAIL / LR_STOP use these when you want to set the transaction status manually in the codeTransactions中

34、的思考時間如何處理?Think timesMay reduce accuracy of transaction measurementsCan be filtered out of Analysis graphs通過檢查運行日志來確定Transaction的執行結果Transactions的相關設定參數化的概念 Recorded ScriptSelect San FranciscoParameterized ScriptSelect Selection is hard coded and will select San Francisco on every runSelection is pa

35、rameterized and will select different city on every run為什么要引入“參數化”? REAL USERSVaried input to the applicationStatic input to the applicationRecorded script (Virtual Users)To Emulate real-world behavior and to create realistic results什么時候需要參數化?STEP 1 Start ApplicationSTEP 2Type username and passwordS

36、TEP 3 Click on Sign-In buttonSTEP 4Wait for confirmationSTEP 5Select a departure and arrival citiesSTEP 6 Enter datesSTEP 7Enter credit card detailsSTEP 8Click on Submit Unique constraintData dependencyData cachingDate constraint如何參數化輸入數據 1 Determine which fields to parameterize.2 Replace recorded v

37、alues with parameters.3 Decide which parameter type to use.4 Create the data file.5 Populate the data file.6 Choose the data access method and the number ofiterations.7 Run the Vuser and analyze the results to verify correct execution.DEMO How to parameterize a input data 參數的類型 Internal DataData Fil

38、esMaster DataUser Generated Data External DataUser-Defined Functions Specifying the source for the parameter data. There are three types:File類型參數的數據訪問方式SequentialRandomUniqueSame line as Select next tells LoadRunner in what order to use data from the file (data source) 如何查看腳本執行時參數的值?To see parameter

39、 data in the Execution Log, select Extendedlog and Parameter substitution in the Run-time Settings數據個數和Run Logic的關系To test all data using the Sequential access method, Number of Iterations should equal the number of rows in the data file 什么是檢查點 Checkpoint? CheckpointA checkpoint is a step in a Vuser

40、 script which verifies whether a visual cue appeared as expected.Verification always results in a PASS or FAIL status在大并發用戶壓力的情況下驗證腳本是否執行成功是負載測試的基本要求Success. Business process complete.Failure. Business process failed.One Vuser running the scriptScript run under load with many concurrent VusersIncrea

41、se in load Low load What indicates the ticket was purchased successfully?確定腳本執行成功的標準 LoginSelect departure and arrival citiesSelect departure and arrival datesSelect flightPurchase ticketContinue ShoppingThere was an error while generating your order! Your itinerary was booked! Thank you for choosin

42、g Mercury Tours.通過界面的某些信息來確定腳本是否執行成功Flight confirmation image and text appear after pressing the Secure Purchase button. Image ConfirmationText Confirmation(2) On playback, compare the actual value on the application to the saved expected value.(3) Send the comparison result (the status) as either P

43、ASS Test requirement # 5 successful.OR FAIL Test requirement # 5 failed.(1) Capture the information needed to perform verification.檢查點的基本內容 ExpectedValueActualValuePASS=IFLoadRunner提供的文本檢查點Checkpoint IconsTextVuGen allows you to add Checkpoints for verification automatically and also programmaticall

44、y. A text check is a search for a specified text string on a Web page.Adds web_reg_find function to the script.關聯的基本概念介紹 RecordingWeb ServerLogin (User Name jojo Password bean)Response(SessionID12345 )1.Log in User Name jojo Password bean2.Your sessionid123453.Request for product info4.Product info

45、foundResponseProduct infoVuGen ScriptRequest for product info (SessionID12345 )Dynamic data is hard-coded in the script關聯的基本概念介紹 - Playing BackWeb ServerLogin (User Name jojo Password bean)Response(SessionID23456 )1.Login User Name jojo Password bean2.Your sessionid123453.Request for product info4.P

46、roduct info foundResponseERROR SessionID 12345 has expiredLogin again to get product infoVuGen ScriptRequest for product info (SessionID12345 )Reusing recorded dynamic data will cause errors when you replay the script關聯的基本概念介紹 - SolutionWeb ServerLogin (User Name jojo Password bean)Response(SessionI

47、D23456 )Request for product info ()ResponseHere is the requested product info1. 2.Your 3. 4. Correlated VuGen ScriptRecorded dynamic data must be correlated using parameters關聯是一個原理性的問題2 1 3關聯是一個原理性的問題,在任何協議的腳本中都存在關聯是開發腳本的最耗時,最煩瑣的一個過程. 因為每個被測系統都不同 為了減輕關聯的工作量,LoadRunner提供了一些自動化關聯的輔助工具手工關聯的基本步驟Play bac

48、k the script and determine if error is due to correlation.Determine which dynamic values to correlate.Find the left boundary, right boundary and occurrence of the dynamic value. Add a web_reg_save_param function and the arguments to the script, above the step which requests the page with the value t

49、o capture.Parameterize the dynamic value in the script every time it occurs.Verify correct execution.關聯的第一步:腳本回放失敗Q: Why did the step creation fail? 1. Make a note of which step failed. 2. Investigate the Execution Log.通過WDiff查看腳本變化的內容 There are five differences highlighted.確定哪些動態信息需要關聯Name=buyFligh

50、ts.x, Value=52, ENDITEM, Name=buyFlights.x, Value=23, ENDITEM,Name=buyFlights.y, Value=15, ENDITEM, Name=buyFlights.y, Value=17, ENDITEM,lr_think_time( 2 );lr_think_time( 1 );lr_think_time( 7 );lr_think_time( 11 );Name=flight_210, Value=on, ENDITEM,Name=flight_206, Value=on, ENDITEM,Name=removeSelec

51、ted.x, Value=101, ENDITEM, Name=removeSelected.x, Value=80, ENDITEM,Name=removeSelected.y, Value=13, ENDITEM,Name=removeSelected.y, Value=10, ENDITEM,lr_think_time( 1 );12345These values represent the screen locations of mouse clicksThey are used by the script but do not need to be correlatedThink t

52、imes are used by the script but do not need to be correlatedFlight number is dynamic and requires correlation關聯函數: web_reg_save_param(param_name, *, LAST);User-defined parameter nameIndicates no more attributes Optional indicates ordinal or instance or the match The left & right boundary of the para

53、meter or the dynamic data LB=, RB=, ORD=, *See the LoadRunner documentation for a complete list of attributesweb_reg_save_param has the following arguments:在Server Response確定動態信息的左右邊界LEFT BOUNDARYRIGHT BOUNDARYLB: type=checkbox name=RB: 6腳本錄制完成后自動關聯的方法需要將腳本回放一次LoadRunner會自動比較回放時的結果和錄制時的結果,確定需要關聯的內容回

54、放完成后可以使用LoadRunner內置的Scan for Correlations工具進行自動關聯腳本錄制時自動關聯的步驟Enable Correlation during recording in Recording OptionsCreate new applicationCreate new rule for the newly created application and define properties for the new ruleTest the newly created rule (optional)Record the scriptPlay back the scr

55、ipt to verify correct execution DEMO Correlation During Recording 返回大綱調用動態庫dll在Windows操作系統中使用DLL有很多優點,最主要的一點是多個應用程序、甚至是不同語言編寫的應用程序可以共享一個DLL文件,真正實現了資源“共享”,大大縮小了應用程序的執行代碼,更加有效的利用了內存;使用DLL的另一個優點是DLL文件作為一個單獨的程序模塊,封裝性、獨立性好,在軟件需要升級的時候,開發人員只需要修改相應的DLL文件就可以了,而且,當DLL中的函數改變后,只要不是參數的改變,程序代碼并不需要重新編譯。這在編程時十分有用,大

56、大提高了軟件開發和維護的效率。 在LR下也可以直接調用動態鏈接庫文件,針對一些使用LR腳本編寫比較煩瑣的方法可以考慮此方法(比如各種加解密算法的實現,數據庫的操作等),并能夠使測試腳本簡單明了。鑒于此,本人初次嘗試了如何制作DLL文件并在LR中使用。調用動態庫dllint Min(int a, int b, int c) int Res; Res = (ab? b:a)c? c:(ab? b:a); return Res;該動態鏈接庫編譯成功后,打開dllfortest工程目錄下的debug目錄下,可以看到生成了一個文件,這就是我們想要的文件。調用動態庫dll2、dll文件在LR中的調用 打開

57、LR VU Generator,選擇C Vuser協議(或其他支持C的協議),進入編輯界面。Action部分如下所示:Action() lr_load_dll(dllfortest.dll); lr_message(Max Result is %d,Max(100,200,67); lr_message(Min Result is %d,Min(55,97,63); return 0;將文件復制到腳本所在的目錄(如果不復制的話,lr_load_dll的參數應該寫成dll文件的絕對路徑),如果編譯沒有報錯的話,就可以直接運行了。 第四節Scenario 設計Understanding Scena

58、riosScheduling ScenariosRuntime SettingsPerformance Monitors目標TweakSystem Basedon AnalysisPlan Load Test1Create Virtual Users2Scenario Creation3Scenario Execution4Results Analysis5什么是 Scenario?scriptsrun-time settingsload generatorsreal-time monitorsvirtual usersElements of a ScenarioScenarioA scena

59、rio is a defines which Vusers to execute, the number of Vusers to run, the goals of the test, which computer hosts the Vusers and the conditions under which to run the load test.LoadRunner ControllerBefore scenario executionused to design scenarioused to initiate scenario runDuring scenario executio

60、nruns many Vusers simultaneouslycontrols each Vuser (initialize, run, pause, stop)displays execution status of each Vuserdisplays messages from each Vusermonitors system and network resourcesAfter scenario executioncollects and organizes performance data launches the Analysis toolsController organiz

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論