3

Are k6 http calls asynchronous? When I execute a call like http.get(url, params) is k6 waiting until the response?

If it is asynchronous and let's say I'm executing few calls and I want the response of a one call as the parameter to another call. How can I wait before executing the 2nd call until the response is returned from 1st one?

Sandeepa
  • 3,457
  • 5
  • 25
  • 41

1 Answers1

3

Fortunately, k6 currently does not support asynchronous, or more generally, event loop.

You can read here for more details about how script execution.

Note

We have plan to support event loop, but I can't tell you now when it will happen.

cuonglm
  • 2,766
  • 1
  • 22
  • 33
  • How does it works with a batch call? if I execute 5 requests as a batch and then execute another call after that, is that 2nd call is waiting until all the responses retrieving in the batch? – Sandeepa Oct 16 '19 at 10:25
  • 1
    No, in batch mode, all requests are made parallel – cuonglm Oct 16 '19 at 12:09
  • True. Calls inside the batch are made parallel. I meant if I execute a post call after a batch call, is that post call waiting until all the responses from batch call is retrieving? – Sandeepa Oct 16 '19 at 13:23
  • 1
    @Sand Yes, consequent calls are synchronous. – cuonglm Oct 17 '19 at 03:20
  • 1
    The answer was edited, to change the first word to `Fortunately`, why is that? Are async bad ? – Hamza Ince Jun 22 '22 at 07:42