Speakers list agenda

Concurrency made easy with Kotlin Coroutines

13:00 - 13:40, 7th of October (Friday) 2022/ ADVANCED DEV RED

Have you ever tried creating a multithreaded service capable of handling all your requests simultaneously, but ended up juggling threads and threadpools, ultimately wondering whether it was worth it in the end? Writing asynchronous or concurrent code has always been notoriously hard. It is difficult to reason about the execution of the code, and requires a lot of boilerplate. Luckily, there is an easier way! Coroutines provide a more intuitive way of writing code that can perform several tasks at once, without the usual hassle of dealing with blocking threads and threadpools.

In this talk, I will introduce you to Kotlin Coroutines, a library for writing asynchronous code, from JetBrains. The concept of suspending functions is explained, and you will get a firm grasp of what you can do with coroutines and why you should use them, but more importantly how to use them the way they are intended. You will also learn why it is possible to run thousands of coroutines simultaneously, without creating as many threads!

Furthermore, the concept of non-blocking I/O will be explained by supplying an example project of a fully reactive web application implemented using Spring WebFlux and R2DBC, where coroutines are used as the 'glue' inbetween, with as little boilerplate code as possible.

LEVEL:
Basic Advanced Expert
TRACK:
Programming
TOPICS:
Backend Kotlin

Riccardo Lippolis

JDriven BV