SlideShare a Scribd company logo
1 of 41
Download to read offline
Björn Wendland
Migrating our micro services from
Java to Kotlin
Backend
Migrating our micro services from
Java to Kotlin - yet another awesome
journey
3
Introduction
What is this Talk NOT about?
4
▪ Teaching Kotlin
▪ Best practices for migrating Java to Kotlin
▪ Best practices for implementing coroutines
What is this Talk about?
▪ Sharing our experiences
▪ Differences between Java and Kotlin
▪ Sharing what we do at METRONOM
5
6
The Migration Story
Our technology stack
7
Gradle
Kotlin
Spring Boot
Postgres
Docker (Kubernetes)
Gitlab CI/CD
Grafana
Why we migrated from Java to Kotlin
▪ Self-perception as driver in technology
▪ Controversial design of Java
▪ Kotlin as officially supported language for Android
8
How we migrated
▪ Partially migrated classes
▪ Kotlin and Java side by side
▪ Migrated corresponding tests
▪ Migration of libraries
9
Migrating to native libraries
10
▪ No need to force migration
▪ Less matured
▪ Less documented
▪ KTOR – asynchronous Web framework
▪ Spring Boot as an established and reliable framework
11
Java or Kotlin
Controversial Java features
▪ Checked exceptions
▪ SAM-Types
▪ Wildcard-Types
12
Checked exceptions
13
SAM-Types
14
Wildcard-Types
15
Important new Kotlin features
▪ Null-safety
▪ Extension functions
▪ Smart casts
▪ Data classes
▪ Coroutines
16
▪ (now stable !)
Null-safety
17
Extension functions
18
Data classes
19
Smart casts
20
22
Coroutines
Coroutines and Threads
23
Coroutine
▪ Asynchronous execution
▪ Programmer scheduled
▪ Typically single thread
▪ Lightweight
Thread
▪ Asynchronous execution
▪ Operating system scheduled
▪ Heavyweight
Sequential
24
Step 1 Step 2 Step 3
Thread - Parallel
25
Part 1
Part 2
Part 3
Coroutine – Concurrent
26
Part 1 Part 2 Part 3
Enabling Coroutines on the JVM
27
▪ Modified JVM
▪ Modified bytecode
▪ Platform-specific JNI mechanisms
▪ Thread abstractions
Callbacks
▪ Passing executable code as argument
▪ Less readable with each call
Reactive Code
▪ Oriented around data flows
▪ Automatically propagate changes
Kotlin's Coroutines
▪ Based on suspending functions
▪ Dispatched using launch wrapper
▪ Async functions returning deferred result when calling await()
31
The Migration Story
Emulating a sync endpoint using coroutines
32
▪ Remove redundant codebase
▪ Remove old synchronous service
▪ Reuse existing codebase
Migration Challenges
37
▪ First team to introduce Kotlin
▪ Learning a new language’s concepts
▪ Introducing native Kotlin frameworks
Ongoing Challenges
38
▪ Java is the most popular backend language
▪ Little documentation for native frameworks
▪ Find new developers open to learn new technologies
▪ Sharing our experience with others
39
Review and Outlook
Review
40
▪ Migrating was worth the effort
▪ Kotlin will stay
▪ Number of new features can be overwhelming
▪ Coroutines are a more complex feature of Kotlin
Outlook
41
▪ RabbitMQ as queueing solution
▪ Spiking Blockchain as possible Storage Solution
▪ Automated Service Setup using Ansible / Puppet
▪ Share our experience with others
Thank you for
your attention!
Björn Wendland
42

More Related Content

What's hot

HKG15-506: Comcast - Lessons learned from migrating the RDK code base to the ...
HKG15-506: Comcast - Lessons learned from migrating the RDK code base to the ...HKG15-506: Comcast - Lessons learned from migrating the RDK code base to the ...
HKG15-506: Comcast - Lessons learned from migrating the RDK code base to the ...
Linaro
 

What's hot (20)

Kong API
Kong APIKong API
Kong API
 
Introduction to Kong API Gateway
Introduction to Kong API GatewayIntroduction to Kong API Gateway
Introduction to Kong API Gateway
 
Optimizing Java Notes
Optimizing Java NotesOptimizing Java Notes
Optimizing Java Notes
 
Introduction to GraalVM
Introduction to GraalVMIntroduction to GraalVM
Introduction to GraalVM
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
 
API Gateway study
API Gateway studyAPI Gateway study
API Gateway study
 
Kubernetes Logging
Kubernetes LoggingKubernetes Logging
Kubernetes Logging
 
Fast Deployments to Multiple Golang Lambda Functions
Fast Deployments to Multiple Golang Lambda FunctionsFast Deployments to Multiple Golang Lambda Functions
Fast Deployments to Multiple Golang Lambda Functions
 
Introduction to Kotlin coroutines
Introduction to Kotlin coroutinesIntroduction to Kotlin coroutines
Introduction to Kotlin coroutines
 
Building Language Agnostic APIs with gRPC - JavaDay Istanbul 2017
Building Language Agnostic APIs with gRPC - JavaDay Istanbul 2017Building Language Agnostic APIs with gRPC - JavaDay Istanbul 2017
Building Language Agnostic APIs with gRPC - JavaDay Istanbul 2017
 
S3 Group on Code Management - RDK Users Conference 2014
S3 Group on Code Management - RDK Users Conference 2014S3 Group on Code Management - RDK Users Conference 2014
S3 Group on Code Management - RDK Users Conference 2014
 
HKG15-506: Comcast - Lessons learned from migrating the RDK code base to the ...
HKG15-506: Comcast - Lessons learned from migrating the RDK code base to the ...HKG15-506: Comcast - Lessons learned from migrating the RDK code base to the ...
HKG15-506: Comcast - Lessons learned from migrating the RDK code base to the ...
 
KFServing and Feast
KFServing and FeastKFServing and Feast
KFServing and Feast
 
WebLogic Event Server - Alexandre Alves, BEA
WebLogic Event Server - Alexandre Alves, BEAWebLogic Event Server - Alexandre Alves, BEA
WebLogic Event Server - Alexandre Alves, BEA
 
Serverless Architecture
Serverless ArchitectureServerless Architecture
Serverless Architecture
 
Kotlin REST & GraphQL API
Kotlin REST & GraphQL APIKotlin REST & GraphQL API
Kotlin REST & GraphQL API
 
APIdays Singapore 2019 - Blowing Up the Monolith: Adopting a Modern API Strat...
APIdays Singapore 2019 - Blowing Up the Monolith: Adopting a Modern API Strat...APIdays Singapore 2019 - Blowing Up the Monolith: Adopting a Modern API Strat...
APIdays Singapore 2019 - Blowing Up the Monolith: Adopting a Modern API Strat...
 
Ozone-Wayland Support in Chromium (GENIVI 13th All Member Meeting & AMM Open ...
Ozone-Wayland Support in Chromium (GENIVI 13th All Member Meeting & AMM Open ...Ozone-Wayland Support in Chromium (GENIVI 13th All Member Meeting & AMM Open ...
Ozone-Wayland Support in Chromium (GENIVI 13th All Member Meeting & AMM Open ...
 
Introduction to Bitcoin's Scripting Language
Introduction to Bitcoin's Scripting LanguageIntroduction to Bitcoin's Scripting Language
Introduction to Bitcoin's Scripting Language
 
Kubeflow Control Plane 中文
Kubeflow Control Plane 中文Kubeflow Control Plane 中文
Kubeflow Control Plane 中文
 

Similar to Migrating our micro services from Java to Kotlin (Code.Talks 2018)

NA Developer Day - Taking your COBOL apps to Net & JVM
NA Developer Day - Taking your COBOL apps to Net & JVM NA Developer Day - Taking your COBOL apps to Net & JVM
NA Developer Day - Taking your COBOL apps to Net & JVM
Micro Focus
 

Similar to Migrating our micro services from Java to Kotlin (Code.Talks 2018) (20)

Kotlin Online Training.pdf
Kotlin Online Training.pdfKotlin Online Training.pdf
Kotlin Online Training.pdf
 
Kotlin Online Training.pdf
Kotlin Online Training.pdfKotlin Online Training.pdf
Kotlin Online Training.pdf
 
Kotlin Online Training.pdf
Kotlin Online Training.pdfKotlin Online Training.pdf
Kotlin Online Training.pdf
 
Kotlin Online Training.pdf
Kotlin Online Training.pdfKotlin Online Training.pdf
Kotlin Online Training.pdf
 
Kotlin Online Training.pdf
Kotlin Online Training.pdfKotlin Online Training.pdf
Kotlin Online Training.pdf
 
Kotlin Online Training.pdf
Kotlin Online Training.pdfKotlin Online Training.pdf
Kotlin Online Training.pdf
 
Kotlin Online Training.pdf
Kotlin Online Training.pdfKotlin Online Training.pdf
Kotlin Online Training.pdf
 
Kotlin Online Training.pdf
Kotlin Online Training.pdfKotlin Online Training.pdf
Kotlin Online Training.pdf
 
Kotlin Online Training.pdf
Kotlin Online Training.pdfKotlin Online Training.pdf
Kotlin Online Training.pdf
 
Kotlin Online Training.pdf
Kotlin Online Training.pdfKotlin Online Training.pdf
Kotlin Online Training.pdf
 
Kotlin Online Training.pdf
Kotlin Online Training.pdfKotlin Online Training.pdf
Kotlin Online Training.pdf
 
WebLogic and GraalVM
WebLogic and GraalVMWebLogic and GraalVM
WebLogic and GraalVM
 
2014 11-05 hpcac-kniep_christian_dockermpi
2014 11-05 hpcac-kniep_christian_dockermpi2014 11-05 hpcac-kniep_christian_dockermpi
2014 11-05 hpcac-kniep_christian_dockermpi
 
Magnum Networking Update
Magnum Networking UpdateMagnum Networking Update
Magnum Networking Update
 
Flink Forward Berlin 2017: Patrick Lucas - Flink in Containerland
Flink Forward Berlin 2017: Patrick Lucas - Flink in ContainerlandFlink Forward Berlin 2017: Patrick Lucas - Flink in Containerland
Flink Forward Berlin 2017: Patrick Lucas - Flink in Containerland
 
NA Developer Day - Taking your COBOL apps to Net & JVM
NA Developer Day - Taking your COBOL apps to Net & JVM NA Developer Day - Taking your COBOL apps to Net & JVM
NA Developer Day - Taking your COBOL apps to Net & JVM
 
Migrating from oracle soa suite to microservices on kubernetes
Migrating from oracle soa suite to microservices on kubernetesMigrating from oracle soa suite to microservices on kubernetes
Migrating from oracle soa suite to microservices on kubernetes
 
Cloud Native Compiler
Cloud Native CompilerCloud Native Compiler
Cloud Native Compiler
 
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, AzulBetter Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
 
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, AzulBetter Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 

Migrating our micro services from Java to Kotlin (Code.Talks 2018)