對web進行壓力測試時,一般百兆網絡是不夠的,當網絡帶寬不夠的時候server端沒有足夠壓力。用loadrunner所在的windows的性能管理器看一下網絡利用率就知道了。html
Loadrunner提供了方便的腳本錄製功能,但因爲錄製時可能出現的操做錯誤,vuser訪問一些不存在的資源。去除某些與壓力測試無關的東西。不然可能會出現Loadrunner測試結果有誤或壓力上不去的狀況web
在建立Loadrunner scenario時,每臺機器的vuser的runtime settings都應該分別設置並檢查,不能只對第一個vuser的runtime settings進行設置。一般你會關掉think time,以便能用較少的機器達到較大的壓力。另外,若是返回頁面裏包含了一些訪問其餘資源的連接好比圖片服務器,這時應關掉 download non-html resources。windows
當server端出錯時應用程序有可能返回錯誤信息,但對HTTP來說還是成功的響應,返回碼爲200 OK. 這樣在Loadrunner就被記爲成功的transaction。因而,server端出錯越多,Loadrunner測出的性能越好。解決辦法:開啓並檢查應用的錯誤日誌;或者啓用Loadrunner的返回內容檢查功能。bash
缺省狀況下Loadrunner會把運行結果的詳細信息放在C盤的Documment and Settings的用戶目錄下,當大壓力長時間運行或有大量出錯時,Loadrunner會生成大量的數據到該目錄下。當磁盤空間滿了後,機器的響應將變得很慢。服務器
在多個場景須要運行的時候,能夠經過批處理循環運行場景,保存結果到指定文件夾:網絡
bat內容:性能
set LR_HOME=C:\Program Files\Mercury\LoadRunner for /L %%iScenario in (1,1,10) do "%LR_HOME%\bin\Wlrun.exe" -Run -TestPath "%LR_HOME%\scenario\memory_leak_crash.lrs" -ResultName C:\LR_Result\result%%iScenario
因爲lr的http 200的經典錯誤,因此須要加入驗證點,若是加入了驗證點,就使事務響應時間大於實際的響應時間,如何解決呢,利用lr_wasted_time解決,代碼以下:測試
double time_elapsed, duration, waste; merc_timer_handle_t timer; lr_start_transaction("sampleTrans"); web_url("index.htm", "URL=http://localhost/index.htm", "TargetFrame=", "Resource=0", "RecContentType=text/html", "Referer=", "Snapshot=t1.inf", "Mode=HTML", LAST); timer = lr_start_timer(); // Do some checks the duration of which is not to be included in the transaction. web_image_check("ImgCheck1", "src=index_files/image002.jpg", LAST); web_image_check("ImgCheck2", "src=index_files/planets.gif", LAST); // How long did the tests take in seconds. time_elapsed = lr_end_timer(timer); // Convert to millisecond.s waste = time_elapsed * 1000; // Remove the time the checks took from the transaction. lr_wasted_time(waste); lr_end_transaction("sampleTrans", LR_AUTO);