https://kotlinlang.org logo
#ktor
Title
# ktor
n

nilTheDev

10/09/2021, 5:02 PM
I am confused between the server engines that are available in Ktor. Netty seems the default choice but CIO is something that uses coroutines in its core. Should I use CIO? Would there be any API level difference? I mean the way I use Ktor? What would be some benefits that I can get by choosing CIO over Netty?
b

Big Chungus

10/09/2021, 5:28 PM
Engines are well hidden from api surface and are interchangeable. Think of them like batteries for your tv remote - brand makes no difference for general use, bur Duracell might last longer
n

nilTheDev

10/09/2021, 5:47 PM
@Big Chungus What would you use? I think CIO seems a pretty solid choice given that it is developed by the Ktor team and uses coroutines. Would there be any disadvantages if I chose CIO?
b

Big Chungus

10/09/2021, 5:50 PM
CIO is still considered experimental I think and is not recommended for production. I personally use CIO for all my pet project to help find and report issue as it'll be the one that eventually unlocks mpp ktor server
1
🙏 1
But for jvm, definitely use other, older servers that are much more mature
However to be fair I haven't had any issues with CIO in the past 3 years...
But you can go with CIO initially and just swap the engine if you hit a wall
That's what's so nice about ktor's architecture
i

ian.shaun.thomas

10/09/2021, 6:03 PM
I use cio in my "pet projects" too. It's worked well for me as well.
c

christophsturm

10/11/2021, 9:05 AM
of the engines that ktor supports i would probably use jetty or netty. imo the 2 fastests http servers for the jvm are undertow and vertx, and both are currently not supported by ktor