Recommended Coroutines based Web Stack and Best Practices

First of all, Thank you JetBrains and Community

I intend to use Kotlin as replacement for Go lang and specially its concurrency features like coroutines and taking advantages of Java based community libraries for low latency web services and big data computation pipelines.

What are the best practices if any to achieve optimum performance ?

Also, can anyone suggest a list of async libraries to make a coroutine based stack for following areas.

Web Framework - Is ktor good enough ?
File IO
http/tcp client
Jdbc driver
NoSql DB Drivers (MongoDB, Cassandra, Elastic Search, Kafka)

Is it okay to use async java library alternatives if Kotlin does not have one ? How much it can affect the resource utilization especially if you using async db drivers with their own thread pools (not coroutines) ?

2 Likes

Coroutines are still fairly new for Kotlin, so I’m not sure you’ll find an answer you’ll like yet :wink:

ktor is all done w/ coroutines, but might not have all the external features (e.g., google/facebook login if you do a web site w/ it) and I think there’s still an open JWT PR.

You can also look at Vert.x 3.5 which has added coroutine support for REST APIs.

For async DB drivers, I know Spring Reactive only supports Mongo, Cassandra, and Redis so those definitely have async drivers. Not sure about the others on your list…