runBlocking() is a special case. It uses a custom dispatcher which runs coroutines on the calling thread. So I wouldn’t call that “default behavior” for coroutines. For pretty much every other coroutine creator, if you don’t specify a dispatcher then
Dispatchers.Default is used.
This discussion was super helpful. I just wanted to follow up with what we ended up doing.
Since we use Vert.x, we decided to follow its idiomatic approach and “launch” everything on the event loop thread. So this is basically a thread pool of one, the only thread being the event loop. Vert.x provides the coroutine dispatcher, and then you basically forget that you’re in Vert.x and write standard Kotlin coroutines. It’s magic!
For MySQL blocking calls, we dispatch them to
Dispatchers.IO pool. We made some primitives to prevent developers from running blocks of code on the other threads.