Jmeter pressure test actual combat including cpu performance test

1. Record the test plan

1) Open jmeter and create a test plan (thread group-sampler (HTTP request-listener (view result tree, aggregate report)))

 

2) The server parameter port has been parameterized management:

3) A parameterized management is also done for the requested data:

4) Finally, use parameterized thinking to pass parameters, HTTP request, fill in IP, port, request method, path, parameter name and value

5) View the result tree and aggregate reports are used to view the success of the execution plan and various indicators.

I added an assertion, so you can clearly see the results of the stress test in the aggregate report:

Detailed explanation of aggregation report parameters: 

Label:每个 JMeter 的 element(例如 HTTP Request)都有一个 Name 属性,这里显示的就是 Name 属性的值 

#Samples:请求数——表示这次测试中一共发出了多少个请求,如果模拟10个用户,每个用户迭代10次,那么这里显示100 

Average:平均响应时间——默认情况下是单个 Request 的平均响应时间,当使用了 Transaction Controller 时,以Transaction 为单位显示平均响应时间 

Median:中位数,也就是 50% 用户的响应时间 

90% Line:90% 用户的响应时间 

Min:最小响应时间 

Max:最大响应时间 

Error%:错误率——错误请求数/请求总数 

Throughput:吞吐量——默认情况下表示每秒完成的请求数(Request per Second),当使用了 Transaction Controller 时,也可以表示类似 LoadRunner 的 Transaction per Second 数 

KB/Sec:每秒从服务器端接收到的数据量,相当于LoadRunner中的Throughput/Sec

Generally speaking, the data we need to focus on in the performance test are: #Samples number of requests, Average average response time, Min minimum response time, Max maximum response time, Error% error rate and Throughput throughput.

2. Execute the test plan in the linux environment (suppress)

Upload the script to the linxu environment, you can directly modify the parameters in the script (concurrent number, running time, location of the parameter file)

Execute the test plan in the bin directory of jmeter, and execute the command as follows:

$ jmeter -n -t user-login.jmx -l login-result.jtl -e -o ResultReport

#user-login.jmx是脚本名字,login-result.jtl 是生成的日志文件,ResultReport是生成的报告目录

· -h 帮助 -> 打印出有用的信息并退出

· -n 非 GUI 模式 -> 在非 GUI 模式下运行 JMeter

· -t 测试文件 -> 要运行的 JMeter 测试脚本文件

· -l 日志文件 -> 记录结果的文件

· -r 远程执行 -> 启动远程服务

· -H 代理主机 -> 设置 JMeter 使用的代理主机

· -P 代理端口 -> 设置 JMeter 使用的代理主机的端口号

After executing the command, you also need to observe whether there is an error in the suppression process, and monitor the cpu, memory, load, etc. of the linux server

3. html report display:

1)Dashboard:

2)overtime:

3) Response Time Percentiles Over Time (successful responses)

4)Active Threads Over Time

5)Bytes Throughput Over Time

6)Latencies Over Time

7)Connect Time Over Time

4. How does jemter monitor the performance of the server

1) As shown in the figure, you need to download the jmeter plug-in first. Download link: https://jmeter-plugins.org/downloads/old/

2) Decompress the compressed package, find the JAR file in the decompressed package, and copy it to the lib/ext directory of jmeter

3)  As shown in the figure above, put the two jar packages in the lib/ext directory of JMeter, restart jmeter, and the following new components appear, indicating that the startup is successful

4) Introduction to common components

jp@gc - Bytes Throughput Over Time:不同时间吞吐量展示(图表) 聚合报告里,Throughput是按请求个数来展示的,比如说1.9/sec,就是每s发送1.9个请求;而这里的展示是按字节Bytes来展示的图表

jp@gc - Composite Graph: 混合图表 在它的Graphs里面可以设置多少个图表一起展示,它可以同时展示多个图表

jp@gc - Hits per Second:每秒点击量

jp@gc - PerfMon Metrics Collector:服务器性能监测控件,包括CPU,Memory,Network,I/O等等

jp@gc - Reponse Latencies Over Time:记录客户端发送请求完成后,服务器端返回请求之前这段时间

jp@gc - Reponse Times Distribution: 显示测试的响应时间分布,X轴显示由时间间隔分组的响应时间,Y轴包含每个区间的样本数

jp@gc - Transactions per Second: 每秒事务数,服务器每秒处理的事务数

5) Unzip serveragent-2.2.1.zip, download link: https://pan.baidu.com/s/1G85ZC-GvJSI2AO3eABmTbg  Password: 2evc

liunx:运行命令*./startAgent.sh* 或 sh startAgent.sh 即可启动ServerAgent服务

windows:运行 startAgent.bat

Default port 444

$ sh startAgent.sh

INFO    2020-08-28 15:43:45.254 [kg.apc.p] (): Binding UDP to 4444

INFO    2020-08-28 15:43:45.313 [kg.apc.p] (): Binding TCP to 4444

INFO    2020-08-28 15:43:45.316 [kg.apc.p] (): JP@GC Agent v2.2.0 started

You may encounter version problems here:

java.lang.NoSuchMethodError: org.apache.jmeter.samplers.SampleSaveConfiguration.setFormatter(Ljava/t

Solution reference: https://www.cnblogs.com/SunshineKimi/p/11361216.html

6) The following figure perfectly monitors the performance of the CPU:

Guess you like

Origin blog.csdn.net/LYX_WIN/article/details/108299492
Recommended