Class DslThroughputTimer
- java.lang.Object
-
- us.abstracta.jmeter.javadsl.core.testelements.BaseTestElement
-
- us.abstracta.jmeter.javadsl.core.timers.BaseTimer
-
- us.abstracta.jmeter.javadsl.core.timers.DslThroughputTimer
-
- All Implemented Interfaces:
DslTestElement,DslTestPlan.TestPlanChild,BaseSampler.SamplerChild,MultiLevelTestElement,BaseThreadGroup.ThreadGroupChild,DslTimer
public class DslThroughputTimer extends BaseTimer
Allows using JMeter Constant Throughput Timers which pauses samplers under its control to limit the maximum number of samples per minute.If you want the general throughput to be close to the specified number, and not significantly lower, then you have to make sure that the number of threads must be sufficient according to expected sampler response times.
The positioning of the timer determines its scope (as any other timer). I.e. at test plan level to control the pacing of multiple samples across multiple thread groups, under a Thread Group to just influence samplers in that Thread Group, or as a child of a sampler to only control that sampler.
When located at test plan level, this timer will use by default the
DslThroughputTimer.ThroughputMode.ALL_THREADS_EVENcalculation mode. If you locate it inside a thread group (or sampler), it will useDslThroughputTimer.ThroughputMode.THREAD_GROUP_EVENcalculation mode, avoiding potential problem of having two timers in separate thread group interfering with each other. Additionally, default calculation modes don't use shared modes since we have detected unexpected behaviors when using multiple timers. Basically, timers delays calculations interfering with each other due to single test plan or thread group mark used in calculation (instead of one per timer).If you want to change the default calculation method, then you can use
calculation(ThroughputMode)method. But in general, avoid using it, since may lead to unexpected behaviors.- Since:
- 1.5
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDslThroughputTimer.CodeBuilderstatic classDslThroughputTimer.ThroughputModeSpecifies the calculation/control method to control the configured throughput.
-
Field Summary
Fields Modifier and Type Field Description protected DslThroughputTimer.ThroughputModecalculationprotected doublethroughput-
Fields inherited from class us.abstracta.jmeter.javadsl.core.testelements.BaseTestElement
guiClass, name
-
-
Constructor Summary
Constructors Constructor Description DslThroughputTimer(double samplesPerMinute)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.jmeter.testelement.TestElementbuildTestElement()org.apache.jorphan.collections.HashTreebuildTreeUnder(org.apache.jorphan.collections.HashTree parent, BuildTreeContext context)Builds the JMeter HashTree for this TestElement under the provided tree node.DslThroughputTimercalculation(DslThroughputTimer.ThroughputMode calculation)Allows specifying the exact method of calculation of throughput regardless of the location of the timer.DslThroughputTimerperThread()Allows specifying that configured throughput should be counted per thread.-
Methods inherited from class us.abstracta.jmeter.javadsl.core.testelements.BaseTestElement
buildConfiguredTestElement, buildTestElementGui, configureTestElement, durationToSeconds, loadBeanProperties, showAndWaitFrameWith, showFrameWith, showInGui, showTestElementGui
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface us.abstracta.jmeter.javadsl.core.DslTestElement
showInGui
-
-
-
-
Field Detail
-
throughput
protected double throughput
-
calculation
protected DslThroughputTimer.ThroughputMode calculation
-
-
Method Detail
-
perThread
public DslThroughputTimer perThread()
Allows specifying that configured throughput should be counted per thread.I.e: if you have 10 active threads and configure throughput of 10 per thread, then the total maximum throughput will be 10 * 10 = 100 requests per minute.
- Returns:
- the timer for further configuration or usage.
-
calculation
public DslThroughputTimer calculation(DslThroughputTimer.ThroughputMode calculation)
Allows specifying the exact method of calculation of throughput regardless of the location of the timer.This method should only be used when you actually need such control, since may lead to unexpected behaviors when not used correctly. Eg: when there are two timers, each in different thread group, and both of them using ALL_THREADS_ACCURATE.
- Parameters:
calculation- specifies the way of calculating/control the throughput. When not specified, the timer will useDslThroughputTimer.ThroughputMode.ALL_THREADS_EVENif timer is at test plan level,DslThroughputTimer.ThroughputMode.THREAD_GROUP_EVENif timer is inside a thread group andDslThroughputTimer.ThroughputMode.PER_THREADifperThread()was specified.- Returns:
- the timer for further configuration or usage.
- See Also:
DslThroughputTimer.ThroughputMode
-
buildTreeUnder
public org.apache.jorphan.collections.HashTree buildTreeUnder(org.apache.jorphan.collections.HashTree parent, BuildTreeContext context)Description copied from interface:DslTestElementBuilds the JMeter HashTree for this TestElement under the provided tree node.- Specified by:
buildTreeUnderin interfaceDslTestElement- Overrides:
buildTreeUnderin classBaseTestElement- Parameters:
parent- the node which will be the parent for the created tree.context- context information which contains information shared by elements while building the test plan tree (eg: adding additional items to test plan when a particular protocol element is added).- Returns:
- The tree created under the parent node.
-
buildTestElement
protected org.apache.jmeter.testelement.TestElement buildTestElement()
- Specified by:
buildTestElementin classBaseTestElement
-
-