How does ktor with Native embeddedServer CIO engine handle connections with zero length data? Does it automatically disconnect? I am having a somewhat odd memory allocation experience on a vm instance with limited resources, where these connections never seem to be freed.
This is without basically any real requests, just empty connections
Joakim Forslund
10/18/2022, 7:44 AM
Dependencies for linux:
ktor-server-core - 2.1.2 (also tested with 2.1.3-eap-521)
ktor-server-cio - 2.1.2 (also tested with 2.1.3-eap-521)
kotlinx-coroutines-core - 1.6.4
all of this is running in a docker container with a load balancer in front
Joakim Forslund
10/18/2022, 7:50 AM
Compared to if I roll a test http server built with zeromq that has the socket handler which just disconnects zero length data and give back a real http response if the data contains a proper http request (Comparing coroutines io vs classic blocking is not fair, but my hope is that it proves a point)
Joakim Forslund
10/18/2022, 12:22 PM
Copy code
data class Simple(val name:String, val nr:Int, val lnr2:Long, val status:Boolean)
fun main() {
println("Trying to start server")
val simple = Simple("Ape", 0, 1L, true)
embeddedServer(CIO, port = 7878) {
install(ContentNegotiation) {
json(Json {
prettyPrint = true
isLenient = true
})
}
routing {
get("/status") {
call.respond(HttpStatusCode.OK, simple)
}
}
}.start(wait = true)
}