Coroutines, and how they are lighter than threads using internal state-storing magic, sound very cool – and perfect for an ultra lightweight high performance web server.
Has anyone seen an attempt to do this? It would have to be pretty ground-up: using coroutines to service requests inside the minimal com.sun.net.httpserver wouldn’t (AFAIK) be enough, because the outside web serving wrapper would still use threads behind the Handler.
vert.x is a bit more than a web server, so to implement a only a web server it could be too much.
What about creating a Kotlin layer on top of Grizzly? Grizzyl is a slim, mature high-performance asynchronous server. It could be a solid base for a “Kotlin” server.
However implementing something like Grizzly from scratch in Kotlin with coroutines could be an interesting excercise, although it would be reinventing the wheel …
IF coroutines are all that and a bag of chips, then can anyone create an example that shows off in a real-world scenario just how much better they are? The docs page gives an entirely reasonable “sum up numbers” to show how they beat threads w/r/t memory overhead and some other aspects, but it feels like they are presented as so much better that a more complex example would really show off their potential.
eg. “Look how this 40 line game server can scale to thousands of parallel connections” sort of thing.