This article appeared in:Walker AI

Jmeter can generate relatively complete visual test data record report through command line. In order to obtain performance test bottleneck data more accurately, we need to analyze the test data record report.

1. Design of performance test scheme

Performance testing requires different test scenarios for different testing purposes, which are not the subject of this article but will be described here.

Assuming that our test objective was to find the maximum throughput of the system API, we explored the maximum throughput by increasing the number of threads per second.

(1) Write jMeter test scripts according to project business requirements.

(2) Set the thread group as follows.

Scenarios 1-4 are set to 300 threads and the startup time is 600s, which is equivalent to 0.5 threads per second for each scenario.

Scenario 5 is set to 600 threads with a start time of 600s, equivalent to one thread per second.

In all of these scenarios, this is equivalent to three threads starting per second.

(3) Save the script and name it test001.jmx under D:\jmeter_script.

(4) In order to get more accurate test results, we can test multiple times to get the average, so we choose to run it automatically for several times in the middle of the night.

2. Perform a performance test

2.1 Executing performance Test Commands

jmeter -n -t D:\test0420.jmx -l D:\jmeter_script\report.csv -e -o D:\jmeter_script\report

(1) -n Sets the command line mode.

(2) -t Specifies the path where the script is executed.

(3) -l Specifies the result file path.

(4) Generate a report after the -e setting test is complete.

(5) -o Specifies the path of the generated report folder. The folder must be empty or does not exist.

2.2 How can I Automate tests

To reduce interference from the external environment, the average value of the pressure test is calculated in the late night, and the scheduled task function of Windows is used to periodically start the BAT script and invoke the JMeter command.

(1) Write a bat script

Not only do you need to run the command, but you also need to save the test report as run.bat in drive D.

The script is as follows:

% @ echo off the if time: 9 ~ 0, 2% GTR (SET curtime = % date: ~ 0, 4 - date: % % % % ~ 5, 2 - date: ~ 8, 2 - % % time: ~ 0, 2 - % % time: % ~ 3, 2) else (the SET Curtime = % date: ~ 0, 4 - date: % % % % ~ 5, 2 - date: ~ 8, 2 - % % time: % ~ % 1, 1 - time: ~ 3, 2) % D: CD D:\jmeter_script mkdir report%curtime% CD D:\soft\apache-jmeter-5.2.1\bin jmeter -n -t D:\jmeter_script\test001.jmx -l D:\jmeter_script\report%curtime%\report.csv -e -o D:\jmeter_script\report%curtime%\report > D:\jmeter_script\report%curtime%\OutputLog%curtime%.txtCopy the code

(2) You can set scheduled tasks in Windows

Windows 7 in Control Panel – Management tools

Win10 iN the computer right – management

The following Settings

Name: Name yourself.

The trigger configuration is as follows: It will start at 10pm and every two hours.

The configuration is as follows: The BAT file is not started when the trigger occurs.

3. The result is displayed

3.1 Test Report After execution

Here is an example of the previous test report.

3.2 Analysis of test reports

(1) Apdex (Application performance indicator)

Apdex definition: Application Performance Index (Apdex) Is an international standard. Apdex is a quantified value of users’ satisfaction with Application Performance. It provides a unified approach to measuring and reporting user experience, unifying end user experience and application performance as a complete metric. From the perspective of users, Apdex converts the performance of application response time into a quantifiable 0-1 satisfaction evaluation of application performance.

How to calculate Apdex:

Apdex samples the tasks occurring in the application, divides the samples into corresponding satisfaction interval according to their response time, counts them, and then calculates the Apdex index by a formula:

The location of Apdex in the test report is as follows:

(2) Analysis of maximum throughput

Throughput-Total Transactions Per Second:

Extra-active Threads OverTime Number of Active Threads:

Extra-response Times OverTime Response Time:

According to the above three figures, when the number of threads is 152, the response time is in the range of 0.2-0.6, and the throughput reaches the maximum at about 364TPS. After the number of threads is added, an error occurs, and the response time increases and the throughput decreases.

4. Summarize the test results

A total of five tests were conducted. We analyzed the five test reports respectively and summarized them in the following table to draw the test conclusion.


PS: more dry technology, pay attention to the public, | xingzhe_ai 】, and walker to discuss together!