Asynchronous API calls in K6

Hello All,
Number of VU’s – 100
Time span of the test – 1 hour
Number of endpoints I am hitting – 5
A virtual user should hit endpoint 1 – every 2 minutes
A virtual user should hit endpoint 2 – every 5 minutes
A virtual user should hit endpoint 3 – every 60 seconds
A virtual user should hit endpoint 4 – every 2 minutes
A virtual user should hit endpoint 5 – every 3 minutes
The way I have designed my test is I have added “Sleep” in all 5 scripts (one each for a endpoint). With this design, if a virtual user hits an endpoint, its going to sleep mode for the given amount of time.
What should I do to do this asynchronously?
Example – If a VU hits Endpoint 1, it should not hit it again for 2 minutes but should hit other endpoints.
Please Help. I am struck on how to implement this.

Hi @amruth.chintha,

I recommend you to have a look at @mstoykov’s answer to this question:

Can one K6 Virtual User send two requests asynchronously?

1 Like