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

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.pdfLuca Mattia Ferrari
 
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 (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

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 

Recently uploaded (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 

Lean microservices through ahead of time compilation

  • 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