Configure RPS limits in JMeter
RPS, which stands for requests per second, describes the actual load that a stress testing engine generates. This metric is ideal for API testing scenarios. This topic describes how to control RPS in JMeter.
Configure RPS limits
PTS supports stress testing with the native JMeter engine, which lets you reuse existing JMeter scripts. By default, the JMeter engine runs tests in concurrent mode. The RPS is determined by the concurrency and the server response time. If the concurrency is too low, the target RPS may not be reached. If the concurrency is too high, the excessive load may crash the server. To prevent a server crash, you can use the JMeter Constant Throughput Timer component to limit the maximum RPS.
You can add a Constant Throughput Timer node under a thread group in your JMeter script to limit the RPS generated by that thread group.
Notes
Note the following when you configure the Constant Throughput Timer node:
Set Calculate Throughput based on to this thread only. This setting limits the throughput for each thread. PTS allocates multiple JMeter engines based on the scenario's concurrency. The other options limit only a single engine and therefore cannot effectively control the global RPS. By limiting each thread, you can control the total RPS by adjusting the overall concurrency.
The Target throughput for the Constant Throughput Timer is configured in requests per minute. To convert an RPS value to requests per minute, multiply the RPS value by 60. You can use the __jexl3 function for the calculation. For example, if the target RPS for a single thread is
0.5, set Target throughput to${__jexl3(0.5 * 60)}. To set a global RPS limit, you can determine the required single-thread RPS limit by dividing the desired global limit by the total concurrency.
The following figure shows a configuration example:
Controlling RPS in JMeter is complex because it requires setting a proper concurrency, and you cannot adjust the concurrency in real time. As a result, you may not achieve the desired RPS. For stress testing in RPS mode, we recommend using native PTS scenarios. They support direct RPS settings and adjustments in seconds, so you do not need to manage concurrency. For more information, see Stress model.