Using locust load testing framework I need to call a single HTTP GET API with given pre defined rate and the through put should be always given requests per second rate. But according to the below example the RPS is changing every time due to the API response time. How can I achieve this using locust load testing.
As an example I want to call below "/hello" API with 50 requests per second constantly
from locust import HttpUser, task
class HelloWorldUser(HttpUser):
@task
def hello_world(self):
self.client.get("/hello")
Sounds like what you want is constant_pacing. This will make Locust attempt to run your task at the given rate regardless of how long it takes to execute. To hit your
/helloendpoint 50 times per second constantly, your code would look like:which would make Locust try to run your task every second. Then you run Locust and set the number of users to 50.