Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Custom jmeter Multi-dimensional report-Huashan

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

one。 Why talk about this new feature?

Before JMeter3.0, officials only provided a graphical display of some dimensions of test results on the UI of the tool, which bothered me in two ways:

In practical use, when we need to display TPS curve, average response time curve and other charts on the page after integrating JMeter in the platform, we need to manipulate the front-end chart library such as Hightcharts/Echarts manually.

To view the historical test results, you need to start the graphical interface of JMeter, import the saved CSV results, the process is tedious, and when the result set is large, JMeter needs to spend a lot of time displaying graphical reports on the interface.

The new features discussed in this article bring better solutions to these two problems:

The new feature well realizes the visualization of the result data, and the generated report is in the form of HTML pages, and contains most of the measurement dimensions concerned in the actual test, which can be easily embedded into the platform to view each test run from the browser.

As long as you keep the generated HTML page, to view the test results later, you only need to open it in the browser, which is convenient and fast.

two。 Introduction to New Featur

JMeter3.0 provides an extension module for generating graphical reports in HTML page format. This module supports the generation of multidimensional graphical test reports in two ways:

At the end of the JMeter performance test, the HTML graphical report of the test is automatically generated

Use an existing result file (such as CSV file) to generate a HTML graphical report of the result

The measurement dimensions provided by default include:

APDEX (Application Performance Index) index

Aggregate report

Similar to Aggregate Report on UI

Errors report

Show the number and percentage of different types of errors

Response time variation curve

Show how the average response time changes over time

Similar to JMeter Plugins's jp@gc-Response Times Over Time on UI

Data throughput time curve

Show how data throughput per second changes over time

Similar to JMeter Plugins's jp@gc-Bytes Throughput Over Time on UI

Latency time change curve

Show how Latency time changes over time

Similar to JMeter Plugins's jp@gc-Response Latencies Over Time on UI

Clicks per second curve

Similar to JMeter Plugins's jp@gc-Hits per Second on UI

Time distribution curve of HTTP status code

Show the distribution of response status codes over time

Similar to JMeter Plugins's jp@gc-Response Codes per Second on UI

Transaction Throughput time Curve (TPS)

Show how the number of transactions per second changes over time

Similar to JMeter Plugins's jp@gc-Transactions per Second on UI

Relationship between average response time and requests per second

Show the relationship between average response time and requests per second (which can be understood as QPS)

Relationship between Latency time and requests per second

Show the relationship between Latency time and requests per second

Response time percentile map

Percentile distribution of response time

Active thread number change curve

Show how the number of active threads changes over time during the test

The relationship between the average response time and the number of threads

Show the relationship between average response time and the number of threads

Similar to JMeter Plugins's jp@gc-Response Times vs Threads on UI

Cylindrical response time distribution diagram

Show the number of requests falling within each average response time range

Note 1:Latency time is not translated into Chinese. Here are some notes on how to calculate it:

Latency time = the point in time that the first byte of the response was received-the time when the request began to be sent

From just before sending the request to just after the first response has been received

-Apache JMeter Glossary

Response time (Elapsed time in JMeter terminology) = the point in time all the response content has been received-the point in time when the request begins to be sent

From just before sending the request to just after the last response has been received

-Apache JMeter Glossary

Note from the user's point of view, the 2:Apdex standard transforms the performance of the application response time into a satisfaction evaluation with a range of 0-1.

Apdex (Application Performance Index) is an open standard developed by an alliance of companies. It defines a standard method for reporting and comparing the performance of software applications in computing.

-wikipedia

three。 Getting started 1. Confirm basic configuration

Confirm the following configuration items in jmeter.properties or user.properties:

Jmeter.save.saveservice.bytes = truejmeter.save.saveservice.label = truejmeter.save.saveservice.latency = truejmeter.save.saveservice.response_code = truejmeter.save.saveservice.response_message = truejmeter.save.saveservice.successful = truejmeter.save.saveservice.thread_counts = truejmeter.save.saveservice.thread_name = truejmeter.save.saveservice.time = true# the timestamp format must include the time and should include the date.# For example the default Which is milliseconds since the epoch: jmeter.save.saveservice.timestamp_format = ms# Or the following would also be suitablejmeter.save.saveservice.timestamp_format = yyyy/MM/dd HH:mm:ss

If you want to show more detailed data in the Errors report, you need to make sure that the following configuration

Jmeter.save.saveservice.assertion_results_failure_message = true

If a transaction controller (Transaction Controller) is used, confirm that Generate parent sample is unchecked

two。 Generate a report

a. Report at the end of the stress test

Basic command format:

Jmeter-n-t-l-e-o

Example:

Jmeter-n-t F:\ PerformanceTest\ TestCase\ script\ getToken.jmx-l testLogFile-e-o. / output

b. Generate a report using an existing stress test CSV log file

Basic command format:

Jmeter-g-o

Example:

Jmeter- g D:\ apache-jmeter-3.0\ bin\ testLogFile-o. / output

Both samples generate the following files (folders) in the\ apache-jmeter-3.0\ bin\ output directory:

Open the index.html file with a browser to view a variety of graphical reports:

Note: in version 3.0, due to character coding problems, you may encounter the problem that the Chinese label is displayed as garbled in the generated report. Due to space limitations, please check here for another article.

four。 Custom configuration

JMeter3.0 added a new reportgenerator.properties file in the bin directory to save all the default configuration of the graphical HTML report generation module. To change the configuration, it is recommended not to edit the file directly, but to configure and overwrite it in user.properties.

1. Overall configuration

The overall configuration is based on jmeter.reportgenerator. Is a prefix. Such as: jmeter.reportgenerator.overall_granularity=60000

Overall_granularity: define the granularity of the sampling point. Default is 60000ms. Usually in tests other than stability, we may need to define a finer granularity, such as 1000ms. We can add the following configuration at the end of the user.properties file:

# Change this parameter if you want to change the granularity of over time graphs.jmeter.reportgenerator.overall_granularity=6000

Report_title: define the title of the report. We may need to define the title as the actual test item name.

Apdex_satisfied_threshold: defines a satisfactory threshold in Apdex assessment (in ms)

Apdex_tolerated_threshold: define tolerable thresholds in Apdex assessment

Apdext = (Satisfied Count + Tolerating Count / 2) / Total Samples

In addition, in jmeter.properties, there are default values for the three percentiles in the collection report:

Aggregate_rpt_pct1: Defaults to 90aggregate_rpt_pct2: Defaults to 95aggregate_rpt_pct3: Defaults to 99

You can override it in user.properties, such as aggregate_rpt_pct1 = 70, and the effect is as follows:

two。 Chart configuration

Each chart is configured with jmeter.reportgenerator.graph.. Is a prefix.

The implementation class of the classname diagram. If you have your own custom implementation, write the value of the configuration as the class name of the custom implementation class.

Title icon title, for example, when you want to turn it into Chinese, configure the Chinese title here

Property.set_granularity sets the sampling point granularity of the icon. If it is not configured, the granularity setting in the overall configuration is used by default.

3. Output configuration

The output configuration is prefixed with jmeter.reportgenerator.exporter.

Property.output_dir configures the default report output path. You can set a specific path to override the configuration with the-o option on the command line.

Html.series_filter is used to filter display content. For example, add the following configuration to user.properties:

Jmeter.reportgenerator.exporter.html.series_filter= (^ Login) (- success |-failure)?

The final report shows only the data of the sampler named Login. The configuration consists of two parts, (- success |-failure)? Is the configuration on which the Transactions per second chart depends. The previous section accepts a regular expression for filtering.

4. Report customization

JMeter's HTML report is generated using a fixed template with a template file path of. / bin/report-template.

Entering this directory, you can see that each page of the report has a .fmkr template file, including several files under the index.html.fmkr and. / content/pages paths. By looking at these template files, you can know how to make light customization of the report, such as making some text easier to understand, or changing it to Chinese.

The title of the page

Default is "Apache JMeter Dashboard"

It can be uniformly defined by the jmeter.reportgenerator.report_title in reportgenerator.properties, which means that all pages have the same title.

You can also directly modify the value within the double quotation marks in the title tag in the corresponding .fmkr file, such as ${reportTitle! "title you want to set"}, in which you can define the title separately for each page.

The name of the chart

In the current version, the names of each chart are defined directly in the template file, and you can also directly modify the values of the corresponding elements in the template file.

If you want to modify the name of the Transactions Per Second chart, you can modify it directly in the. / content/pages/Throughput.html.fmkr file. The effect is as follows

Other elements of the page can also be customized in the same way

five。 Summary

The Dashboard Report feature introduced in this article is essentially an update of Apache JMeter for the visualization of test result data, which is belated and not cool, but at least it is still a boon for those who need to perform performance tests based on it. Finally, I would like to thank the contributors to the Apache JMeter project for their continuous updates.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report