Search code examples
jmeterperformance-testing

Does "if controller" in jmeter reduces the throughput in someway?


I was doing perf-test on my apis and while trying a few things, I found out that if I put my sampler(http request) in an "if controller" that always result in true, the throughput I get is half of when I use sampler with no if controller. Why is this happening ?

The comparison in if-controller is just comparing if a random variable is greater than some threshold.

My actual use-case is obviously different but this behaviour by if-controller is affecting me. Edit: Here's image of my if-controller configuration. enter image description here


Solution

  • You should check If Controller reference it hold a good example of using If controller without effecting performance.

    Interpret Condition as Variable Expression? If this is selected, then the condition must be an expression that evaluates to "true" (case is ignored). For example, ${FOUND} or ${__jexl3(${VAR} > 100)}

    In your case you should check the Interpret Condition as Variable Expression? checkbox and use the following condition (without quotes):

    ${__jexl3(${breachPercent} > 10)}
    

    You can also replace __jexl3 with __groovy function

    Checking this and using __jexl3 or __groovy function in Condition is advised for performances