標籤:jmeter 效能測試
前提準備:先安裝jdbc驅動
驅動下載連結地址:http://pan.baidu.com/s/1bpDpjSr 密碼:v6tn
下載解壓之後,講sqljdbc4.jar放置jmeter的安裝目錄/lib下;複製之後重新啟動jmeter;
1.測試計劃—配置驅動程式
測試計劃右下角,點擊瀏覽,選擇jdbc驅動
650) this.width=650;" src="http://img.blog.csdn.net/20161012185928700?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" style="border:none;height:auto;" />
2.添加線程組
右擊測試計劃——添加——Thread——線程組
650) this.width=650;" src="http://img.blog.csdn.net/20161012185939732?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" style="border:none;" />
3.添加配置元件JDBC Connection Configuration
650) this.width=650;" src="http://img.blog.csdn.net/20161012185947895?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" style="border:none;height:auto;" />
4.配置JDBC Connection Configuration
650) this.width=650;" src="http://img.blog.csdn.net/20161012185958973?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" style="border:none;height:auto;" />
需要配置的參數有:
(1)Variable Name:test 後續JDBC Request中也會用到這個值;
(2)Database URL:jdbc:sqlserver://192.168.1.2:1222;databaseName=DBname (大家寫自己正確的就行,我為了方便隨便寫的IP:連接埠號碼);
(3)JDBC Driver class:com.microsoft.jdbc.sqlserver.SQLServerDriver (SqlServer固定寫法,每個資料庫的不一樣);
(4)Username Password資料庫的使用者名稱和密碼;
Database URL的構成參照表(jmeter的help中也有)見下:
650) this.width=650;" src="http://img.blog.csdn.net/20161012190033498?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" style="border:none;height:auto;" />
5.添加JDBC Request
650) this.width=650;" src="http://img.blog.csdn.net/20161012190152156?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" style="border:none;height:auto;" />
6.配置JDBC Request參數
650) this.width=650;" src="http://img.blog.csdn.net/20161012190046599?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" style="border:none;" />
7.添加監聽器
650) this.width=650;" src="http://img.blog.csdn.net/20161012190208985?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" style="border:none;" />
8.運行,查看結果
650) this.width=650;" src="http://img.blog.csdn.net/20161012190221079?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" style="border:none;" />
9.對查詢條件進行壓力測試
線程組中線程數和迴圈都是1;
選中JDBC Request右擊插入上級——邏輯控制器——迴圈控制器
650) this.width=650;" src="http://img.blog.csdn.net/20161012190231412?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" style="border:none;height:auto;" />
設定迴圈控制器迴圈次數
650) this.width=650;" src="http://img.blog.csdn.net/20161012190250006?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" style="border:none;height:auto;" />
可以通過監控器——彙總報告,查看結果;
本文出自 “32氪” 部落格,轉載請與作者聯絡!
Jmeter串連SqlServer資料庫進行壓力測試