janvladimirmostert
11/28/2020, 9:42 AMval app = { request: Request ->
}
val server = app.asServer(Netty(9000)).start()
is the inside of that lambda a single thread or using some kind of event loop or is that server dependent?
when load testing (with Netty(9000)
), I'm seeing nioEventLoopGroup-2-1 and nioEventLoopGroup-3-1..24, I'm assuming those 25 threads are from Netty?
how would one execute suspendable functions (or even blocking functions) inside that lambda?
val app = { request: Request ->
GlobalScope.launch {
suspendableFunctionThatReturnsResponse()
}
}
val server = app.asServer(Netty(9000)).start() // obviously doesn't compile since that app lambda doesn't return a Response
s4nchez
11/28/2020, 11:14 AMs4nchez
11/28/2020, 11:15 AMjanvladimirmostert
11/28/2020, 11:16 AMval app = { request: Request ->
runBlocking {
GlobalScope.async {
delay(1000)
Response(OK).body("DONE!!")
}.await()
}
s4nchez
11/28/2020, 11:20 AMapp
is an HttpHandler
so it should work fine.s4nchez
11/28/2020, 11:21 AMHttpHandler
suspendable, on the other hand, would cause all sort of issues with both clients and server backends, and we just haven't seen a good reason to do it yet.janvladimirmostert
11/28/2020, 11:24 AMRazvan
12/02/2020, 6:57 PM