Part 9 · 1 chapters · ~8 min

In Production: What Kotlin Is Paired With

Deploying Kotlin services on the JVM in containers, JVM flags for containers, Ktor or Spring Boot behind ingress and service meshes, HikariCP and PgBouncer, Kafka and RabbitMQ from Kotlin, OpenTelemetry with coroutine context, GraalVM native images for fast startup, Kotlin on Android, and Kotlin Multiplatform for sharing code with mobile.

10

Same JVM stack, Kotlin on top

code
# Dockerfile: a Ktor fat jar on a slim JRE
FROM eclipse-temurin:21-jre
COPY build/libs/ledger-all.jar /app/app.jar
ENTRYPOINT ["java", "-XX:MaxRAMPercentage=75", "-javaagent:/otel/opentelemetry-javaagent.jar", "-jar", "/app/app.jar"]

// coroutine-aware tracing context
withContext(Dispatchers.IO + Context.current().asContextElement()) { repo.save(transfer) }

// Kotlin Multiplatform: one money module for Android, iOS and the server
// shared/src/commonMain/kotlin/Money.kt
expect fun formatNaira(kobo: Long): String

Kotlin is paired with exactly what Java is paired with (Java course P10: Spring Cloud, sidecars, Kafka, observability) because it is the same runtime. The Kotlin-specific additions are coroutine-aware libraries (Ktor, Exposed, kotlinx.serialization) and sharing code with mobile.

IN PRODUCTION: WHAT KOTLIN IS PAIRED WITH
paired like Java, with Kotlin-native options
load balancer / ingressTLS, routingKtor or Spring Booton JVM 21+ (or GraalVM native)sidecarsEnvoy / service mesh, as in the Java courseKafka, RabbitMQevent streams, jobsPostgres + HikariCP (+ PgBouncer)Exposed, jOOQ, JPAOpenTelemetry Java agenttraces, metrics, logs
swipe the figure sideways, or tap expand for full screen
1/4
the JVM stack
Kotlin services deploy exactly like Java ones: containers with a JVM, Kubernetes, sidecars and service meshes, and Spring Cloud where Spring is used (Java course P10).
paired like JavaJava course P10