stress testing - How to make jmeter reach target throughput or fail trying?



I have a very simple web service and I'm trying to measure its latency metrics under different throughputs -

enter image description here

If the system under test can't handle the target throughput, I want Jmeter to keep the same throughput, even if a lot of requests fail.

I tried implementing this using a large number of threads and a constant throughput timer, but Jmeter tended to simply not reach the target throughput instead of requests failing.

Any recommendations?

1 Answer: 

Constant Throughput Timer has 2 main limitations:

  1. It is accurate enough on minute level so you need to ensure that your test is running long enough (minute or more). Also its effect is not immediate so during 1st minute of your load test you need to control virtual users arrival rate using Ramp-Up Period setting on Thread Group level
  2. Constant Throughput Timer is only capable of pausing the threads to limit their execution rate to the "target throughput", it will not be able to kick off any extra threads so make sure you define enough virtual users again on Thread Group level

Given Web service == HTTP transport and HTTP being stateful protocol (each JMeter thread (virtual user) will wail for response from the previous HTTP Request sampler prior to starting next one you can speed things up by defining a timeout for your HTTP Requests so they would fail earlier. The best place to put the timeouts is HTTP Request Defaults, this way you will be able to do it in a single shot for all HTTP Request samplers in scope

JMeter HTTP Request Defaults Timeout

You may also want to try Throughput Shaping Timer which is a little bit enhanced version of the Constant Throughput Timer.