8000 Should long-running I/O operations be offloaded from Netty event loop threads in Ktor applications? · ktorio ktor · Discussion #4790 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Should long-running I/O operations be offloaded from Netty event loop threads in Ktor applications? #4790

Answered by bjhham
arifterzioglu asked this question in Q&A
Discussion options

You must be logged in to vote

Hey, apologies for the lag, I haven't been watching the discussions.

  1. Is this understanding correct — that even suspending functions (e.g., API or DB calls) should be moved to Dispatchers.IO to avoid tying up Netty threads?

It depends on the task. Suspend functions and async I/O generally won't block the underlying threads and cause problems, but you can still assert more control over the execution of different kinds of tasks when you use a different dispatcher.

  1. Are there any cases where it’s safe to run I/O-bound suspend functions on the default Netty coroutine dispatcher?

We actually made a recent change that prevents launching coroutines on the Netty dispatcher, so you can safel…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@arifterzioglu
Comment options

Answer selected by bjhham
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
0