Obliviate_hs
Obliviate_hs

Reputation: 13

How do I set a specify RPS in locust ? like 500 requests per seconds

I am new for locust. I have a CSV file which records the requests rate. And I want to sent a specify number of requests to a website according to the CSV file, like 500 requests per seconds, how can I do this?

Please help me about this problem, Thanks

Upvotes: 1

Views: 9514

Answers (1)

Solowalker
Solowalker

Reputation: 2866

Sounds like what would be best for you is a Custom Load Shape. You can specify in code how many users get spawned at any given time during your test. You could read the values from your CSV and then set the user count and spawn rate appropriately.

http://docs.locust.io/en/stable/custom-load-shape.html

EDIT:

A Custom Load Shape lets you control the spawned number of users in code, but if you want to ensure you're getting a certain amount of Requests Per Second (RPS), that's going to be up to how you write your code. The code your Locust users runs needs to be written in such a way that each user is only making one request. Then in your Locust User class, you set wait_time = constant(1) or wait_time = constant_pacing(1), whichever behavior you want.

http://docs.locust.io/en/stable/api.html?highlight=wait_time#locust.wait_time.constant

You can see this sort of pattern in all of the code examples for custom shapes.

Upvotes: 4

Related Questions