How to add parameters for max queries for period time in ms?

I would like to test my endpoint api, that has request limit:
max amount of request is 3 and can be made by 1000 ms.

How can I simulate it with K6?

Hi @Dimon

Welcome to the community forums :wave:

If I understand correctly, you are looking to test an API endpoint that will accept a maximum of 3 requests per second. Is that correct?

If that is the case, have you had a look at the API load testing guide? There is a section that explains how to use a constant-arrival-rate executor to simulate a constant rate. This should help you out.

We also have a bit more content under k6-learn that might be useful. I would suggest to just use the right amount of preAllocatedVUs to reach your desired rate (3 iterations/second?). And leave maxVUs with the default value (preAllocatedVUs). In this way the test starts with the desired rate already, with no need to ramp up.

I hope this helps.

Cheers!