jmeter线程说明_4.centos下Jmeter+InfluxDB+Grafana环境的搭建1
如果這些內容對你有幫助,也可以打開微信掃一掃,加關注:
一、前言
????本文中influxdb和Grafana下載、安裝、配置及使用見另外3篇文章:
1.Influxdb使用1
2.Influxdb使用2
3.Grafana使用
【開篇說明】:本文使用工具環境約定:influxdb-1.6.2、GrafanaV4.2.0、jmeterV5.1
??? Grafana效果展示圖:
????對應的jmeter聚合報告數據:
二、influxdb中jmeter數據庫創建
????環境部署運行正常后,這里需要配置和jmeter關聯的數據庫、表、及管理用戶。見如下全部命令:
[root@georgeComputer ~]# influx #另外開1個linux端連接數據庫Connected to http://localhost:8086 version 1.6.2InfluxDB shell version: 1.6.2> show databases #查詢庫名name: databasesname----_internal> CREATE DATABASE "jmeterTest" #創建jmeter傳送數據的庫> use jmeterTestUsing database jmeterTest> CREATE USER "admin" WITH PASSWORD '123456' WITH ALL PRIVILEGES #創建數據庫賬號和密碼三、Jmeter中后臺監聽器的配置
????這里有兩種方式:influxdb和Graphite,兩種都可以用,注意influxdb的配置文件進行對應協議的修改即可。
????1.添加【InfluxdbBackendListener】后臺監聽器
????Jmeter->測試計劃-監聽器(Listener)-后端監聽器(Backend Listener),在Backend Listener implementation中選擇->org.apache.jmeter.visualizers.backend.influxdb.InfluxdbBack...
【參數說明】:
????influxdbMetricsSender:org.apache.jmeter...influxdb...
????influxdbUrl:http://192.168.2.253:8086/write?db=jmeterTest ?#數據庫連接配置修改ip/端口/數據庫名(influxdb中創建的jmeter數據庫名)即可
????application:Jmeter壓測Demo ?? #可以看成是場景名,可用來分類篩選
????measurement:jmeter ?? ?#數據庫表名
????summaryOnly:true ?? ?#true:統計總請求;false:統計子請求,要配合samplersRegex使用
????samplersRegex:.*? ? ?#請求名匹配正則規則
????percentiles:90;95;99
????testTitle:getDemoNoParam接口測試
????eventTags:測試demo
????##用了Influxdb的http協議后,measurements會多出如下這么多對應數據表:jmeterTest、events
> select * from jmeter limit 2name: jmetertime application avg count countError endedT hit max maxAT meanAT min minAT pct90.0 pct95.0 pct99.0 rb sb startedT statut transaction---- ----------- --- ----- ---------- ------ --- --- ----- ------ --- ----- ------- ------- ------- -- -- -------- ------ -----------1595929357925000000 jmeter072801 0 0 0 0 0 internal1595929362786000000 jmeter072801 5.929999999999997 5208 0 5208 34 0 12 32 33.989999999999995 473928 0 all all??? time:時間戳
??? application:應用名、場景名,即jmeter配置中的application
??? avg:平均響應時間
??? count:請求數,也就是TPS的T
??? countError:錯誤請求數
??? endedT:Finished threads-結束線程數
??? hit:每秒點擊數
??? max:成功采樣最大響應時間
??? maxAT:Max active threads-最大活躍線程數
??? minAT:Min active threads-最小活躍線程數
??? meanAT:Mean active threads-活躍線程數
??? min:成功采樣最小響應時間
??? pct90:采樣器90%響應百分比
??? pct95:采樣器95%響應百分比
??? pct99:采樣器99%響應百分比
??? rb:接收包,單位bit 轉換到jmeter中接收KB/sec,需要運算下,如487942/8/1024=59KB/s
??? sb:發送包,單位bit 轉換到jmeter中發送KB/sec
??? startedT:Started threads-啟動線程數
??? statut:值為ok 、ko、all,用于設置了summaryOnly=false和samplersRegex,開啟了子請求數據抓取的場景,如果不抓取子請求信息,則這里無ok和ko的值
??? transaction:事務名,只要設置發送子請求方式,設置summaryOnly=false和samplersRegex的這里才有值,否則都是all
????示例1: ?samplersRegex設置為:getDemoNoParam-p.*
> select time,application,count,countError,hit,responseCode,startedT,statut,transaction from jmeter where "transaction"!= 'internal' and "transaction" != 'all' and "statut" != 'all' order by time descname: jmetertime application count countError hit responseCode startedT statut transaction---- ----------- ----- ---------- --- ------------ -------- ------ -----------1596166285577000000 jmeter07312 130 ok getDemoNoParam-pass1596166285355000000 jmeter07312 2710 ok getDemoNoParam-pass????示例2: ?samplersRegex設置為:.*
> select * from jmeter order by time desc limit 10name: jmetertime application avg count countError endedT hit max maxAT meanAT min minAT pct90.0 pct95.0 pct99.0 rb responseCode responseMessage sb startedT statut transaction---- ----------- --- ----- ---------- ------ --- --- ----- ------ --- ----- ------- ------- ------- -- ------------ --------------- -- -------- ------ -----------1596165795354000000 jmeter07312 0 7 7 7 7 internal1596165795354000000 jmeter07312 6.460000000000001 2666 26 1 16.900000000000006 24 25.989999999999995 ok getDemoNoParam-pass1596165795354000000 jmeter07312 6.460000000000001 2666 26 1 16.900000000000006 24 25.989999999999995 242606 0 all getDemoNoParam-pass1596165795354000000 jmeter07312 5.630000000000001 2663 26 1 14.900000000000006 23.94999999999999 26 242333 0 all getDemoNoParam-faile1596165795354000000 jmeter07312 5.630000000000001 2663 26 1 14.900000000000006 23.94999999999999 26 ko getDemoNoParam-faile1596165795354000000 jmeter07312 6.460000000000001 5329 2663 5329 26 1 14 23.94999999999999 25.97999999999999 484939 0 all all1596165790355000000 jmeter07312 2721 Assertion failed Test failed: text expected to contain /無參getDemo222/ getDemoNoParam-faile1596165790355000000 jmeter07312 0 7 7 7 7 internal????2.添加【GraphiteBackendListener】后臺監聽器
????Jmeter->測試計劃-監聽器(Listener)->后端監聽器(Backend Listener)->在Backend Listener implementation中選擇->org.apache.jmeter.visualizers.backend.graphite.Graphite.....
????注意:使用此協議需要在influxdb的配置文件中開啟graphite協議;和1中influxdb協議不同的是這里的數據庫名是在配置文件中設置的
????配置項說明:
????graphiteHost:influxdb中開啟了graphite協議的機器IP
????graphitePort:2003是influxdb配置文件中graphite板塊里的bind-address
????rootMeticsPrefix:設置指標前綴,查看時更方便區分,比如jmeter.all.a.avg
????summaryOnly:true/false 是否統計總量,如果是false就需要設置samplersList
????samplersList:測試Sampler名稱,支持正則表達式,全部的話使用 .*
????useRegexpForSamplerList:true/false Sampler名稱是否支持正則
????percentiles:90;95;99
????#influxdb的配置文件中的graphite板塊如下:
[[graphite]] # Determines whether the graphite endpoint is enabled.是否啟用 enabled = true #數據庫名配置 database = "jmeterTestGra" retention-policy = "" #數據庫連接ip和端口配置 bind-address = ":2003" #協議配置 protocol = "tcp" consistency-level = "one"????##用了Graphite協議后,measurements會多出如下這么多對應數據表:
????詳細參數如下:
#####響應相關指標##############jmeter.all.a.avg:ok.count和ko.count的平均值jmeter.all.a.count:ok.count+ko.countjmeter.all.a.max:ok.count和ko.count的最大響應時間jmeter.all.a.min:ok.count和ko.count的最小響應時間jmeter.all.a.pct90:采樣器90%響應百分比,成功加失敗總數的百分比jmeter.all.a.pct95:采樣器95%響應百分比,成功加失敗總數的百分比jmeter.all.a.pct99:采樣器99%響應百分比,成功加失敗總數的百分比jmeter.all.h.count:每秒點擊數jmeter.all.ko.count:失敗響應數jmeter.all.ok.avg:成功采樣平均響應時間jmeter.all.ok.count:成功響應數jmeter.all.ok.max:成功采樣最大響應時間jmeter.all.ok.min:成功采樣最小響應時間jmeter.all.ok.pct90:成功采樣90%響應時間jmeter.all.ok.pct95:成功采樣95%響應時間jmeter.all.ok.pct99:成功采樣99%響應時間jmeter.all.rb.bytes:接收的字節數jmeter.all.sb.bytes:發送的字節數######線程數及用戶相關指標#########jmeter.test.endedT:Finished threads-結束線程數jmeter.test.maxAT:Max active threads-最大活躍線程數jmeter.test.meanAT:Mean active threads-活躍線程數jmeter.test.minAT:Min active threads-最小活躍線程數jmeter.test.startedT:Started threads-啟動線程數????這些參數詳細說明可參考jmeter官網:
????https://jmeter.apache.org/usermanual/realtime-results.html
寫在最后
????經過上面幾篇文章的總結,jmeter壓測監控環境總算是倒騰出來了,但是中間也遇到了各種坑,一次次的掉進去又爬出來,收獲了不少經驗,下一篇將會總結下各種填坑經驗以及優化后Grafana中的模版、Sql。希望能幫助有需要的朋友。
#####歡迎加好友交流切磋####
QQ:464314378
微信群請先加群主微信,群主會拉各位小伙伴進群,注意添加備注。
總結
以上是生活随笔為你收集整理的jmeter线程说明_4.centos下Jmeter+InfluxDB+Grafana环境的搭建1的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 考研数学三考摆线吗_考研数学,需要从课本
- 下一篇: drcom宽带认证登录超时_开发SSO单