Jmeter进行长稳测试

环境

win7
jmeter 4.0

一、长稳测试脚本创建和参数设置

稳定性测试必须把线程组中的循环次数设置为“永远”。
持续时间我这里设置的是72000s=20小时。
Jmeter进行长稳测试_第1张图片

二、添加定时器Constant Throughput Timer

Constant Throughput Timer:常数吞吐量定时器,可以控制给定的取样器发送请求的吞吐量。
Jmeter进行长稳测试_第2张图片
目标吞吐量:6000.0TPS/MIN=100tps/S *60S
ps:目标吞吐量和设置的逻辑控制器类型有关,我设置的是事务控制器,这就是TPS值

三、在Linux命令行设置长稳测试任务

使用nohup命令让测试任务在后台稳定运行

$ nohup jmxx -n -t rec_post_forcast_mleap_constant.jmx -l ./mleap_constant/mleap_constant-5-5.j-1tl  -e -o ./mleap_constant/mleap_constant-5-5-1 &
[1] 12537
nohup: appending output to `nohup.out'

这里有一个坑,就是mleap_constant-5-5.j-1tl 文件已存在时,nohup命令并不报错。设置完后最好检查一下进程是否存在:

$ ps -ef | grep 12537
603      12537 12511  6 Apr29 ?        01:03:18 /usr/jdk1.8.0_51/bin/java -server -XX:+HeapDumpOnOutOfMemoryError -Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m -XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:G1ReservePercent=20 -Djava.security.egd=file:/dev/urandom -Duser.language=en -Duser.region=EN -jar /home/testknpub/wanwei/apache-jmeter-4.0/bin/ApacheJMeter.jar -n -t rec_post_forcast_mleap_constant.jmx -l ./mleap_constant/mleap_constant-5-5.j-1tl -e -o ./zhangben_mleap_constant/zhangben_mleap_constant-5-5-1
603      32616 32441  0 10:24 pts/0    00:00:00 grep 12537

如果不存在,可以查看nohup.out日志中有无报错:

$ vi nohup.out 

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/testknpub/wanwei/apache-jmeter-4.0/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/testknpub/wanwei/apache-jmeter-4.0/lib/ext/slf4j-log4j12-1.7.9.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]

四、注意事项

稳定测试数据的设置:

  • 10并发用户
  • 固定请求量:100TPS 这个值我通过Constant Throughput Timer和事务控制器组合来达到
  • 稳定性测试必须把线程组中的循环次数设置为“永远”

参考:
https://blog.csdn.net/henni_719/article/details/51732743?utm_source=blogxgwz5
https://www.cnblogs.com/baby123/p/6477429.html

你可能感兴趣的:(jmeter)