Implementing Iteration Pacing in jMeter

Jmeter is an excellent tool for performance testing, especially given the price. It does however have a small number of limitations. One of those is the lack of a decent analysis, results and reporting engine – which I guess is why a lot of companies use Blazemeter as their testing component.

Another limitation in my eyes is the lack of a flexible iteration pacing controller.

If we build a load model allowing 45 seconds for an iteration, but that iteration takes 15 seconds, there’s is no built-in method to tell jMeter to wait 30 seconds on this thread. This is compounded by additional threads since they either all have to wait an arbitrary length of think-time which minimises the concurrent activity, or they don’t wait and the system is under higher loads than specified for the test.

There is a solution presented here using Groovy.

In a Pre-processor on the first action of an iteration – which is not necessarily the first action, but rather the first action we loop upon – put a snippet to capture the time of iterationStart.

In a post-processor capture the time of iterationEnd.

In a transaction controller, outside the loop but inside the thread group. Add a flow control action to pause for “${myDelay}”

Attached to the flow control action, a pre-processor will calculate the value of the myDelay variable with the code shown here:

“iterationPacing” in this example is coming from a user defined variable at the moment, but will eventually be coming from a Yml file using a taurus implementation.

The final structure could be something like this:

You can leave a response, or trackback from your own site.

Leave a Reply

Powered by WordPress and ThemeMag