Apache JMeter 是一个开源的 Java 应用程序,用于性能测试和负载测试。它最初是为测试 Web 应用程序而创建的,但现在已广泛用于测试各种不同类型的应用程序,包括数据库、消息队列、FTP 服务器等。JMeter 提供了丰富的功能,使您能够模拟多种用户行为和不同的负载条件,以评估应用程序在各种情况下的性能表现。
Jmeter 配置
线程组
HTTP请求
参数配置
[
{
"properties": {
"string01": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string02": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string03": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string04": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string05": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string06": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string07": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string08": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string09": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string10": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string11": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string12": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string13": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string14": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string15": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string16": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string17": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string18": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string19": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string20": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string21": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string22": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string23": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string24": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string25": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string26": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string27": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string28": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string29": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string30": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string31": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string32": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string33": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string34": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string35": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string36": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string37": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string38": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string39": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string40": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string41": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string42": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string43": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string44": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string45": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string46": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string47": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string48": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string49": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}",
"string50": "${__RandomString(5,abcdefghijklmnopqrstuvwxyz,)}"
},
"timestamp": ${__time(,)}
}
]
相对路径下自定义csv文件
吞吐量设置
每秒并发1500 * 60秒
Linx执行脚本
启动脚本
nohup jmeter -n -t case1500/TSP_1500_04.jmx -l case1500/result1500_04.jtl > case1500/output1500.log 2>&1 &
nohup jmeter -n -t case1500/TSP_1500_05.jmx -l case1500/result1500_05.jtl > case1500/output1500.log 2>&1 &
nohup jmeter -n -t case1500/TSP_1500_06.jmx -l case1500/result1500_06.jtl > case1500/output1500.log 2>&1 &
pid=`ps -ef|grep jmeter | grep -v grep | awk '{print $2}'`
echo "jmeter $pid 进程启动成功"
tail -f case1500/output1500.log
停止脚本
pid=`ps -ef|grep jmeter | grep -v grep | awk '{print $2}'`
kill -9 $pid
echo "jmeter $pid 进程终止成功"