文章目录
前言
Apache JMeter may be used to test performance both on static and dynamic resources, Web dynamic applications.
It can be used to simulate a heavy load on a server, group of servers, network or object to test its strength or to analyze overall performance under different load types.
一、安装jmeter
jmeter需要用到Java环境,因此需要安装openjdk
sh
Command 'java' not found, but can be installed with:
sudo apt install openjdk-11-jre-headless # version 11.0.20.1+1-0ubuntu1~22.04, or
sudo apt install default-jre # version 2:1.11-72build2
sudo apt install openjdk-17-jre-headless # version 17.0.8.1+1~us1-0ubuntu1~22.04
sudo apt install openjdk-18-jre-headless # version 18.0.2+9-2~22.04
sudo apt install openjdk-19-jre-headless # version 19.0.2+7-0ubuntu3~22.04
sudo apt install openjdk-8-jre-headless # version 8u382-ga-1~22.04.1
二、插件安装
插件下载地址:https://jmeter-plugins.org/install/Install/
下载完成后put it into lib/ext directory, then restart JMeter.
打开jmeter:${Jmeter_home}/bin/jmeter
options->Plugins Manager
安装[3 Basic Graphs][5 Additional Graphs][PerfMon][xxx jpgc xxx]
参考地址:https://juejin.cn/post/7161612946882166815
三、添加常用监听器
在Test Plan上右键 -> add ...
线程组: 可设置用户数量,持续时间等
HTTP信息头管理器: 添加请求的headers
HTTP Request: http请求,方法,路径(?vin=GF;x=3;y=8),端口号等
- 汇总图,以表格形式显示相应延时,流量等
- jp@gc - Response Times Over Time, 相应延时曲线图
- jp@gc - Transactions per Second, 流量曲线图
- 响应断言,可查看相应是否为200。apply to: Main sample only; 测试字段: 相应代码; 匹配规则: 包括
- 查看结果树:查看请求与相应具体内容