https://kotlinlang.org logo
Title
o

orangy

01/08/2018, 10:50 AM
What’s the default size for threading groups in your fav framework? Netty sets CPU*2. Jetty sets min(8), max(200). Undertow sets IO threads to #CPU, worker threads to #CPU*8. What do you use? Why?
d

dave08

01/11/2018, 4:05 AM
In vert.x there's an event loop that I think uses #CPUs only, and has a thread pool for wokers. That works because all the apis are async, so most things are done straight in the event loop, so that's great... I'm understanding from your question that ktor uses the underlying framework theead group... I think that it really depends on whether ktor is a 'reactive' type framework (with a non-blocking eventloop like nodejs or vert.x) or a regular one.. I think there are so many regular frameworks out there sparkjava, http4k... but ktor sticks out as a light weight reactive, nodejs or vert.x in kotlin...
Also vert.x never runs one verticle in more than one thread, so one has to scale a verticle for another instance to be used on antoher thread, and a request is 'sticky' in the sense that it'll only ever get handled by the same instance. That avoid concurrency problems in the scope of the verticle.. but people using an orchestrator like docker swarm or kubernetes, are not scaling microservices using vert.x, so it might be reasonable to confine one ktor instance to one thread, add have a possibility of using worker threads w/ coroutines, then, if scaling is done, each docker container running on the server will mainly be using one core But that's how I see things, that ktor is nicely eligable to eventually inherit the 'reactive' badge, but we still need async db, file access etc...