JMeter-根据线程数动态增加 [英] JMeter - dynamic ramp up according to threads number
问题描述
我想用属性中的线程号执行JMeter,该线程号可以是10-1000,并设置最佳的启动周期.
I want to execute JMeter with thread number in property, that can be 10-1000 and set the optimal ramp up period.
在 JMeter 中,建议从线程数开始:>
In JMeter it's suggested to start with number of threads:
以Ramp-up =线程数开始,并根据需要向上或向下调整.
Start with Ramp-up = number of threads and adjust up or down as needed.
但是在我的服务器中,在这种配置下它不能很好地工作,我需要的线程数是两倍以上.
But in my servers it's not working well in this configuration and I need more than double the thread number.
我可以使用公式作为线程号(属性值)* 2.5来设置加速吗?还是应该为此目的在每个线程的开始处添加一个Timer?
Can I set the ramp up using a formula as thread Number (property value) * 2.5? or maybe should I add a Timer a the start of each thread for this purpose?
当前,如果我将2*2.5
置于加速期,则将其视为0
Currently if I put 2*2.5
in Ramp-Up period it consider it as 0
INFO o.a.j.t.ThreadGroup:正在启动线程组... number = 1线程= 2加速= 0 perThread = 0.0 delayStart = false
INFO o.a.j.t.ThreadGroup: Starting thread group... number=1 threads=2 ramp-up=0 perThread=0.0 delayedStart=false
我更喜欢JMeter vanilla中没有插件的解决方案.
I prefer solution in JMeter vanilla without plugins.
推荐答案
您可以使用 __groovy 函数以使用属性值:
You can use __groovy function to use property value:
${__groovy(2.5*props.get("rampup").toInteger()),)}
__ groovy函数评估传递给它的Apache Groovy脚本,并返回结果.
The __groovy function evaluates Apache Groovy scripts passed to it, and returns the result.
道具-JMeterProperties(类java.util.Properties)对象
props - JMeterProperties (class java.util.Properties) object
这篇关于JMeter-根据线程数动态增加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!