EventLoop and http module relation

Is k6/http module’s requests blocks the EvenLoop? For example is a function scheduled with RegisterCallback (or with xk6-timers) will able to run while k6 executes http requests?
FYI @mstoykov (I’m happy to see that there is an experimental event loop support, we had a talk about it 1-2 years ago related to xk6-mock module)

Hi @szkiba,

Is k6/http module’s requests blocks the EvenLoop?

the not asyncRequest methods - yes.

As explained in Detect mixing of asynchronous and synchronous code and warn about it · Issue #2967 · grafana/k6 · GitHub this is not great, and we would likely want to warn users on using synchronus calls in async contexts, which seems like the only viable option.

When that will be worked on and what the exact behaviour will be is not yet decided. Either way you are welcome to comment on that issue with ideas or opinions.

Hope this helps you!

1 Like

Hi @mstoykov ,

Thank you, it was my guess based on source code but it is better to have an answer from you :slight_smile:
I’ll thinking about this topic (mixing sync and async calls), but my first thought that your estimation is optimistic regarding how long users will be using sync API.

1 Like