Jmeter 监听器

 

标签(空格分隔): Jmeter


监听器用来监听Jmeter取样器的测试结果,能够以树、表及图形的形式来显示测试结果。除了监听测试结果之外,大部分监听器还提供查看,保存和读取已保存测试结果的方法。

监听器默认配置

初始化配置文件设置 jmeter初始化文件配置位置/jmeter/bin/jmeter.properties,打开文件搜索Result,可以看到如下内容,这些都是结果记录相关的配置,#标注的配置被忽略。在此设置的选项会在GUI模式下起作用,(Summary Report)中已经勾选的选项。

#---------------------------------------------------------------------------
# Results file configuration
#---------------------------------------------------------------------------

# This section helps determine how result data will be saved.
# The commented out values are the defaults. # legitimate values: xml, csv, db. Only xml and csv are currently supported. #jmeter.save.saveservice.output_format=csv # The below properties are true when field should be saved; false otherwise # # assertion_results_failure_message only affects CSV output #jmeter.save.saveservice.assertion_results_failure_message=true # # legitimate values: none, first, all #jmeter.save.saveservice.assertion_results=none # #jmeter.save.saveservice.data_type=true #jmeter.save.saveservice.label=true #jmeter.save.saveservice.response_code=true # response_data is not currently supported for CSV output #jmeter.save.saveservice.response_data=false # Save ResponseData for failed samples #jmeter.save.saveservice.response_data.on_error=false #jmeter.save.saveservice.response_message=true #jmeter.save.saveservice.successful=true #jmeter.save.saveservice.thread_name=true #jmeter.save.saveservice.time=true #jmeter.save.saveservice.subresults=true #jmeter.save.saveservice.assertions=true #jmeter.save.saveservice.latency=true # Only available with HttpClient4 #jmeter.save.saveservice.connect_time=true #jmeter.save.saveservice.samplerData=false #jmeter.save.saveservice.responseHeaders=false #jmeter.save.saveservice.requestHeaders=false #jmeter.save.saveservice.encoding=false #jmeter.save.saveservice.bytes=true # Only available with HttpClient4 #jmeter.save.saveservice.sent_bytes=true #jmeter.save.saveservice.url=true #jmeter.save.saveservice.filename=false #jmeter.save.saveservice.hostname=false #jmeter.save.saveservice.thread_counts=true #jmeter.save.saveservice.sample_count=false #jmeter.save.saveservice.idle_time=true # Timestamp format - this only affects CSV output files # legitimate values: none, ms, or a format suitable for SimpleDateFormat #jmeter.save.saveservice.timestamp_format=ms #jmeter.save.saveservice.timestamp_format=yyyy/MM/dd HH:mm:ss.SSS # For use with Comma-separated value (CSV) files or other formats # where the fields' values are separated by specified delimiters. # Default: #jmeter.save.saveservice.default_delimiter=, # For TAB, one can use: #jmeter.save.saveservice.default_delimiter=\t # Only applies to CSV format files: # Print field names as first line in CSV #jmeter.save.saveservice.print_field_names=true # Optional list of JMeter variable names whose values are to be saved in the result data files. # Use commas to separate the names. For example: #sample_variables=SESSION_ID,REFERENCE # N.B. The current implementation saves the values in XML as attributes, # so the names must be valid XML names. # By default JMeter sends the variable to all servers # to ensure that the correct data is available at the client. # Optional xml processing instruction for line 2 of the file: # Example: #jmeter.save.saveservice.xml_pi= # Default value: #jmeter.save.saveservice.xml_pi= # Prefix used to identify filenames that are relative to the current base #jmeter.save.saveservice.base_prefix=~/ # AutoFlush on each line written in XML or CSV output # Setting this to true will result in less test results data loss in case of Crash # but with impact on performances, particularly for intensive tests (low or no pauses) # Since JMeter 2.10, this is false by default #jmeter.save.saveservice.autoflush=false 

GUI模式设置

Jmeter 监听器_第1张图片

##后端监听器

后端侦听器是一个异步侦听器,可以将数据推入都数据库中,提供了InfluxDB,graphite选项

  • 界面介绍 Jmeter 监听器_第2张图片

  • Backend Listener implementation:BackendListenerClient类的实现,Jmeter默认提供如下两种实现,因为我们使用的influxdb作为持久存储

    • org.apache.jmeter.visualizers.backend.graphite.GraphiteBackendListenerClient
    • org.apache.jmeter.visualizers.backend.graphite.InfluxdbBackendListenerClient 因为我们使用的influxdb作为持久存储,所以后续只介绍InfluxdbBackendListenerClient
  • Async Queue size:异步队列大小 队列值包含异步处理时的度量标准。除非有一些特定的性能问题,否则最好不要从默认的5000

我们使用InfluxdbBackendListenerClient

  • influxdbMetricsSender:org.apache.jmeter.visualizers.backend.influxdb.HttpMetricsSender
  • influxdbUrl:influx数据库的url。example : http://influxHost:8086/write?db=jmeter
  • application:被测试的应用名称。此值也作为名为“application”的标记存储在“events”中
  • measurement:使用默认的”jmeter“就行
  • summaryOnly:为true的情况下,只输出所有请求的集合数据报告,为flase的情况下,输出每条数据的详情报告、
  • samplersRegex:正则表达式将与样本名称匹配并发送到后端。默认匹配所有
  • testTitle:测试名称。默认的设置为 Test name。该值作为名为“text”的字段存储在“事件”度量中。 JMeter在测试的开始和结束时自动生成一个注释,其值以'started'和'ended'结尾
  • percentiles:要发送到后端的百分位数,多个值已;分割
  • TAG_WhatEverYouWant:自定义标签。您可以根据需要添加任意数量的自定义标签。对于它们中的每一个,只需创建一个新行并在其名称前加“TAG_”

实例1 发送数据给influxdb 测试用influxdb在本地,所以地址为0.0.0.0:8086,application为test_1,testTitle为baidu and 163 Jmeter 监听器_第3张图片执行结果 Jmeter 监听器_第4张图片

实例2 显示每条请求 测试计划中内有两个http请求元件,分别请求 百度,163 Jmeter 监听器_第5张图片

  • summaryOnly为ture的情况下,只推送一个集合结果 Jmeter 监听器_第6张图片

  • summaryOnly为flase的情况下,推送每个请求元件的结果,以及集合结果 Jmeter 监听器_第7张图片grafana界面内transaction 显示具体的请求 Jmeter 监听器_第8张图片 报表内显示具体请求信息 Jmeter 监听器_第9张图片

转载于:https://www.cnblogs.com/summerxye/p/11004492.html

你可能感兴趣的:(后端,数据库)