SlideShare a Scribd company logo
1 of 29
Lean microservices through
ahead of time compilation
Wednesday, 5th August, 2020
Tobias Piper
Tobias Piper
● Senior Software Engineer at
loveholidays.com
● Book Team
○ Responsible for booking and post-
book systems
○ Integration of payment suppliers
● Services in K8 in GCP
Application startup time
improvements
Startup time of a service
Application startup can be an essential performance indicator for a service
- Highly volatile load - scaling up and down frequently
- Inconsistent latency / throughput caused by slow starting service
- Short running (cron)jobs
- Pipelines of services
Build fast starting microservices
What slows down application startup
- Component loading
- Component initialization
The more luggage you bring, the slower you get
- Backend (e.g. DB) connections
- Custom initialization code
Quick JVM 101
Quick JVM 101
Quick JVM 101
Runtime artifact contains:
- Full JVM
- Dependencies pulled in via build system
- Your code
Application startup is slowed down by:
- JIT compilation
- Class initialization
The more luggage you bring, the slower you get
Tree Shaking
Tree Shaking
Tree Shaking
Native images
Tree shaking on the JVM
Native images
or is it?
Native Image Creation with GraalVM
Tree Shaking for the JVM!
Resource Comparison
Resource usage
Resource usage
x 1000
Resource usage
~180GB memory required
-> 3x high-mem-8 = 192GB
3x $340 = $1020 per month
=> $255.06
1k instances: ~41GB memory required
-> 3x high-mem-2: 48GB
1k instances
-> 3x standard-4: 48GB
=> $379.5
Resource usage
Did we find a free lunch after all?
Caveats
Native Images are compiled for a target architecture and classes statically loaded at compile time
Static code analysis is quite slow, so bring some time
- you trade faster initialization at runtime for slower build time (seconds to minutes)
- Code inspection / tree shaking is CPU intensive, can your CI worker handle it in real time?
JVM provides dynamic features, which are hard to initialize statically e.g.
● Reflection (examine and manipulate your runtime)
● Dynamic Proxies (Used e.g. by some DI frameworks, like Spring)
● Interpretation for different architectures / environments
Workarounds exist to still allow native image generation
● Delaying class initialization
● Register classes requiring reflection
Configuring the native image build can be quite painful, especially when dealing with 3rd party
dependencies
Resources
● Github Repo with example
projects for a Quarkus native
image vs Spring Boot app
● GraalVM Docs
● Native Image creation
explained
● Tree shaking in the webpack
docs
Bonus Slides:
Resource Comparison
Don’t trust the marketing slide
Trying it out is more fun anyways
Code at: https://github.com/loveholidays/quarkus-demo
Frameworks used for comparison
- Spring Boot
- Quarkus
- Quarkus - Native image
$ java -version
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02)
OpenJDK 64-Bit Server VM GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02, mixed mode, sharing)
Let’s try it out - Spring Boot
$ java -jar boot-demo/build/libs/demo-0.0.1-SNAPSHOT.jar
. ____ _ __ _ _
/ / ___'_ __ _ _(_)_ __ __ _    
( ( )___ | '_ | '_| | '_ / _` |    
/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |___, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.6.RELEASE)
.....
2020-05-06 16:04:20.200 INFO 1948140 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on
port(s): 8081 (http) with context path ''
2020-05-06 16:04:20.203 INFO 1948140 --- [ main] com.loveholidays.demo.DemoApplication : Started DemoApplication
in 6.073 seconds (JVM running for 6.994)
$ ps -au
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
toby 817339 12.1 4.1 9099040 676604 pts/2 Sl+ 09:41 0:14 java -jar boot-demo/build/libs/demo-0.0.1-SNAPSHOT.jar
$ time curl http://localhost:8081/foo
0.01s user 0.00s system 1% cpu 0.414 total
Let’s try it out - Quarkus JVM mode (uber-jar)
$ java -jar quarkus-demo/build/demo-1.0.0-SNAPSHOT-runner.jar
__ ____ __ _____ ___ __ ____ ______
--/ __ / / / / _ | / _ / //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ / 
--________/_/ |_/_/|_/_/|_|____/___/
2020-05-11 22:51:12,804 WARN [io.agr.pool] (main) Datasource '<default>': Driver does not support the provided URL:
jdbc:mysql:127.0.0.1:3306/test
2020-05-11 22:51:13,234 INFO [io.quarkus] (main) demo 1.0.0-SNAPSHOT (powered by Quarkus 1.4.2.Final) started in 1.703s.
Listening on: http://0.0.0.0:8080
2020-05-11 22:51:13,236 INFO [io.quarkus] (main) Profile prod activated.
2020-05-11 22:51:13,236 INFO [io.quarkus] (main) Installed features: [agroal, cdi, hibernate-orm, hibernate-orm-panache,
jdbc-mysql, narayana-jta, resteasy, resteasy-jsonb]
$ ps -au
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
toby 816802 2.8 2.2 9005840 364772 pts/3 Sl+ 09:41 0:03 java -jar quarkus-demo/build/demo-1.0.0-SN...jar
$ time curl http://localhost:8080/foo
0.01s user 0.01s system 16% cpu 0.100 total
Let’s try it out - Quarkus native mode
$ quarkus-demo/build/demo-1.0.0-SNAPSHOT-runner
__ ____ __ _____ ___ __ ____ ______
--/ __ / / / / _ | / _ / //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ / 
--________/_/ |_/_/|_/_/|_|____/___/
2020-05-11 22:23:53,093 INFO [io.quarkus] (main) demo 1.0.0-SNAPSHOT (powered by Quarkus 1.4.2.Final) started in 0.049s.
Listening on: http://0.0.0.0:8080
2020-05-11 22:23:53,093 INFO [io.quarkus] (main) Profile prod activated.
2020-05-11 22:23:53,094 INFO [io.quarkus] (main) Installed features: [agroal, cdi, hibernate-orm, hibernate-orm-panache,
jdbc-mysql, narayana-jta, resteasy, resteasy-jsonb]
$ ps -au
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
toby 893179 0.1 0.2 1737672 44416 pts/0 Sl+ 09:46 0:00 ./demo-1.0.0-SNAPSHOT-runner
$ time curl http://localhost:8080/foo
0.01s user 0.01s system 2% cpu 0.759 total

More Related Content

What's hot

douban happyday docker for daeqaci
douban happyday docker for daeqacidouban happyday docker for daeqaci
douban happyday docker for daeqaciTianwei Liu
 
Java EE and NoSQL using JBoss EAP 7 and OpenShift
Java EE and NoSQL using JBoss EAP 7 and OpenShiftJava EE and NoSQL using JBoss EAP 7 and OpenShift
Java EE and NoSQL using JBoss EAP 7 and OpenShiftArun Gupta
 
Building a DevOps pipeline for Serverless by using Mocha, GitHub and Travis
Building a DevOps pipeline for Serverless by using Mocha, GitHub and TravisBuilding a DevOps pipeline for Serverless by using Mocha, GitHub and Travis
Building a DevOps pipeline for Serverless by using Mocha, GitHub and TravisExove
 
Wordpress optimization
Wordpress optimizationWordpress optimization
Wordpress optimizationAlmog Baku
 
Aem dispatcher – tips & tricks
Aem dispatcher – tips & tricksAem dispatcher – tips & tricks
Aem dispatcher – tips & tricksAshokkumar T A
 
Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013Matt Raible
 
Webcenter application performance tuning guide
Webcenter application performance tuning guideWebcenter application performance tuning guide
Webcenter application performance tuning guideVinay Kumar
 
Java MySQL Connector & Connection Pool Features & Optimization
Java MySQL Connector & Connection Pool Features & OptimizationJava MySQL Connector & Connection Pool Features & Optimization
Java MySQL Connector & Connection Pool Features & OptimizationKenny Gryp
 
What's New in Postgres Plus Advanced Server 9.3
What's New in Postgres Plus Advanced Server 9.3What's New in Postgres Plus Advanced Server 9.3
What's New in Postgres Plus Advanced Server 9.3EDB
 
Docker, Kubernetes, and Mesos recipes for Java developers
Docker, Kubernetes, and Mesos recipes for Java developersDocker, Kubernetes, and Mesos recipes for Java developers
Docker, Kubernetes, and Mesos recipes for Java developersArun Gupta
 
Datasheet weblogic midvisionextensionforibmraf
Datasheet weblogic midvisionextensionforibmrafDatasheet weblogic midvisionextensionforibmraf
Datasheet weblogic midvisionextensionforibmrafMidVision
 
CIRCUIT 2015 - Monitoring AEM
CIRCUIT 2015 - Monitoring AEMCIRCUIT 2015 - Monitoring AEM
CIRCUIT 2015 - Monitoring AEMICF CIRCUIT
 
77739818 troubleshooting-web-logic-103
77739818 troubleshooting-web-logic-10377739818 troubleshooting-web-logic-103
77739818 troubleshooting-web-logic-103shashank_ibm
 
Was liberty at scale
Was liberty at scaleWas liberty at scale
Was liberty at scalesflynn073
 
Getting started with agile database migrations for java flywaydb
Getting started with agile database migrations for java flywaydbGetting started with agile database migrations for java flywaydb
Getting started with agile database migrations for java flywaydbGirish Bapat
 
WebLogic Server Work Managers and Overload Protection
WebLogic Server Work Managers and Overload ProtectionWebLogic Server Work Managers and Overload Protection
WebLogic Server Work Managers and Overload ProtectionJames Bayer
 

What's hot (20)

Aem maintenance
Aem maintenanceAem maintenance
Aem maintenance
 
douban happyday docker for daeqaci
douban happyday docker for daeqacidouban happyday docker for daeqaci
douban happyday docker for daeqaci
 
Java EE and NoSQL using JBoss EAP 7 and OpenShift
Java EE and NoSQL using JBoss EAP 7 and OpenShiftJava EE and NoSQL using JBoss EAP 7 and OpenShift
Java EE and NoSQL using JBoss EAP 7 and OpenShift
 
Building a DevOps pipeline for Serverless by using Mocha, GitHub and Travis
Building a DevOps pipeline for Serverless by using Mocha, GitHub and TravisBuilding a DevOps pipeline for Serverless by using Mocha, GitHub and Travis
Building a DevOps pipeline for Serverless by using Mocha, GitHub and Travis
 
Wordpress optimization
Wordpress optimizationWordpress optimization
Wordpress optimization
 
Aem dispatcher – tips & tricks
Aem dispatcher – tips & tricksAem dispatcher – tips & tricks
Aem dispatcher – tips & tricks
 
Development Tools - Maven
Development Tools - MavenDevelopment Tools - Maven
Development Tools - Maven
 
Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013
 
Maven tutorial for beginners
Maven tutorial for beginnersMaven tutorial for beginners
Maven tutorial for beginners
 
Webcenter application performance tuning guide
Webcenter application performance tuning guideWebcenter application performance tuning guide
Webcenter application performance tuning guide
 
Java one 2015 - v1
Java one   2015 - v1Java one   2015 - v1
Java one 2015 - v1
 
Java MySQL Connector & Connection Pool Features & Optimization
Java MySQL Connector & Connection Pool Features & OptimizationJava MySQL Connector & Connection Pool Features & Optimization
Java MySQL Connector & Connection Pool Features & Optimization
 
What's New in Postgres Plus Advanced Server 9.3
What's New in Postgres Plus Advanced Server 9.3What's New in Postgres Plus Advanced Server 9.3
What's New in Postgres Plus Advanced Server 9.3
 
Docker, Kubernetes, and Mesos recipes for Java developers
Docker, Kubernetes, and Mesos recipes for Java developersDocker, Kubernetes, and Mesos recipes for Java developers
Docker, Kubernetes, and Mesos recipes for Java developers
 
Datasheet weblogic midvisionextensionforibmraf
Datasheet weblogic midvisionextensionforibmrafDatasheet weblogic midvisionextensionforibmraf
Datasheet weblogic midvisionextensionforibmraf
 
CIRCUIT 2015 - Monitoring AEM
CIRCUIT 2015 - Monitoring AEMCIRCUIT 2015 - Monitoring AEM
CIRCUIT 2015 - Monitoring AEM
 
77739818 troubleshooting-web-logic-103
77739818 troubleshooting-web-logic-10377739818 troubleshooting-web-logic-103
77739818 troubleshooting-web-logic-103
 
Was liberty at scale
Was liberty at scaleWas liberty at scale
Was liberty at scale
 
Getting started with agile database migrations for java flywaydb
Getting started with agile database migrations for java flywaydbGetting started with agile database migrations for java flywaydb
Getting started with agile database migrations for java flywaydb
 
WebLogic Server Work Managers and Overload Protection
WebLogic Server Work Managers and Overload ProtectionWebLogic Server Work Managers and Overload Protection
WebLogic Server Work Managers and Overload Protection
 

Similar to Lean microservices through ahead of time compilation (Tobias Piper, Loveholidays)

The Path Towards Spring Boot Native Applications
The Path Towards Spring Boot Native ApplicationsThe Path Towards Spring Boot Native Applications
The Path Towards Spring Boot Native ApplicationsVMware Tanzu
 
Spring Native and Spring AOT
Spring Native and Spring AOTSpring Native and Spring AOT
Spring Native and Spring AOTVMware Tanzu
 
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...Jesse Gallagher
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
Performance of Microservice frameworks on different JVMs
Performance of Microservice frameworks on different JVMsPerformance of Microservice frameworks on different JVMs
Performance of Microservice frameworks on different JVMsMaarten Smeets
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And BeyondVMware Tanzu
 
Meetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdfMeetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdfRed Hat
 
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010Arun Gupta
 
D. Andreadis, Red Hat: Concepts and technical overview of Quarkus
D. Andreadis, Red Hat: Concepts and technical overview of QuarkusD. Andreadis, Red Hat: Concepts and technical overview of Quarkus
D. Andreadis, Red Hat: Concepts and technical overview of QuarkusUni Systems S.M.S.A.
 
JavaOne 2014: Taming the Cloud Database with jclouds
JavaOne 2014: Taming the Cloud Database with jcloudsJavaOne 2014: Taming the Cloud Database with jclouds
JavaOne 2014: Taming the Cloud Database with jcloudszshoylev
 
Successful Software Development with Apache Cassandra
Successful Software Development with Apache CassandraSuccessful Software Development with Apache Cassandra
Successful Software Development with Apache CassandraDataStax Academy
 
Software Development with Apache Cassandra
Software Development with Apache CassandraSoftware Development with Apache Cassandra
Software Development with Apache Cassandrazznate
 
Grunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous IntegrationGrunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous IntegrationDavid Amend
 
Spring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsSpring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsmichaelaaron25322
 
Commit to excellence - Java in containers
Commit to excellence - Java in containersCommit to excellence - Java in containers
Commit to excellence - Java in containersRed Hat Developers
 
AWS Lambda SnapStart: Why, How and What AWS Serverless Meetup New York Boston...
AWS Lambda SnapStart: Why, How and What AWS Serverless Meetup New York Boston...AWS Lambda SnapStart: Why, How and What AWS Serverless Meetup New York Boston...
AWS Lambda SnapStart: Why, How and What AWS Serverless Meetup New York Boston...Vadym Kazulkin
 
Spring boot 3g
Spring boot 3gSpring boot 3g
Spring boot 3gvasya10
 

Similar to Lean microservices through ahead of time compilation (Tobias Piper, Loveholidays) (20)

The Path Towards Spring Boot Native Applications
The Path Towards Spring Boot Native ApplicationsThe Path Towards Spring Boot Native Applications
The Path Towards Spring Boot Native Applications
 
Spring Native and Spring AOT
Spring Native and Spring AOTSpring Native and Spring AOT
Spring Native and Spring AOT
 
Quarkus and GraalVM
Quarkus and GraalVMQuarkus and GraalVM
Quarkus and GraalVM
 
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
Performance of Microservice frameworks on different JVMs
Performance of Microservice frameworks on different JVMsPerformance of Microservice frameworks on different JVMs
Performance of Microservice frameworks on different JVMs
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And Beyond
 
Meetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdfMeetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdf
 
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
 
D. Andreadis, Red Hat: Concepts and technical overview of Quarkus
D. Andreadis, Red Hat: Concepts and technical overview of QuarkusD. Andreadis, Red Hat: Concepts and technical overview of Quarkus
D. Andreadis, Red Hat: Concepts and technical overview of Quarkus
 
DavidWible_res
DavidWible_resDavidWible_res
DavidWible_res
 
JavaOne 2014: Taming the Cloud Database with jclouds
JavaOne 2014: Taming the Cloud Database with jcloudsJavaOne 2014: Taming the Cloud Database with jclouds
JavaOne 2014: Taming the Cloud Database with jclouds
 
Successful Software Development with Apache Cassandra
Successful Software Development with Apache CassandraSuccessful Software Development with Apache Cassandra
Successful Software Development with Apache Cassandra
 
Software Development with Apache Cassandra
Software Development with Apache CassandraSoftware Development with Apache Cassandra
Software Development with Apache Cassandra
 
Grunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous IntegrationGrunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous Integration
 
Spring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsSpring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applications
 
Commit to excellence - Java in containers
Commit to excellence - Java in containersCommit to excellence - Java in containers
Commit to excellence - Java in containers
 
Intro to sbt-web
Intro to sbt-webIntro to sbt-web
Intro to sbt-web
 
AWS Lambda SnapStart: Why, How and What AWS Serverless Meetup New York Boston...
AWS Lambda SnapStart: Why, How and What AWS Serverless Meetup New York Boston...AWS Lambda SnapStart: Why, How and What AWS Serverless Meetup New York Boston...
AWS Lambda SnapStart: Why, How and What AWS Serverless Meetup New York Boston...
 
Spring boot 3g
Spring boot 3gSpring boot 3g
Spring boot 3g
 

More from London Microservices

Building Event-Driven Microservices using Kafka Streams (Stathis Souris, Thou...
Building Event-Driven Microservices using Kafka Streams (Stathis Souris, Thou...Building Event-Driven Microservices using Kafka Streams (Stathis Souris, Thou...
Building Event-Driven Microservices using Kafka Streams (Stathis Souris, Thou...London Microservices
 
Log and control all service-to-service traffic in one place (Kelvin Wong)
Log and control all service-to-service traffic in one place (Kelvin Wong)Log and control all service-to-service traffic in one place (Kelvin Wong)
Log and control all service-to-service traffic in one place (Kelvin Wong)London Microservices
 
Event Streaming, the hard way by (César Luis Alvargonzález, Revolut)
Event Streaming, the hard way by (César Luis Alvargonzález, Revolut)Event Streaming, the hard way by (César Luis Alvargonzález, Revolut)
Event Streaming, the hard way by (César Luis Alvargonzález, Revolut)London Microservices
 
Hidden secrets of the Deliveroo Application Platform (Ben Cordero, Deliveroo)
Hidden secrets of the Deliveroo Application Platform (Ben Cordero, Deliveroo)Hidden secrets of the Deliveroo Application Platform (Ben Cordero, Deliveroo)
Hidden secrets of the Deliveroo Application Platform (Ben Cordero, Deliveroo)London Microservices
 
Reliability in Microservices: Embracing Failure (César Luis Alvargonzález, Re...
Reliability in Microservices: Embracing Failure (César Luis Alvargonzález, Re...Reliability in Microservices: Embracing Failure (César Luis Alvargonzález, Re...
Reliability in Microservices: Embracing Failure (César Luis Alvargonzález, Re...London Microservices
 
Robots and Food (Orfeo Nicolai, Karakuri)
Robots and Food (Orfeo Nicolai, Karakuri)Robots and Food (Orfeo Nicolai, Karakuri)
Robots and Food (Orfeo Nicolai, Karakuri)London Microservices
 
Cloud Native Patterns (Jamie Dobson, Container Solutions)
Cloud Native Patterns (Jamie Dobson, Container Solutions)Cloud Native Patterns (Jamie Dobson, Container Solutions)
Cloud Native Patterns (Jamie Dobson, Container Solutions)London Microservices
 
Designing an extensible tooling platform (Dmitry Zeldin, Skyscanner)
Designing an extensible tooling platform (Dmitry Zeldin, Skyscanner)Designing an extensible tooling platform (Dmitry Zeldin, Skyscanner)
Designing an extensible tooling platform (Dmitry Zeldin, Skyscanner)London Microservices
 

More from London Microservices (8)

Building Event-Driven Microservices using Kafka Streams (Stathis Souris, Thou...
Building Event-Driven Microservices using Kafka Streams (Stathis Souris, Thou...Building Event-Driven Microservices using Kafka Streams (Stathis Souris, Thou...
Building Event-Driven Microservices using Kafka Streams (Stathis Souris, Thou...
 
Log and control all service-to-service traffic in one place (Kelvin Wong)
Log and control all service-to-service traffic in one place (Kelvin Wong)Log and control all service-to-service traffic in one place (Kelvin Wong)
Log and control all service-to-service traffic in one place (Kelvin Wong)
 
Event Streaming, the hard way by (César Luis Alvargonzález, Revolut)
Event Streaming, the hard way by (César Luis Alvargonzález, Revolut)Event Streaming, the hard way by (César Luis Alvargonzález, Revolut)
Event Streaming, the hard way by (César Luis Alvargonzález, Revolut)
 
Hidden secrets of the Deliveroo Application Platform (Ben Cordero, Deliveroo)
Hidden secrets of the Deliveroo Application Platform (Ben Cordero, Deliveroo)Hidden secrets of the Deliveroo Application Platform (Ben Cordero, Deliveroo)
Hidden secrets of the Deliveroo Application Platform (Ben Cordero, Deliveroo)
 
Reliability in Microservices: Embracing Failure (César Luis Alvargonzález, Re...
Reliability in Microservices: Embracing Failure (César Luis Alvargonzález, Re...Reliability in Microservices: Embracing Failure (César Luis Alvargonzález, Re...
Reliability in Microservices: Embracing Failure (César Luis Alvargonzález, Re...
 
Robots and Food (Orfeo Nicolai, Karakuri)
Robots and Food (Orfeo Nicolai, Karakuri)Robots and Food (Orfeo Nicolai, Karakuri)
Robots and Food (Orfeo Nicolai, Karakuri)
 
Cloud Native Patterns (Jamie Dobson, Container Solutions)
Cloud Native Patterns (Jamie Dobson, Container Solutions)Cloud Native Patterns (Jamie Dobson, Container Solutions)
Cloud Native Patterns (Jamie Dobson, Container Solutions)
 
Designing an extensible tooling platform (Dmitry Zeldin, Skyscanner)
Designing an extensible tooling platform (Dmitry Zeldin, Skyscanner)Designing an extensible tooling platform (Dmitry Zeldin, Skyscanner)
Designing an extensible tooling platform (Dmitry Zeldin, Skyscanner)
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
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 SavingEdi Saputra
 
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, ...apidays
 
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 Pakistandanishmna97
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
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...apidays
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
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 FresherRemote DBA Services
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 

Recently uploaded (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
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, ...
 
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
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
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...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 

Lean microservices through ahead of time compilation (Tobias Piper, Loveholidays)

  • 1. Lean microservices through ahead of time compilation Wednesday, 5th August, 2020 Tobias Piper
  • 2. Tobias Piper ● Senior Software Engineer at loveholidays.com ● Book Team ○ Responsible for booking and post- book systems ○ Integration of payment suppliers ● Services in K8 in GCP
  • 3.
  • 5. Startup time of a service Application startup can be an essential performance indicator for a service - Highly volatile load - scaling up and down frequently - Inconsistent latency / throughput caused by slow starting service - Short running (cron)jobs - Pipelines of services
  • 6. Build fast starting microservices What slows down application startup - Component loading - Component initialization The more luggage you bring, the slower you get - Backend (e.g. DB) connections - Custom initialization code
  • 9. Quick JVM 101 Runtime artifact contains: - Full JVM - Dependencies pulled in via build system - Your code Application startup is slowed down by: - JIT compilation - Class initialization The more luggage you bring, the slower you get
  • 15.
  • 16. Native Image Creation with GraalVM Tree Shaking for the JVM!
  • 20. Resource usage ~180GB memory required -> 3x high-mem-8 = 192GB 3x $340 = $1020 per month => $255.06 1k instances: ~41GB memory required -> 3x high-mem-2: 48GB 1k instances -> 3x standard-4: 48GB => $379.5
  • 22. Did we find a free lunch after all?
  • 23. Caveats Native Images are compiled for a target architecture and classes statically loaded at compile time Static code analysis is quite slow, so bring some time - you trade faster initialization at runtime for slower build time (seconds to minutes) - Code inspection / tree shaking is CPU intensive, can your CI worker handle it in real time? JVM provides dynamic features, which are hard to initialize statically e.g. ● Reflection (examine and manipulate your runtime) ● Dynamic Proxies (Used e.g. by some DI frameworks, like Spring) ● Interpretation for different architectures / environments Workarounds exist to still allow native image generation ● Delaying class initialization ● Register classes requiring reflection Configuring the native image build can be quite painful, especially when dealing with 3rd party dependencies
  • 24. Resources ● Github Repo with example projects for a Quarkus native image vs Spring Boot app ● GraalVM Docs ● Native Image creation explained ● Tree shaking in the webpack docs
  • 26. Don’t trust the marketing slide Trying it out is more fun anyways Code at: https://github.com/loveholidays/quarkus-demo Frameworks used for comparison - Spring Boot - Quarkus - Quarkus - Native image $ java -version openjdk version "11.0.6" 2020-01-14 OpenJDK Runtime Environment GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02) OpenJDK 64-Bit Server VM GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02, mixed mode, sharing)
  • 27. Let’s try it out - Spring Boot $ java -jar boot-demo/build/libs/demo-0.0.1-SNAPSHOT.jar . ____ _ __ _ _ / / ___'_ __ _ _(_)_ __ __ _ ( ( )___ | '_ | '_| | '_ / _` | / ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |___, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.2.6.RELEASE) ..... 2020-05-06 16:04:20.200 INFO 1948140 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8081 (http) with context path '' 2020-05-06 16:04:20.203 INFO 1948140 --- [ main] com.loveholidays.demo.DemoApplication : Started DemoApplication in 6.073 seconds (JVM running for 6.994) $ ps -au USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND toby 817339 12.1 4.1 9099040 676604 pts/2 Sl+ 09:41 0:14 java -jar boot-demo/build/libs/demo-0.0.1-SNAPSHOT.jar $ time curl http://localhost:8081/foo 0.01s user 0.00s system 1% cpu 0.414 total
  • 28. Let’s try it out - Quarkus JVM mode (uber-jar) $ java -jar quarkus-demo/build/demo-1.0.0-SNAPSHOT-runner.jar __ ____ __ _____ ___ __ ____ ______ --/ __ / / / / _ | / _ / //_/ / / / __/ -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ / --________/_/ |_/_/|_/_/|_|____/___/ 2020-05-11 22:51:12,804 WARN [io.agr.pool] (main) Datasource '<default>': Driver does not support the provided URL: jdbc:mysql:127.0.0.1:3306/test 2020-05-11 22:51:13,234 INFO [io.quarkus] (main) demo 1.0.0-SNAPSHOT (powered by Quarkus 1.4.2.Final) started in 1.703s. Listening on: http://0.0.0.0:8080 2020-05-11 22:51:13,236 INFO [io.quarkus] (main) Profile prod activated. 2020-05-11 22:51:13,236 INFO [io.quarkus] (main) Installed features: [agroal, cdi, hibernate-orm, hibernate-orm-panache, jdbc-mysql, narayana-jta, resteasy, resteasy-jsonb] $ ps -au USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND toby 816802 2.8 2.2 9005840 364772 pts/3 Sl+ 09:41 0:03 java -jar quarkus-demo/build/demo-1.0.0-SN...jar $ time curl http://localhost:8080/foo 0.01s user 0.01s system 16% cpu 0.100 total
  • 29. Let’s try it out - Quarkus native mode $ quarkus-demo/build/demo-1.0.0-SNAPSHOT-runner __ ____ __ _____ ___ __ ____ ______ --/ __ / / / / _ | / _ / //_/ / / / __/ -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ / --________/_/ |_/_/|_/_/|_|____/___/ 2020-05-11 22:23:53,093 INFO [io.quarkus] (main) demo 1.0.0-SNAPSHOT (powered by Quarkus 1.4.2.Final) started in 0.049s. Listening on: http://0.0.0.0:8080 2020-05-11 22:23:53,093 INFO [io.quarkus] (main) Profile prod activated. 2020-05-11 22:23:53,094 INFO [io.quarkus] (main) Installed features: [agroal, cdi, hibernate-orm, hibernate-orm-panache, jdbc-mysql, narayana-jta, resteasy, resteasy-jsonb] $ ps -au USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND toby 893179 0.1 0.2 1737672 44416 pts/0 Sl+ 09:46 0:00 ./demo-1.0.0-SNAPSHOT-runner $ time curl http://localhost:8080/foo 0.01s user 0.01s system 2% cpu 0.759 total