We're finding that slow HTTP POSTs into Ktor can b...
# ktor
m
We're finding that slow HTTP POSTs into Ktor can block the server from responding to other connections until that request completes. Is that expected?
r
You should not block the thread in the request processing code.
Use
withContext(<http://Dispatchers.IO|Dispatchers.IO>)
if your code is blocking.
m
It blocks in Ktor code, e.g.:
Copy code
post("/login") {
            val credentials = call.receive<Credentials>()
            call.respond(credentials)
        }
r
Any idea why this POST request is slow?
m
We encounter it in our live web app, we haven't figured out exactly why it happens there, but we've can reproduce with slow POSTs manually with
telnet
r
From what I understand it looks like a bug. Try filling an issue with ktor.
m