版权声明:本文为博主原创文章,码字不易,转载请标明出处。 https://blog.csdn.net/yue530tomtom/article/details/82710304
实时结果
从Jmeter2.13开始,可以通过提供一个实现AbstractBackendListenerClient的类,将实时结果通过Backend Listener发送到后端
- GraphiteBackendListenerClient,允许将指标发送到Graphite后端
- JMeter 3.2中引入的InfluxDBBackendListenerClient允许使用UDP或HTTP协议将指标发送到InfluxDB后端
暴露的度量标准
线程/虚拟用户度量标准
指标 | 描述 |
---|---|
<rootMetricsPrefix>test.minAT | 最小活动线程 |
<rootMetricsPrefix>test.maxAT | 最大活动线程 |
<rootMetricsPrefix>test.meanAT | 平均活动线程 |
<rootMetricsPrefix>test.startedT | 开始线程 |
<rootMetricsPrefix>test.endedT | 完成的线程 |
响应时间度量
在此的采样器都是【指定名称的采样器】
指标 | 描述 |
---|---|
<rootMetricsPrefix><samplerName>.ok.count | 称采样器响应成功的总数 |
<rootMetricsPrefix><samplerName>.h.count | 服务器每秒点击次数,此度量标准累积样本结果和子结果(如果使用事务控制器,则应取消选中”Generate parent sampler”) |
<rootMetricsPrefix><samplerName>.ok.min | 采样器成功响应的最短响应时间 |
<rootMetricsPrefix><samplerName>.ok.max | 采样器成功响应的最长响应时间 |
<rootMetricsPrefix><samplerName>.ok.avg | 采样器成功响应的平均响应时间 |
<rootMetricsPrefix><samplerName>.ok.pct<percentileValue> | 针对采样器名称的成功响应计算百分比。每个值将有一个度量标准,backend listener的默认百分位数设置为“90; 95; 99”,即3百分位数为90%,95%和99% |
<rootMetricsPrefix><samplerName>.ko.count | 采样器响应失败的总数 |
<rootMetricsPrefix><samplerName>.ko.min | 采样器响应失败的最短响应时间 |
<rootMetricsPrefix><samplerName>.ko.max | 采样器响应失败的最长响应时间 |
<rootMetricsPrefix><samplerName>.ko.avg | 采样器响应失败的平均响应时间 |
<rootMetricsPrefix><samplerName>.ko.pct<percentileValue> | 针对采样器名称的失败响应计算百分位数。每个计算值将有一个度量标准,backend listener的默认百分位数设置为“90; 95; 99”,即3百分位数为90%,95%和99% |
<rootMetricsPrefix><samplerName>.a.count | 采样器的响应数(ok.count和ko.count的总和) |
<rootMetricsPrefix><samplerName>.a.min | 采样器响应的最小响应时间(ok.count和ko.count的最小值) |
<rootMetricsPrefix><samplerName>.a.max | 采样器响应的最大响应时间(ok.count和ko.count的最大值) |
<rootMetricsPrefix><samplerName>.a.avg | 采样器响应的平均响应时间(ok.count和ko.count的平均值) |
<rootMetricsPrefix><samplerName>.a.pct<percentileValue> | 针对采样器名称的响应计算百分位数。每个计算值将有一个度量标准。(根据OK和失败样本的总数计算),backend listener的默认百分位数设置为“90; 95; 99”,即3百分位数为90%,95%和99% |
Graphite命名层次使用点(“.”)分开的元素。这可能与十进制百分比混淆。JMeter转换此类值,用下划线(”_”)替换点(”.”)。例如,”99.9”变为”99_9”
默认情况下,JMeter发送在samplerName “all” 下累积的所有采样器的度量标准。如果Backend Listener中配置了samplersList,那么JMeter还会发送匹配样本名称的度量,除非summaryOnly = true
JMeter配置
要使JMeter向后端发送指标,请使用GraphiteBackendListenerClient 添加BackendListener。
InfluxDB数据库配置
此部分在前博文中已有介绍,在此简单说明一下
两种方式
- InfluxDBBackendListenerClient的InfluxDB设置
使用InfluxDBBackendListenerClient时,不需要特定的配置 - GraphiteBackendListenerClient的InfluxDB设置
要在InfluxDB中为GraphiteBackendListenerClient启用Graphite listener,修改influxdb服务器上的配置文件/usr/local/etc/influxdb.conf,找到”[[graphite]]”并设置:
[root@test25 ~]# vim /etc/influxdb/influxdb.conf
……
[[graphite]]
enabled = true
bind-address = ":2003"
database = "jmeter"
retention-policy = ""
protocol = "tcp"
batch-size = 5000
batch-pending = 10
batch-timeout = "1s"
consistency-level = "one"
separator = "."
udp-read-buffer = 0
……