Class 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_EVEN calculation mode. If you locate it inside a thread group (or sampler), it will use DslThroughputTimer.ThroughputMode.THREAD_GROUP_EVEN calculation 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
    • Constructor Detail

      • DslThroughputTimer

        public DslThroughputTimer​(double samplesPerMinute)
    • 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.
      • buildTreeUnder

        public org.apache.jorphan.collections.HashTree buildTreeUnder​(org.apache.jorphan.collections.HashTree parent,
                                                                      BuildTreeContext context)
        Description copied from interface: DslTestElement
        Builds the JMeter HashTree for this TestElement under the provided tree node.
        Specified by:
        buildTreeUnder in interface DslTestElement
        Overrides:
        buildTreeUnder in class BaseTestElement
        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.