当前位置:网站首页>[performance test] read JMeter
[performance test] read JMeter
2022-07-04 07:43:00 【Li Yian QSR】
List of articles
- One 、 Comparison of commonly used stress testing tools
- Two 、Jmeter Installation and catalog explanation
- 3、 ... and 、Jmeter Core components
- Four 、Jmeter Custom variables and variable parameters
- 5、 ... and 、Jmeter Database pressure measurement practice
- 6、 ... and 、 Distributed piezometry
- 7、 ... and 、 How to improve the quality of pressure measurement
- 8、 ... and 、 Detailed explanation of test report
- Nine 、 Summary of related issues
Download link on official website :https://jmeter.apache.org/download_jmeter.cgi
One 、 Comparison of commonly used stress testing tools
- LoadRunner
Stable performance , The results of pressure measurement and fine grain size are large , You can customize the script for pressure testing , But it's too big , There are many functions . - apache ab
Simulate multithreaded concurrent requests ,ab Commands require very little of the computer issuing the load , It doesn't take much CPU, And it won't take up too much memory , But it can put a huge load on the target server , ordinary DDOS Attack, etc - webbench
webbench First fork More than one subprocess , Each subprocess loops through web Access test . The subprocess passes the result of the visit through pipe Tell the parent process , The parent process makes the final statistics .
Two 、Jmeter Installation and catalog explanation
need JDK Environmental Science :8 above ,JDK Installation tutorial
Download from the official website , decompression
bin Catalog : Executable file , Contains configuration
- Jmeter.bat file :windows Startup file
- Jmeter:mac or linux Startup file
- Jmeter-server:mac or linux The startup file for distributed pressure measurement
- jmeter.properties: Core profile
- shutdown: Shut down the program
- report-template: Generation template of aggregate report
docs Catalog : Document directory , Store its use documents
extras Catalog : Plug-in directory , Do the directory of secondary development
lib Catalog : Core tool class junit And some core packages ext
licenses Catalog :
printable_docs Catalog :
- How to adjust Jmeter Language version of
Options - Choose Language - English/Chinese(Simplify)
It can also be modified directly bin Under the table of contents Of jmeter.properties In profile
# language = en
language=zh
Allied , You can also modify some themes and so on
3、 ... and 、Jmeter Core components
1、 test plan
2、 Thread group
In the test plan Add - threads -> Thread group ( Control overall concurrency )
Number of Threads: Number of threads , Number of virtual users . A virtual user occupies a thread
Ramp-up period( second ): The time for all processes to start .100 Threads 20s, Express 20s Inside 100 Each thread will be started slowly , Start every second 5 individual
Loop Count: cycles . Number of times sent per thread . If set to 5,100 Threads
3、 Sampler
Thread group - add to - Sampler( Sampler ) - Http/…
web The server : The default protocol is http, The default port is 80, Target server name or ip Address
route : The server URL
Use multipart/form-data for HTTP POST: When sending POST When asked , Use use multipart/form-data Method to send , Not selected by default
4、 Add result tree
Thread group - add to - Monitor - View the result tree
5、 Assertion
Right click request - add - Assertion - Select the corresponding assertion ( Response assertion …)
6、 Aggregation report
Thread group - add to - Monitor - Aggregation report
Four 、Jmeter Custom variables and variable parameters
test plan - add to - The configuration element - User defined variables
Some configurations can be added ip Address or other information
Where the value is taken, use ${ Variable name }
that will do
Test plan level user variables
CSV Variable parameter pressure measurement
Configuration information description
here csv perhaps txt Documents are ok
If there are two columns , But only one parameter is used , The first column of valid data will be obtained by default
5、 ... and 、Jmeter Database pressure measurement practice
1、 Add thread group
2、 establish JDBC request
3、 Add a configuration component for this request
Configure relevant database information
You need to first 4 Step by step jar Add global , Can fill in all the information
4、 Add global database connection jar
5、 Write the specified JDBC sentence
Add a result tree to view the execution results
JDBC Description of some parameters in the request
Max Number of connections: maximum connection
MAX wait: Maximum waiting time
Auto Commit: Commit transactions automatically
notes : there sql Don't write sentences ;
ending
Variable names:sql The variable name of the execution result
Result variable name: Fill in a variable here , All query results can be encapsulated as this object
Thread group - add to - Debug Sampler
After execution, you can see Debug The result information displayed in the sampler
Handle ResultSet: Processing result set
6、 ... and 、 Distributed piezometry
Why should we do distributed pressure measurement
Ordinary pressure measurement : The pressure produced by a single machine on the target machine is relatively small , Limiting factors include CPU、 The Internet and IO etc.
Distributed piezometry : Use multiple machines to generate pressure on the target machine , Simulate the concurrent access of tens of thousands of users
How to do distributed pressure measurement
Simple principle description
- The machine node of master control is called master, Other machines that generate pressure are called “ chicken ” server
- master Will send the pressure test script to server above
- Only need to Jmeter Of Jmeter-server Just open it , No need to start Jmeter
- After the end ,server Will send back the pressure measurement data to master, then master Summary output report
- Configuration details
Jmeter Command line startup mode , Parameters,
The official tutorial :https://jmeter.apache.org/usermanual/index.html#get-started
-h help
-n Not GUI Pattern
-t Specify the... To run Jmeter Test script file
-l Documentation of results , Before each run ( Make sure you haven't run... Before , namely xxxx.jtl non-existent , Otherwise an error )
-r Jmeter.properties All remote servers specified in the file
-e Generate after the script runs html The report
-o To hold html List of reports ( The catalogue should be wary of , Otherwise an error )
jmeter -n -t linux_user_api.jmx result.jtl -e -o /usr/local/software/jmeter/temp/ResultReport
jmeter -n -t linux_user_api.jmx -l result.jtl -e -o /usr/local/software/jmeter/temp/ResultReport
Distributed pressure measurement real combat
Jmeter Preparation for distributed pressure measurement
Precautions for pressure measurement :
the firewalls on the systems are turned off or correct ports are opened.
The firewall on the system is turned off or the correct port is opened .
all the clients are on the same subnet.
All clients are on the same subnet .
the server is in the same subnet, if 192.x.x.x or 10.x.x.x IP addresses are used. If the server doesn’t use 192.xx or 10.xx IP address, there shouldn’t be any problems.
If you use 192.x.x.x or 10.x.x.x IP Address , The server is in the same subnet . If the server doesn't use 192.xx or 10.xx IP Address , There should be no problem .
Make sure JMeter can access the server.
Make sure JMeter Access to the server .
Make sure you use the same version of JMeter and Java on all the systems. Mixing versions will not work correctly.
Make sure the same version of... Is used on all systems JMeter and Java. The hybrid version will not work properly .
You have setup SSL for RMI or disabled it.
You have made a reservation for RMI Set up SSL Or disable it .
Official website address http://jmeter.apache.org/usermanual/jmeter_distributed_testing_step_by_step.html
- Precautions for pressure measurement : Be sure to use the intranet IP, Don't use the public network IP, use ping Go check
master: Commander
slave: slave
target: The goal is
Address :http://jmeter.apache.org/images/screenshots/distributed-names.svg
Address :http://jmeter.apache.org/images/screenshots/distributed-jmeter.svg
- Remote copy ( Intranet address )
scp -r /usr/local/software/jdk-8u141-linux-x64.tar.gz [email protected]:/usr/local/software
scp -r /usr/local/software/jmeter/apache-jmeter-4.0.tgz [email protected]:/usr/local/software/jmeter
start-up
./jmeter-server perhaps nohup ./jmeter-server &
- Check if the start is successful
ps -ef|grep jmeter-server
ps aux|grep jmeter-server
- Focus on CPU And memory usage
Local non GUI Distributed piezometry -r
jmeter -n -t /Users/jack/Desktop/remote.jmx -r -l /Users/jack/Desktop/jtl/result.jtl -e -o /Users/jack/Desktop/result
Pressure test results
./jmeter -n -t /Users/jack/Desktop/remote.jmx -r -l /Users/jack/Desktop/jtl/result.jtl -e -o /Users/jack/Desktop/result
Creating summariser <summary>
Created the tree successfully using /Users/jack/Desktop/remote.jmx
Configuring remote engine: 172.20.10.3:8899
Using local port: 8899
Configuring remote engine: 172.20.10.11:8899
Starting remote engines
Starting the test @ Thu Mar 29 23:21:13 CST 2018 (1522336873931)
Remote engines have been started
Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
summary = 4 in 00:00:22 = 0.2/s Avg: 5582 Min: 94 Max: 21006 Err: 1 (25.00%)
Tidying up remote @ Thu Mar 29 23:21:36 CST 2018 (1522336896842)
... end of run
- Pressure measurement modification master Node information
jemeter.properties The value is slave Mechanical ip+ Port number , If there are more than one , Separate with commas
remote_hosts=192.168.0.102:8899,192.168.0.101:8899
server.rmi.ssl.disable=true ( I said before )
- start-up slave machine , Pay attention to the same network segment ,ip Address using intranet ip
./jmeter-server
Using local port: 8899
Created remote object: UnicastServerRef2 [liveRef: [endpoint:[192.168.0.102:8899](local),objID:[3a585a4d:162724586ab:-7fff, 3963132813614033916]]]
Related information :
https://www.cnblogs.com/Fine-Chan/p/6233823.html
https://blog.csdn.net/liujingqiu/article/details/52635289
https://www.cnblogs.com/puresoul/p/4844539.html
7、 ... and 、 How to improve the quality of pressure measurement
Use non GUI Pattern :jmeter -n -t test.jmx -l result.jtl
Reduce use Listener, If you use -l Parameters , They can be deleted or disabled
Do not use... During load testing “ View the result tree ” perhaps “ View results ” Watch listener , They can only be used for debugging during the script phase
Including the controller is not helpful here , Because they add all the test elements in the file to the test plan
Don't use functional mode , Use csv Output, not xml
Save only the data you need , Minimize the use of assertions
If the test requires a lot of data , You can save the test data in the data file in advance , With csv·Read Read in this way
Measure with internal network voltage , Reduce the impact of other bandwidth on the pressure measurement effect
If the pressure is measured with large flow , Use as many nodes as possible to avoid GUI Mode pressure test to the server
The official recommendation :https://jmeter.apache.org/usermanual/best-practices.html#lean_mean
8、 ... and 、 Detailed explanation of test report
Check other places jtl file
Using software from Alibaba cloud Centos Download the pressure test report from the server , Explain Jtl file , And how to view the file
You can do this by opening jmeter, New thread group ->summary report-> browse files To view the
brief introduction : hold Jmtere The pressure measurement results are converted to Html
Instructions
jmeter -n -t /usr/local/software/jmeter/temp/linux_users_api.jmx -l
/usr/local/software/jmeter/temp/jtl/result.jtl -e -o
/usr/local/software/jmeter/temp/result
Jmeter Graphical HTML Pressure test report dashboard
Pressure test report html Inside Dashboard The core indicators of
1)Test and Report informations
Source file:jtl file name
Start Time : Pressure test start time
End Time : End time of pressure measurement
Filter for display: filter
Lable:sampler Sampler name
2)APDEX(Application performance Index)
apdex: Application performance metrics , The scope is 0~1 Between ,1 All users are satisfied
T(Toleration threshold): Acceptable threshold
F(Frustration threshold): Failure threshold
3)Requests Summary
OK: The success rate
KO: Failure rate
4)Statistics statistics
lable:sampler Sampler name
samples: Total requests , Concurrency number * cycles
KO: Number of failures
Error%: Failure rate
Average: Mean response time
Min: Minimum response time
Max: Maximum response time
90th pct: 90% The user response time will not exceed this value ( Just focus on this )
2ms,3ms,4,5,2,6,8,3,9
95th pct: 95% The user response time will not exceed this value
99th pct: 99% The user response time will not exceed this value ( There are extreme values )
throughtput:Request per Second throughput qps
received: The amount of data received from the server per second
send: The amount of data sent per second
Jmeter Graphical HTML Pressure test report Charts report form
1、Over Time( Over time )
Response Times Over Time: Response time trends
Response Time Percentiles Over Time (successful responses): Maximum , Minimum , Average , use User response time distribution
Active Threads Over Time: Trend of concurrent users
Bytes Throughput Over Time: The number of bytes received and requested per second changes , Blue indicates sending , Yellow indicates acceptance
Latencies Over Time: Average response delay trend
Connect Time Over Time : Connection time trend
2、Throughput
Hits Per Second (excluding embedded resources): Hits per second
Codes Per Second (excluding embedded resources): Number of status codes per second
Transactions Per Second: namely TPS, Transactions per second
Response Time Vs Request: Comparison of response time and number of requests
Latency Vs Request: Comparison of delay time and number of requests
3、Response Times
Response Time Percentiles: Percentage of response time
Response Time Overview: Response time Overview
Time Vs Threads: Number of active threads and response time
Response Time Distribution: Response time distribution
Nine 、 Summary of related issues
The configuration element =》 Preprocessor =》 Timer =》 Sampler =》 Post Processors =》 Assertion =》 Monitor
problem :
[[email protected] bin]# ./jmeter-server
Created remote object: UnicastServerRef2 [liveRef: [endpoint:[:39308](local),objID:[24e78a63:16243c70661:-7fff, 7492480871343944173]]]
Server failed to start: java.rmi.RemoteException: Cannot start. Unable to get local host IP address.; nested exception is:
java.net.UnknownHostException: iZwz95j86y235aroi85ht0Z: iZwz95j86y235aroi85ht0Z: Name or service not known
An error occurred: Cannot start. Unable to get local host IP address.; nested exception is:
java.net.UnknownHostException: iZwz95j86y235aroi85ht0Z: iZwz95j86y235aroi85ht0Z: Name or service not known
solve :
hostname Command to get the machine name , Append a map iZwz95j86y235aroi85ht0Z
vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
120.79.160.143 iZwz95j86y235aroi85ht0Z
windows user modify c:\windows\system32\drivers\etc\hosts file , Add a domain name And IP Mapping
problem
[[email protected] bin]# ./jmeter-server
Server failed to start: java.rmi.server.ExportException: Listen failed on port: 0; nested exception is:
java.io.FileNotFoundException: rmi_keystore.jks (No such file or directory)
An error occurred: Listen failed on port: 0; nested exception is:
java.io.FileNotFoundException: rmi_keystore.jks (No such file or directory)
solve :
Have RMI over SSL A valid keystore , Or disable SSL.
1、 Ban SSL
jmeter.property Inside server.rmi.ssl.disable Change it to true, Disable
problem :
[[email protected] bin]# ./jmeter
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0000000, 1073741824, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 1073741824 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /usr/local/jmeter/apache-jmeter-4.0/bin/hs_err_pid5855.log
solve :
edit jmeter
Search for : "${HEAP:="-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m"}"
Change the initial heap memory and the maximum heap memory
- Modify only server_port that will do , The following two are the same
server.rmi.localport=8899 Express slave server Start the displayed port
server_port=8899 Express master The port to which the machine is to be remotely connected namely remote_hosts=xxxx:8899
We need to start on a server with multiple network cards RMI For service, you must specify IP, So that they can be in the same network segment .
The following steps are required ( Suppose all machines are 10.120.11.* Network segment ,agent The server is linux,controller The server is windows):
1、 modify agent The server , Appoint agent Mechanical IP
modify jmeter-server file
# vi jmeter-server
modify RMI_HOST_DEF=-Djava.rmi.server.hostname=xxx.xxx.xxx.xxx( Need to connect IP)
2、 modify server The server , Appoint server Mechanical IP
modify jmeter.bat file
newly added set rmi_host=-Djava.rmi.server.hostname=10.120.11.214
modify set ARGS=%DUMP% %HEAP% %NEW% %SURVIVOR% %TENURING% %PERM% %DDRAW% %rmi_host%
Make sure that controller Machine mounted jdk, Version and jmeter Agreement , Configure environment variables :Java_home etc.
stay Agent Machine mounted jdk, Configure environment variables :Java_home and JMeter_home The installation directory should not contain spaces , It's best to have short English paths
master After the machine starts, it will copy jmx File to slave machine
So you don't need to be on every slave A copy is also uploaded on the machine jmx, Only need master Upload a copy on the machine jmx The script can be . If you use csv Parameterize , You need to put the parameter file in each machine slave Copy a copy and the path needs to be set to the same . The total number of samples = Number of threads * cycles * Total number of actuators
Troubleshooting of connection failure
The following steps are taken for troubleshooting :
1. jmeter-server Whether to start ;
2. Networking or not
3. ping The server IP Is it unblocked .
4. telnet port 192.168.3.10 1099
5. Check whether the firewall of the server is turned off .
6. Is Alibaba cloud's security policy normal
“could not find ApacheJmeter_core.jar”
solve : stay Agent Machine installation jdk, And set environment variables
”Bad call to remote host"
solve : Check the... On the controlled machine jmeter-server Has it started up , perhaps remote_hosts Is the configuration of correct .
边栏推荐
- Chrome is set to pure black
- [network security] what is emergency response? What indicators should you pay attention to in emergency response?
- NPM run build error
- SQL注入测试工具之Sqli-labs下载安装重置数据库报错解决办法之一(#0{main}thrown in D:\Software\phpstudy_pro\WWW\sqli-labs-……)
- Oracle stored procedures and functions
- 节点基础~节点操作
- Using the rate package for data mining
- Take you to master the formatter of visual studio code
- What are the work contents of operation and maintenance engineers? Can you list it in detail?
- Handwritten easy version flexible JS and source code analysis
猜你喜欢
Devops Practice Guide - reading notes (long text alarm)
Do you know about autorl in intensive learning? A summary of articles written by more than ten scholars including Oxford University and Google
[Android reverse] function interception (use cache_flush system function to refresh CPU cache | refresh CPU cache disadvantages | recommended time for function interception)
深入浅出:了解时序数据库 InfluxDB
What are the work contents of operation and maintenance engineers? Can you list it in detail?
Technical experts from large factories: common thinking models in architecture design
Implementation of ZABBIX agent active mode
Zabbix agent主动模式的实现
线性代数1.1
Unity 从Inspector界面打开资源管理器选择并记录文件路径
随机推荐
L1-027 rental (20 points)
墨者学院-phpMyAdmin后台文件包含分析溯源
MySQL中的文本處理函數整理,收藏速查
MySQL中的文本处理函数整理,收藏速查
BUUCTF(3)
Rhcsa the next day
Handwritten easy version flexible JS and source code analysis
[web security] nodejs prototype chain pollution analysis
Devops Practice Guide - reading notes (long text alarm)
Div hidden in IE 67 shows blank problem IE 8 is normal
墨者学院-PHPMailer远程命令执行漏洞溯源
zabbix监控系统部署
ZABBIX monitoring system deployment
[Flink] temporal semantics and watermark
Application of isnull in database query
zabbix 5.0监控客户端
Zephyr study notes 2, scheduling
Système de surveillance zabbix contenu de surveillance personnalisé
Chrome is set to pure black
Blue Bridge Cup Quick sort (code completion)