Ktor: Difference between engines

Hello, I’m starting to add Ktor versus Retrofit/Spring in my projects and there is an overwhelming abundance of engines available: Engines | Ktor
What is the principal difference between them, which are the most promising and which are the legacy?
Should I use Curl engine if my app runs on Linux x64 or CIO is the universal fits-for-all engine, so there is no need to scatter the resources if I need to implement Ktor both on the server side and in an Android app?

1 Like

First of all, you are mixing server engines and client engines. Curl is client, while the link you presented leads to servers. As for server engines, the primary ones are netty - and it is your default choice since it is a well established technology and cio which is developed fully by ktor team. The last one is not yet as stable, but probably have more perspectives in future because it is kotlin-first (could be implemented in multiplatform) and uses coroutines in its core.


Thanks. Also I don’t understand CIO: I can’t run the request within coroutineScope but can within runBlocking context. Maybe I don’t understood something else, but what does the “coroutine-based engine” mean?

The API is exactly the same for netty and cio. The difference is inside. And in order to run something suspended, you need to be in suspended world. So either use runBlocking or launch.

1 Like

According to this issue https://youtrack.jetbrains.com/issue/KTOR-889
Currently the only option that seems to work with GraalVM is CIO (Without logging)”.
So, if you want/need to run on GraalVM you must use CIO.