From Java to Kotlin: migrating microservices at Grindr

Migrating from Java to Kotlin, Grindr's journey to microservices architecture and the benefits of Kotlin, including functional error handling, immutability, and concurrency, improved API call latency and enhanced Android development.

Key takeaways

1. Avoid monolithic architecture

  • Grindr’s journey from a Java monolith to microservices using Kotlin.
  • Start with a small service and gradually split it out.

2. Less typing with Kotlin

  • Kotlin has nice wrappers for things that require less typing.
  • System.out.println has a wrapper for example.

3. Switching from Java to Kotlin

  • Learning to write Kotlin code was a challenge.
  • It’s not always easy to take a temperature from the team.

4. Benefits of Kotlin

  • Lot of nice features, like functional error handling.
  • Immutability is easier with Kotlin.

5. Improper handling of exceptions in Java

  • Grindr had to deal with null pointer exceptions and brittle exception management.

6. Less off-the-shelf libraries

  • Writing custom libraries and utilities is more common with Kotlin.
  • Sam, a developer on the team, is prolific in creating and sharing Kotlin libraries.

7. Microservices increased complexity

  • With 200 services, added complexity, but benefits outweigh the pain.
  • Concurrency is core to the language, which is good for microservices.

8. Migrating to Kotlin

  • Learned to write Kotlin code, but still struggled sometimes.
  • Point at which Grindr started migrating to Kotlin was 2020.

9. API call latency reduced

  • API call latency between services improved with the new services.
  • New services are smaller and faster, reducing overall latency.

10. Kotlin for Android development

  • Kotlin is the preferred language for Android development, and Grindr’s Android team uses it.

11. AWS support for Kotlin

  • Grindr’s services run in Docker containers, with no issues in terms of AWS support for Kotlin.

12. Immutability and concurrency

  • Immutability is a benefit of Kotlin, making it easier to write concurrent code.