Does anayone has experience with building a Ktor client in Kotlin in regard to the possibilities and limitations?
a
Alex Williams
01/09/2020, 12:17 AM
Hey, I just joined, but I've had experience with this. We have a ktor app in heavy use, and it's definitely different from anything that came before.
Possibilities are quite fun - mostly as every part of the call is asynchronous, which can be useful if you're interacting with other services as part of the call. It's also growing a nice library of plugins (e.g. it exports metrics with dropwizard, but we found that writing a Prometheus plugin was quite painless.) Comparing to an equivalent spring boot app, it starts up far faster (100s of milliseconds) and has at least comparable throughput.
Limitations are also interesting - reauest-scoped actions are no longer thread-scoped, as it uses coroutines, so things that depend on thread local context like logging (e.g. if you inject tracing headers and expect these to populate the loggers MDC) may behave slightly differently.
Is say it's been an overall positive experience.