1、设置指定了qps
https://www.cnblogs.com/duanxz/p/5464993.html
Constant Throughput Timer 的主要属性介绍:
名称 :定时器的名称
Target throughput(in samples per minute):目标吞吐量。注意这里是每分钟发送的请求数,因此,对应测试需求中所要求的20 QPS ,这里的值应该是1200 。
Calculate Throughput based on :有5个选项,分别是:
This thread only :控制每个线程的吞吐量,选择这种模式时,总的吞吐量为设置的 target Throughput 乘以矣线程的数量。
All active threads : 设置的target Throughput 将分配在每个活跃线程上,每个活跃线程在上一次运行结束后等待合理的时间后再次运行。活跃线程指同一时刻同时运行的线程。
All active threads in current thread group :设置的target Throughput将分配在当前线程组的每一个活跃线程上,当测试计划中只有一个线程组时,该选项和All active threads选项的效果完全相同。
All active threads (shared ):与All active threads 的选项基本相同,唯一的区别是,每个活跃线程都会在所有活跃线程上一次运行结束后等待合理的时间后再次运行。
All cative threads in current thread group (shared ):与All active threads in current thread group 基本相同,唯一的区别是,每个活跃线程都会在所有活跃线程的上一次运行结束后等待合理的时间后再次运行。
如果要限制1s钟请求一次,线程数10,定时器设置成30,选择All active threads
2、产线jmeter执行
1、sudo su
2、cd /home/jmeter/apache-jmeter-5.2/bin/
3、./jmeter.sh -n -t /tmp/name/order-coupon.jmx -l /tmp/name/logs/addcart.jtl
./jmeter.sh -n -t /tmp/name/order-coupon.jmx -l /tmp/name/logs/addcart.jtl -j /tmp/name/logs/addcart.log
加上日志输出
3、jmeter请求输出到控制台:
添加后置beanshell
public void writeToLog(){
String logInfo = "\n";
//线程组名 + 采样器名称
logInfo = logInfo + prev.getThreadName() + " " + prev.getSampleLabel() + "\n";
//请求内容,如果仅需要url的话,可以使用prev.getUrlAsString()方法
logInfo = logInfo + prev.getSamplerData() + "\n";
//响应状态码
logInfo = logInfo + prev.getResponseCode() + "\n\n";
//响应内容
logInfo = logInfo + prev.getResponseDataAsString() + "\n";
//写入日志
log.info(logInfo);
}
writeToLog();
4、linux下执行jmeter
https://www.cnblogs.com/kongzhongqijing/p/7216693.html
网友评论