DATE OR VENUE
Quarkus Application Bootstrap
where do small sizes and timings
come from?
JAVA MARATHON – JULY 2020
WHOAMI
mgovorischev maksym_govorischev
mgovorischev@gmail.com
New player - Quarkus
WHY?
What is wrong with Java frameworks
• They load too many classes
• They perform a lot of initialization at runtime
• They overuse dynamic/reflective functionality (in general
and during startup in particular)
• They need to be paired with full-fledged JVM to run
WHAT?
What is being optimized?
• Performance – startup time
Performance – startup time
https://dzone.com/articles/micr
oservices-quarkus-vs-spring-boot
What is being optimized?
• Performance – startup time
• Resources – memory footprint (RSS)
Performance – memory footprint
https://dzone.com/articles/micr
oservices-quarkus-vs-spring-boot
How faster/smaller? Rule of thumb
Hotspot optimized Quarkus App
½ the RSS space
X5 boot speed
Native optimized Quarkus App
1/5 the RSS space
X50 boot speed
@Dimitris Andreadis, Director of Engineering at Red Hat
What is being optimized?
• Performance – startup time
• Resources – memory footprint (RSS)
• Resources – app size
Why app size matters? Because of lambdas
WHEN?
How does usual Java framework start?
How does usual Java framework start?
Packaging (maven, gradle)
How does usual Java framework start?
Packaging (maven, gradle)
Load and parse
config files
How does usual Java framework start?
Packaging (maven, gradle)
Load and parse
config files
Classpath scanning
and annotation
discovery. Enable
features based on
class availability
How does usual Java framework start?
Packaging (maven, gradle)
Load and parse
config files
Classpath scanning
and annotation
discovery. Enable
features based on
class availability
Build metamodel
of the world
How does usual Java framework start?
Packaging (maven, gradle)
Load and parse
config files
Classpath scanning
and annotation
discovery. Enable
features based on
class availability
Build metamodel
of the world
IO, threadpools, etc
How does usual Java framework start?
Packaging (maven, gradle)
Load and parse
config files
Classpath scanning
and annotation
discovery. Enable
features based on
class availability
Build metamodel
of the world
IO, threadpools, etc
Build time
How does usual Java framework start?
Packaging (maven, gradle)
Load and parse
config files
Classpath scanning
and annotation
discovery. Enable
features based on
class availability
Build metamodel
of the world
IO, threadpools, etc
Build time Runtime
How does Quarkus start?
Packaging (maven, gradle)Load and parse
config files
Classpath scanning
and annotation
discovery. Enable
features based on
class availability
Build metamodel
of the world
IO, threadpools, etc
Build time Runtime
HOW?
Quarkus build paths
*.class
Quarkus build paths
*.class
Maven/Gradle plugin
Quarkus build paths
*.class
Maven/Gradle plugin
Optimized Jar
Extensions
Extensions mechanism
Extensions
Class-path
modification
Build
augmentation
Build Steps
Build Step
Extensions mechanism
Extensions
Class-path
modification
Build
augmentation
Build Steps Build Items
Build Item
Extensions mechanism
Extensions
Class-path
modification
Build
augmentation
Build Steps Build Items
Bytecode
recorders
Recorder
[ STATIC_INIT |RUNTIME_INIT ]
Tools under the hood
Jandex
Tools under the hood
Gizmo
Jandex
Build Augmentation
Index
Corequarkus-data
Parse
Config
Step
Scan
Step
Repo
Init
Step
app.properties
Application.class
Static Init
Runtime Init
Recorded
bytecode
ApplicationIndexBuildItem
ConfigBuildItem
- Build item - Build step
Quarkus build paths
*.class
Maven/Gradle plugin
Optimized Jar
Jlink + AppCDS
Extensions
Quarkus build paths
*.class
Maven/Gradle plugin
Optimized Jar Native
executable/image
Jlink + AppCDS
Extensions
Tools under the hood
Graal Compiler
Gizmo
SubstrateVM
Jandex
GraalVM
AOT Native Image Compilation with GraalVM
Extensions mechanism
Extensions
Class-path
modification
Build
augmentation
Build Steps Build Items
SubstrateVM
Substitutions
Bytecode
recorders
Quarkus bootstrap 2020

Quarkus bootstrap 2020