ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Alina Yurenko
Developer Advocate for GraalVM
Oracle
JavaZone
Going AOT: Everything you need to know
about GraalVM for Java applications
Photo by Andrea Brataas on Unsplash
? Alina Yurenko / @alina_yurenko
? Developer Advocate for GraalVM
at Oracle
? Love open source and
communities ?
? Love both programming ??
? &
natural languages ?
??
About me
@alina_yurenko
GRAALVM
An advanced JDK with ahead-of-time
Native Image compilation
native-image MyMainClass
./mymainclass
JIT AOT
java MyMainClass
2017 Year
2018 2019 2020 2021 2022 2023
2005 2011
... ...
Sun Labs¡¯
Maxine Java
JVM initial
release
December
Native Image
open sourced
April
Twitter uses
Graal JIT for
core
microservices
October
Micronaut
1.0 with
Native
Image
support
April
GraalVM 1.0
released
April
Thomas
Wuerthinger
joins Oracle and
starts Graal
compiler
project
March
Spring Native
goes beta
November
Quarkus
1.0 with
Native
Image
support
May
GraalVM
goes GA
(19.0
release)
September
MicroDoc
announces
GraalVM for
embedded
July
Alibaba
deploys
Native
Image in
production
July
Facebook
deploys
GraalVM in
production
May
AWS SDK
support for
Native
Image
November
Spring Boot 3
with Native
Image
support
December
OpenJDK
Galahad
project
proposed
July
Google Cloud
Platform SDK
support for
Native Image
June
GraalVM Free
Terms and
Conditions
license
September
GraalOS &
Layered
Native
Image
announced
March
Azure SDK
support for
Native
Image
September
Oracle Cloud
runs services
on GraalVM
Graal History
?
?
?
?
@alina_yurenko
GraalVM Native Image AOT Compilation
Ahead-of-Time
Compilation
Application
Libraries
JDK
Substrate VM
Points-to Analysis
Run Initializations
Heap Snapshotting
Input:
All classes from application,
libraries, and VM
Code in
Text Section
Image Heap in
Data Section
Image Heap
Writing
Output:
Native executable
@alina_yurenko
DEMO ?
GraalVM Native Image¡ªFast Start Up and Much More
Improved
Security
Fast Start
& Scale
Lower Resource
Usage
Compact
Packaging
Predictable
Performance
Supported
Azure
AWS
GCP
OCI
@alina_yurenko
FRAMEWORKS
& LIBRARIES
NATIVE IMAGE
BUILD-TIME DISCOVERY
AND CONFIGURATION
SPRING BOOT
RUN-TIME DISCOVERY
AND CONFIGURATION
SPRING BOOT NATIVE IMAGE
SPRING AOT
SPRING AOT
SPRING AOT
JAVA SOURCE FILES
BYTECODE
HINT FILES
MORE DEMOS:)
Libraries, dynamic Java features, and Native Image
? Libraries might be Native-Image friendly out of the box
? twitter.com/YunaMorgenstern/status/1729039787351536084
? Libraries might include config for Native Image:
? github.com/h2database/h2database/blob/master/h2/src/main/META-INF/native-image/
? Libraries might contain config in the Reachability Metadata Repository
? github.com/oracle/graalvm-reachability-metadata/tree/master/metadata/io.netty
? You can use framework support to produce custom ¡°hints¡± for Native Image
runtimeHints.resources().registerPattern(¡°config/app.properties¡±);
? You can use the Tracing Agent to produce the necessary config automatically
? graalvm.org/latest/reference-manual/native-image/metadata/AutomaticMetadataCollection/
? You can provide/extend config for reflection, JNI, resources, serialization, and predefined classes
manually in JSON:
? graalvm.org/latest/reference-manual/native-image/metadata/#specifying-metadata-with-json
Happy path;
most of the cases
Custom code/
libraries
@alina_yurenko
Ready for GraalVM Native Image
graalvm.org/native-image/libraries-and-frameworks
@alina_yurenko
PERFORMANCE
AOT at the speed of JIT ?
? Profile-guided optimizations
Collect and use profiles at
build time to optimize for the
specific runtime behaviour of
your application
? ML-enabled PGO
Use a ML model to
automatically predict the profile
of the application
? G1 GC
Optimize GC for peak
throughput
? `-march=native`
Optimize for the specific
hardware features of the
machine you¡¯ll be running on
@alina_yurenko
Spring PetClinic: Peak throughput
@alina_yurenko
Spring PetClinic: Memory Efficiency
@alina_yurenko
Spring PetClinic Performance on Oracle GraalVM
GraalVM CE with C2 JIT Oracle GraalVM Native Image
Memory Usage (max RSS) 1,029 MB 641 MB
Peak throughput 11,066 req/s 11,902 req/s
Throughput per memory 12,488 req/(GB*s) 18,569 req/(GB*s)
Tail latency (P99) 7.2ms 5.15ms
Startup 7,090ms 210ms
-38% lower
+8% higher
+49% better
-28% lower
34x faster
@alina_yurenko
BEST PRACTICES
Cross-Platform Builds on GitHub Actions
Windows
Executable
macOS
Executable
Linux
Executable
.class
.jar
.class
.jar
GraalVM GitHub
Action ?
??
@alina_yurenko
? Reduced attack surface area
due to dead code removal¡ª
unused classes, methods, and
fields not included in
executable
Improved
Security ? Not vulnerable to JIT
compiler attacks
all code is AOT compiled
? SBOM supporting
industry standards
Embedded in executables
CycloneDX format
? Not vulnerable to
deserialization attacks via
class loading¡ªexecutable
includes only required
and specified classes
Reduced Attack Surface ?
??
@alina_yurenko
? Migrate ?
? Add Native Build Tools
? Alternatively, use recent versions of frameworks
? Evaluate libraries: graalvm.org/native-image/libraries-and-frameworks
? Build and deploy ?
¡â?
?
?
?
¡â?
?
¡â?
?
¡â?
?
¡â?
?
¡â?
?
¡â?
?
¡â?
?
¡â?
?
¡â?
?
¡â?
?
¡â?
?
¡â? ?
¡â?
? Build and test on GraalVM as the JVM, build with Native Image closer to the deployment
? Quick build mode with `-Ob`
? Use CI/CD systems (e.g. GitHub actions) for deployment and cross-platform builds
? Run faster ?
? PGO
? ML-enabled PGO
? G1 GC
? `-march=native`
Recommendations
@alina_yurenko
WHAT¡¯S NEXT?
? Java 22 features
? The fastest GraalVM yet :)
? Developer experience improvements
Learn more: medium.com/graalvm
GraalVM for JDK 22 ?
@alina_yurenko
cwiki.apache.org/confluence/display/KAFKA/KIP-974%3A+Docker+Image+for+GraalVM+based+Native+Kafka+Broker
Native Kafka Broker ?
? Average startup time is ~130ms;
? No CPU spike is observed for GraalVM; the JVM broker had sudden spikes when the broker started and also
when the load testing started;
? For JVM broker the max memory usage went up to ~1GB. For GraalVM is was ~500MB with G1GC and ~250MB
with serial GC.
Layered Native Images
Micronaut base
Micronaut extensions
(Web, Data, Test)
Spring base
App 1
App 2 App 3
Deployment: resources sharing ??
JDK base
Application code
Development: fast recompilation ?
JDK base + Micronaut base+ all
extensions
App 4
@alina_yurenko
GraalOS¡ªAdvanced cloud native application deployment platform
Fast Start
GraalOS applications
start fast with
virtually no cold start
cost
Low Latency
Excellent 99th
percentile latency
makes GraalOS
applications highly
responsive
Run On Demand
GraalOS applications
are automatically
suspended and
resumed on demand
¡ªwith no idle cost
Applications, not
Containers
GraalOS uses the latest
advances in x86 and
AArch64 processor
architectures for hardware
enforced application
isolation without
containers
Reduced Memory
GraalOS applications
require significantly
less memory
resulting in reduced
operating costs
Cloud Native
With support for
stateful and stateless
services and
functions, GraalOS is
ideal for cloud native
applications
Runs applications as small, fast GraalVM Native Image compiled machine
executables
@alina_yurenko
Compact
Packaging
GraalVM Native Image¡ªIdeal for Cloud Native Applications
Improved
Security
Fast Start
& Scale
Lower Resource
Usage
Predictable
Performance
Supported
Azure
AWS
GCP
OCI
@alina_yurenko
graalvm.org
sdk install java
22.0.1-graal
Get started with GraalVM ?
github.com/
graalvm/graalvm-
demos
docker pull container-
registry.oracle.com/gr
aalvm/jdk:22
@alina_yurenko
Questions & let¡¯s connect! Demos ?
@alina_yurenko
Please rate this session!:) ?
Thank you!:)
@alina_yurenko
GOING AOT WITH GRAALVM FOR JAVA - JAVAZONE

More Related Content

Similar to GOING AOT WITH GRAALVM FOR JAVA - JAVAZONE (20)

Everything you need to know about GraalVM Native Image
Everything you need to know about GraalVM Native ImageEverything you need to know about GraalVM Native Image
Everything you need to know about GraalVM Native Image
Alina Yurenko
?
Peru JUG Micronaut & GraalVM
Peru JUG Micronaut & GraalVMPeru JUG Micronaut & GraalVM
Peru JUG Micronaut & GraalVM
Domingo Suarez Torres
?
GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18
Jorge Hidalgo
?
GraalVM Overview Compact version
GraalVM Overview Compact versionGraalVM Overview Compact version
GraalVM Overview Compact version
scalaconfjp
?
GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22
Jorge Hidalgo
?
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and Gaelyk
Guillaume Laforge
?
GraalVM
GraalVMGraalVM
GraalVM
Manfredi Giordano
?
New opportunities for Developers With GraalVM
New opportunities for Developers With GraalVMNew opportunities for Developers With GraalVM
New opportunities for Developers With GraalVM
Alina Yurenko
?
Ways to Level Up Your Java Application with GraalVM.pptx
Ways to Level Up Your Java Application with GraalVM.pptxWays to Level Up Your Java Application with GraalVM.pptx
Ways to Level Up Your Java Application with GraalVM.pptx
ohupalo
?
Neptue Graph Database - 0 to Production
Neptue Graph Database - 0 to ProductionNeptue Graph Database - 0 to Production
Neptue Graph Database - 0 to Production
israelio
?
Polygot Java EE on the GraalVM
Polygot Java EE on the GraalVMPolygot Java EE on the GraalVM
Polygot Java EE on the GraalVM
Ryan Cuprak
?
GraphQL-ify your APIs
GraphQL-ify your APIsGraphQL-ify your APIs
GraphQL-ify your APIs
Soham Dasgupta
?
Introduction to GraalVM
Introduction to GraalVMIntroduction to GraalVM
Introduction to GraalVM
SHASHI KUMAR
?
Quarkus Extensions Turbocharge for Java Microservices.pdf
Quarkus Extensions Turbocharge for Java Microservices.pdfQuarkus Extensions Turbocharge for Java Microservices.pdf
Quarkus Extensions Turbocharge for Java Microservices.pdf
Ivelin Yanev
?
AOT and Native with Spring Boot 3.0
AOT and Native with Spring Boot 3.0AOT and Native with Spring Boot 3.0
AOT and Native with Spring Boot 3.0
MoritzHalbritter
?
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
London Microservices
?
DCSF19 Docker Containers & Java: What I Wish I Had Been Told
DCSF19 Docker Containers & Java: What I Wish I Had Been ToldDCSF19 Docker Containers & Java: What I Wish I Had Been Told
DCSF19 Docker Containers & Java: What I Wish I Had Been Told
Docker, Inc.
?
GraalVM - A Step Ahead of JVM Presentation
GraalVM - A Step Ahead of JVM PresentationGraalVM - A Step Ahead of JVM Presentation
GraalVM - A Step Ahead of JVM Presentation
Knoldus Inc.
?
20191119 Cloud Native Java : GraalVM
20191119 Cloud Native Java : GraalVM20191119 Cloud Native Java : GraalVM
20191119 Cloud Native Java : GraalVM
Taewan Kim
?
Netflix oss season 2 episode 1 - meetup Lightning talks
Netflix oss   season 2 episode 1 - meetup Lightning talksNetflix oss   season 2 episode 1 - meetup Lightning talks
Netflix oss season 2 episode 1 - meetup Lightning talks
Ruslan Meshenberg
?
Everything you need to know about GraalVM Native Image
Everything you need to know about GraalVM Native ImageEverything you need to know about GraalVM Native Image
Everything you need to know about GraalVM Native Image
Alina Yurenko
?
GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18
Jorge Hidalgo
?
GraalVM Overview Compact version
GraalVM Overview Compact versionGraalVM Overview Compact version
GraalVM Overview Compact version
scalaconfjp
?
GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22
Jorge Hidalgo
?
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and Gaelyk
Guillaume Laforge
?
New opportunities for Developers With GraalVM
New opportunities for Developers With GraalVMNew opportunities for Developers With GraalVM
New opportunities for Developers With GraalVM
Alina Yurenko
?
Ways to Level Up Your Java Application with GraalVM.pptx
Ways to Level Up Your Java Application with GraalVM.pptxWays to Level Up Your Java Application with GraalVM.pptx
Ways to Level Up Your Java Application with GraalVM.pptx
ohupalo
?
Neptue Graph Database - 0 to Production
Neptue Graph Database - 0 to ProductionNeptue Graph Database - 0 to Production
Neptue Graph Database - 0 to Production
israelio
?
Polygot Java EE on the GraalVM
Polygot Java EE on the GraalVMPolygot Java EE on the GraalVM
Polygot Java EE on the GraalVM
Ryan Cuprak
?
Introduction to GraalVM
Introduction to GraalVMIntroduction to GraalVM
Introduction to GraalVM
SHASHI KUMAR
?
Quarkus Extensions Turbocharge for Java Microservices.pdf
Quarkus Extensions Turbocharge for Java Microservices.pdfQuarkus Extensions Turbocharge for Java Microservices.pdf
Quarkus Extensions Turbocharge for Java Microservices.pdf
Ivelin Yanev
?
AOT and Native with Spring Boot 3.0
AOT and Native with Spring Boot 3.0AOT and Native with Spring Boot 3.0
AOT and Native with Spring Boot 3.0
MoritzHalbritter
?
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
London Microservices
?
DCSF19 Docker Containers & Java: What I Wish I Had Been Told
DCSF19 Docker Containers & Java: What I Wish I Had Been ToldDCSF19 Docker Containers & Java: What I Wish I Had Been Told
DCSF19 Docker Containers & Java: What I Wish I Had Been Told
Docker, Inc.
?
GraalVM - A Step Ahead of JVM Presentation
GraalVM - A Step Ahead of JVM PresentationGraalVM - A Step Ahead of JVM Presentation
GraalVM - A Step Ahead of JVM Presentation
Knoldus Inc.
?
20191119 Cloud Native Java : GraalVM
20191119 Cloud Native Java : GraalVM20191119 Cloud Native Java : GraalVM
20191119 Cloud Native Java : GraalVM
Taewan Kim
?
Netflix oss season 2 episode 1 - meetup Lightning talks
Netflix oss   season 2 episode 1 - meetup Lightning talksNetflix oss   season 2 episode 1 - meetup Lightning talks
Netflix oss season 2 episode 1 - meetup Lightning talks
Ruslan Meshenberg
?

Recently uploaded (20)

Transactional Outbox & Inbox Patterns.pptx
Transactional Outbox & Inbox Patterns.pptxTransactional Outbox & Inbox Patterns.pptx
Transactional Outbox & Inbox Patterns.pptx
Maysam Mousa
?
Automating Behavior-Driven Development: Boosting Productivity with Template-D...
Automating Behavior-Driven Development: Boosting Productivity with Template-D...Automating Behavior-Driven Development: Boosting Productivity with Template-D...
Automating Behavior-Driven Development: Boosting Productivity with Template-D...
DOCOMO Innovations, Inc.
?
The effectiveness of ai powered educational tools in enhancing academic perfo...
The effectiveness of ai powered educational tools in enhancing academic perfo...The effectiveness of ai powered educational tools in enhancing academic perfo...
The effectiveness of ai powered educational tools in enhancing academic perfo...
aebhpmqaocxhydmajf
?
Leadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly Meetup
Leadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly MeetupLeadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly Meetup
Leadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly Meetup
GDG Kathmandu
?
SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...
SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...
SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...
DianaGray10
?
Benefits of Moving Ellucian Banner to Oracle Cloud
Benefits of Moving Ellucian Banner to Oracle CloudBenefits of Moving Ellucian Banner to Oracle Cloud
Benefits of Moving Ellucian Banner to Oracle Cloud
AstuteBusiness
?
Recruiting Tech: A Look at Why AI is Actually OG
Recruiting Tech: A Look at Why AI is Actually OGRecruiting Tech: A Look at Why AI is Actually OG
Recruiting Tech: A Look at Why AI is Actually OG
Matt Charney
?
Top Tips to Get Your Data AI-Ready? ? ?? ?
Top Tips to Get Your Data AI-Ready? ? ?? ?Top Tips to Get Your Data AI-Ready? ? ?? ?
Top Tips to Get Your Data AI-Ready? ? ?? ?
Precisely
?
Automated Engineering of Domain-Specific Metamorphic Testing Environments
Automated Engineering of Domain-Specific Metamorphic Testing EnvironmentsAutomated Engineering of Domain-Specific Metamorphic Testing Environments
Automated Engineering of Domain-Specific Metamorphic Testing Environments
Pablo G¨®mez Abajo
?
All-Data, Any-AI Integration: FME & Amazon Bedrock in the Real-World
All-Data, Any-AI Integration: FME & Amazon Bedrock in the Real-WorldAll-Data, Any-AI Integration: FME & Amazon Bedrock in the Real-World
All-Data, Any-AI Integration: FME & Amazon Bedrock in the Real-World
Safe Software
?
STARLINK-JIO-AIRTEL Security issues to Ponder
STARLINK-JIO-AIRTEL Security issues to PonderSTARLINK-JIO-AIRTEL Security issues to Ponder
STARLINK-JIO-AIRTEL Security issues to Ponder
anupriti
?
GDG Cloud Southlake #41: Shay Levi: Beyond the Hype:How Enterprises Are Using AI
GDG Cloud Southlake #41: Shay Levi: Beyond the Hype:How Enterprises Are Using AIGDG Cloud Southlake #41: Shay Levi: Beyond the Hype:How Enterprises Are Using AI
GDG Cloud Southlake #41: Shay Levi: Beyond the Hype:How Enterprises Are Using AI
James Anderson
?
How Telemedicine App Development is Revolutionizing Virtual Care.pptx
How Telemedicine App Development is Revolutionizing Virtual Care.pptxHow Telemedicine App Development is Revolutionizing Virtual Care.pptx
How Telemedicine App Development is Revolutionizing Virtual Care.pptx
Dash Technologies Inc
?
Why Outsource Accounting to India A Smart Business Move!.pdf
Why Outsource Accounting to India A Smart Business Move!.pdfWhy Outsource Accounting to India A Smart Business Move!.pdf
Why Outsource Accounting to India A Smart Business Move!.pdf
anjelinajones6811
?
UiPath NY AI Series: Session 4: UiPath AutoPilot for Developers using Studio Web
UiPath NY AI Series: Session 4: UiPath AutoPilot for Developers using Studio WebUiPath NY AI Series: Session 4: UiPath AutoPilot for Developers using Studio Web
UiPath NY AI Series: Session 4: UiPath AutoPilot for Developers using Studio Web
DianaGray10
?
CIOs Speak Out - A Research Series by Jasper Colin
CIOs Speak Out - A Research Series by Jasper ColinCIOs Speak Out - A Research Series by Jasper Colin
CIOs Speak Out - A Research Series by Jasper Colin
Jasper Colin
?
Artificial Neural Networks, basics, its variations and examples
Artificial Neural Networks, basics, its variations and examplesArtificial Neural Networks, basics, its variations and examples
Artificial Neural Networks, basics, its variations and examples
anandsimple
?
Columbia Weather Systems - Product Overview
Columbia Weather Systems - Product OverviewColumbia Weather Systems - Product Overview
Columbia Weather Systems - Product Overview
Columbia Weather Systems
?
Build Your Uber Clone App with Advanced Features
Build Your Uber Clone App with Advanced FeaturesBuild Your Uber Clone App with Advanced Features
Build Your Uber Clone App with Advanced Features
V3cube
?
202408_JAWSPANKRATION_Introduction_of_Minaden.pdf
202408_JAWSPANKRATION_Introduction_of_Minaden.pdf202408_JAWSPANKRATION_Introduction_of_Minaden.pdf
202408_JAWSPANKRATION_Introduction_of_Minaden.pdf
NTTDOCOMO-ServiceInnovation
?
Transactional Outbox & Inbox Patterns.pptx
Transactional Outbox & Inbox Patterns.pptxTransactional Outbox & Inbox Patterns.pptx
Transactional Outbox & Inbox Patterns.pptx
Maysam Mousa
?
Automating Behavior-Driven Development: Boosting Productivity with Template-D...
Automating Behavior-Driven Development: Boosting Productivity with Template-D...Automating Behavior-Driven Development: Boosting Productivity with Template-D...
Automating Behavior-Driven Development: Boosting Productivity with Template-D...
DOCOMO Innovations, Inc.
?
The effectiveness of ai powered educational tools in enhancing academic perfo...
The effectiveness of ai powered educational tools in enhancing academic perfo...The effectiveness of ai powered educational tools in enhancing academic perfo...
The effectiveness of ai powered educational tools in enhancing academic perfo...
aebhpmqaocxhydmajf
?
Leadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly Meetup
Leadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly MeetupLeadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly Meetup
Leadership Spectrum by Sonam Sherpa at GDG Kathmandu March Monthly Meetup
GDG Kathmandu
?
SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...
SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...
SAP Automation with UiPath: Solution Accelerators and Best Practices - Part 6...
DianaGray10
?
Benefits of Moving Ellucian Banner to Oracle Cloud
Benefits of Moving Ellucian Banner to Oracle CloudBenefits of Moving Ellucian Banner to Oracle Cloud
Benefits of Moving Ellucian Banner to Oracle Cloud
AstuteBusiness
?
Recruiting Tech: A Look at Why AI is Actually OG
Recruiting Tech: A Look at Why AI is Actually OGRecruiting Tech: A Look at Why AI is Actually OG
Recruiting Tech: A Look at Why AI is Actually OG
Matt Charney
?
Top Tips to Get Your Data AI-Ready? ? ?? ?
Top Tips to Get Your Data AI-Ready? ? ?? ?Top Tips to Get Your Data AI-Ready? ? ?? ?
Top Tips to Get Your Data AI-Ready? ? ?? ?
Precisely
?
Automated Engineering of Domain-Specific Metamorphic Testing Environments
Automated Engineering of Domain-Specific Metamorphic Testing EnvironmentsAutomated Engineering of Domain-Specific Metamorphic Testing Environments
Automated Engineering of Domain-Specific Metamorphic Testing Environments
Pablo G¨®mez Abajo
?
All-Data, Any-AI Integration: FME & Amazon Bedrock in the Real-World
All-Data, Any-AI Integration: FME & Amazon Bedrock in the Real-WorldAll-Data, Any-AI Integration: FME & Amazon Bedrock in the Real-World
All-Data, Any-AI Integration: FME & Amazon Bedrock in the Real-World
Safe Software
?
STARLINK-JIO-AIRTEL Security issues to Ponder
STARLINK-JIO-AIRTEL Security issues to PonderSTARLINK-JIO-AIRTEL Security issues to Ponder
STARLINK-JIO-AIRTEL Security issues to Ponder
anupriti
?
GDG Cloud Southlake #41: Shay Levi: Beyond the Hype:How Enterprises Are Using AI
GDG Cloud Southlake #41: Shay Levi: Beyond the Hype:How Enterprises Are Using AIGDG Cloud Southlake #41: Shay Levi: Beyond the Hype:How Enterprises Are Using AI
GDG Cloud Southlake #41: Shay Levi: Beyond the Hype:How Enterprises Are Using AI
James Anderson
?
How Telemedicine App Development is Revolutionizing Virtual Care.pptx
How Telemedicine App Development is Revolutionizing Virtual Care.pptxHow Telemedicine App Development is Revolutionizing Virtual Care.pptx
How Telemedicine App Development is Revolutionizing Virtual Care.pptx
Dash Technologies Inc
?
Why Outsource Accounting to India A Smart Business Move!.pdf
Why Outsource Accounting to India A Smart Business Move!.pdfWhy Outsource Accounting to India A Smart Business Move!.pdf
Why Outsource Accounting to India A Smart Business Move!.pdf
anjelinajones6811
?
UiPath NY AI Series: Session 4: UiPath AutoPilot for Developers using Studio Web
UiPath NY AI Series: Session 4: UiPath AutoPilot for Developers using Studio WebUiPath NY AI Series: Session 4: UiPath AutoPilot for Developers using Studio Web
UiPath NY AI Series: Session 4: UiPath AutoPilot for Developers using Studio Web
DianaGray10
?
CIOs Speak Out - A Research Series by Jasper Colin
CIOs Speak Out - A Research Series by Jasper ColinCIOs Speak Out - A Research Series by Jasper Colin
CIOs Speak Out - A Research Series by Jasper Colin
Jasper Colin
?
Artificial Neural Networks, basics, its variations and examples
Artificial Neural Networks, basics, its variations and examplesArtificial Neural Networks, basics, its variations and examples
Artificial Neural Networks, basics, its variations and examples
anandsimple
?
Build Your Uber Clone App with Advanced Features
Build Your Uber Clone App with Advanced FeaturesBuild Your Uber Clone App with Advanced Features
Build Your Uber Clone App with Advanced Features
V3cube
?

GOING AOT WITH GRAALVM FOR JAVA - JAVAZONE

  • 1. Alina Yurenko Developer Advocate for GraalVM Oracle JavaZone Going AOT: Everything you need to know about GraalVM for Java applications Photo by Andrea Brataas on Unsplash
  • 2. ? Alina Yurenko / @alina_yurenko ? Developer Advocate for GraalVM at Oracle ? Love open source and communities ? ? Love both programming ?? ? & natural languages ? ?? About me @alina_yurenko
  • 4. An advanced JDK with ahead-of-time Native Image compilation
  • 6. 2017 Year 2018 2019 2020 2021 2022 2023 2005 2011 ... ... Sun Labs¡¯ Maxine Java JVM initial release December Native Image open sourced April Twitter uses Graal JIT for core microservices October Micronaut 1.0 with Native Image support April GraalVM 1.0 released April Thomas Wuerthinger joins Oracle and starts Graal compiler project March Spring Native goes beta November Quarkus 1.0 with Native Image support May GraalVM goes GA (19.0 release) September MicroDoc announces GraalVM for embedded July Alibaba deploys Native Image in production July Facebook deploys GraalVM in production May AWS SDK support for Native Image November Spring Boot 3 with Native Image support December OpenJDK Galahad project proposed July Google Cloud Platform SDK support for Native Image June GraalVM Free Terms and Conditions license September GraalOS & Layered Native Image announced March Azure SDK support for Native Image September Oracle Cloud runs services on GraalVM Graal History ? ? ? ? @alina_yurenko
  • 7. GraalVM Native Image AOT Compilation Ahead-of-Time Compilation Application Libraries JDK Substrate VM Points-to Analysis Run Initializations Heap Snapshotting Input: All classes from application, libraries, and VM Code in Text Section Image Heap in Data Section Image Heap Writing Output: Native executable @alina_yurenko
  • 9. GraalVM Native Image¡ªFast Start Up and Much More Improved Security Fast Start & Scale Lower Resource Usage Compact Packaging Predictable Performance Supported Azure AWS GCP OCI @alina_yurenko
  • 11. NATIVE IMAGE BUILD-TIME DISCOVERY AND CONFIGURATION SPRING BOOT RUN-TIME DISCOVERY AND CONFIGURATION
  • 12. SPRING BOOT NATIVE IMAGE SPRING AOT
  • 14. SPRING AOT JAVA SOURCE FILES BYTECODE HINT FILES
  • 16. Libraries, dynamic Java features, and Native Image ? Libraries might be Native-Image friendly out of the box ? twitter.com/YunaMorgenstern/status/1729039787351536084 ? Libraries might include config for Native Image: ? github.com/h2database/h2database/blob/master/h2/src/main/META-INF/native-image/ ? Libraries might contain config in the Reachability Metadata Repository ? github.com/oracle/graalvm-reachability-metadata/tree/master/metadata/io.netty ? You can use framework support to produce custom ¡°hints¡± for Native Image runtimeHints.resources().registerPattern(¡°config/app.properties¡±); ? You can use the Tracing Agent to produce the necessary config automatically ? graalvm.org/latest/reference-manual/native-image/metadata/AutomaticMetadataCollection/ ? You can provide/extend config for reflection, JNI, resources, serialization, and predefined classes manually in JSON: ? graalvm.org/latest/reference-manual/native-image/metadata/#specifying-metadata-with-json Happy path; most of the cases Custom code/ libraries @alina_yurenko
  • 17. Ready for GraalVM Native Image graalvm.org/native-image/libraries-and-frameworks @alina_yurenko
  • 19. AOT at the speed of JIT ? ? Profile-guided optimizations Collect and use profiles at build time to optimize for the specific runtime behaviour of your application ? ML-enabled PGO Use a ML model to automatically predict the profile of the application ? G1 GC Optimize GC for peak throughput ? `-march=native` Optimize for the specific hardware features of the machine you¡¯ll be running on @alina_yurenko
  • 20. Spring PetClinic: Peak throughput @alina_yurenko
  • 21. Spring PetClinic: Memory Efficiency @alina_yurenko
  • 22. Spring PetClinic Performance on Oracle GraalVM GraalVM CE with C2 JIT Oracle GraalVM Native Image Memory Usage (max RSS) 1,029 MB 641 MB Peak throughput 11,066 req/s 11,902 req/s Throughput per memory 12,488 req/(GB*s) 18,569 req/(GB*s) Tail latency (P99) 7.2ms 5.15ms Startup 7,090ms 210ms -38% lower +8% higher +49% better -28% lower 34x faster @alina_yurenko
  • 24. Cross-Platform Builds on GitHub Actions Windows Executable macOS Executable Linux Executable .class .jar .class .jar GraalVM GitHub Action ? ?? @alina_yurenko
  • 25. ? Reduced attack surface area due to dead code removal¡ª unused classes, methods, and fields not included in executable Improved Security ? Not vulnerable to JIT compiler attacks all code is AOT compiled ? SBOM supporting industry standards Embedded in executables CycloneDX format ? Not vulnerable to deserialization attacks via class loading¡ªexecutable includes only required and specified classes Reduced Attack Surface ? ?? @alina_yurenko
  • 26. ? Migrate ? ? Add Native Build Tools ? Alternatively, use recent versions of frameworks ? Evaluate libraries: graalvm.org/native-image/libraries-and-frameworks ? Build and deploy ? ¡â? ? ? ? ¡â? ? ¡â? ? ¡â? ? ¡â? ? ¡â? ? ¡â? ? ¡â? ? ¡â? ? ¡â? ? ¡â? ? ¡â? ? ¡â? ? ¡â? ? Build and test on GraalVM as the JVM, build with Native Image closer to the deployment ? Quick build mode with `-Ob` ? Use CI/CD systems (e.g. GitHub actions) for deployment and cross-platform builds ? Run faster ? ? PGO ? ML-enabled PGO ? G1 GC ? `-march=native` Recommendations @alina_yurenko
  • 28. ? Java 22 features ? The fastest GraalVM yet :) ? Developer experience improvements Learn more: medium.com/graalvm GraalVM for JDK 22 ? @alina_yurenko
  • 29. cwiki.apache.org/confluence/display/KAFKA/KIP-974%3A+Docker+Image+for+GraalVM+based+Native+Kafka+Broker Native Kafka Broker ? ? Average startup time is ~130ms; ? No CPU spike is observed for GraalVM; the JVM broker had sudden spikes when the broker started and also when the load testing started; ? For JVM broker the max memory usage went up to ~1GB. For GraalVM is was ~500MB with G1GC and ~250MB with serial GC.
  • 30. Layered Native Images Micronaut base Micronaut extensions (Web, Data, Test) Spring base App 1 App 2 App 3 Deployment: resources sharing ?? JDK base Application code Development: fast recompilation ? JDK base + Micronaut base+ all extensions App 4 @alina_yurenko
  • 31. GraalOS¡ªAdvanced cloud native application deployment platform Fast Start GraalOS applications start fast with virtually no cold start cost Low Latency Excellent 99th percentile latency makes GraalOS applications highly responsive Run On Demand GraalOS applications are automatically suspended and resumed on demand ¡ªwith no idle cost Applications, not Containers GraalOS uses the latest advances in x86 and AArch64 processor architectures for hardware enforced application isolation without containers Reduced Memory GraalOS applications require significantly less memory resulting in reduced operating costs Cloud Native With support for stateful and stateless services and functions, GraalOS is ideal for cloud native applications Runs applications as small, fast GraalVM Native Image compiled machine executables @alina_yurenko
  • 32. Compact Packaging GraalVM Native Image¡ªIdeal for Cloud Native Applications Improved Security Fast Start & Scale Lower Resource Usage Predictable Performance Supported Azure AWS GCP OCI @alina_yurenko
  • 33. graalvm.org sdk install java 22.0.1-graal Get started with GraalVM ? github.com/ graalvm/graalvm- demos docker pull container- registry.oracle.com/gr aalvm/jdk:22 @alina_yurenko
  • 34. Questions & let¡¯s connect! Demos ? @alina_yurenko
  • 35. Please rate this session!:) ?

Editor's Notes

  • #37: What is GraalOS? ? GraalOS is a high performance serverless Java-based application deployment platform. It uses GraalVM Native Image to run your application as a native machine executable¡ªtaking full advantage of the latest x64 and AArch64 processor features available on Oracle Cloud Infrastructure (OCI). An application deployed to GraalOS will be less expensive to operate and help reduce your cloud costs. Fast Start A GraalOS application starts fast with virtually no ¡°cold start¡± cost. Unlike container-based platforms that suffer from significant cold start costs, a GraalOS application is a small native Linux executable that starts in 10s of milliseconds. Reduced Memory A GraalOS application requires significantly less memory thanks to GraalVM Native Image ahead-of-time (AOT) compilation. In turn, lower memory usage has a direct impact on your operating costs: pricing structures for most cloud services, including OCI Functions, have a significant memory usage element. GraalOS can typically reduce your application memory by at least 50%. Run On Demand A GraalOS application is automatically suspended and resumed when called¡ªwith no idle cost. Applications and functions that are not receiving requests are terminated on most serverless platforms after a timeout period has been exceeded. An application that is subsequently invoked is subject to a cold start cost. GraalOS¡¯s ability to suspend and rapidly resume your idle applications means no cold start. Applications, not Containers GraalOS runs native Linux executables directly¡ªtaking advantage of the latest advances in hardware-enforced application isolation. This approach removes the need to package your application into a container, which eliminates challenges such as selecting a secure container image and ensuring that the latest security patches are in place and updated regularly. Cloud Native With support for stateful and stateless microservices and functions, GraalOS is ideal for cloud native applications. Both short-lived functions and long-running microservices will benefit from GraalOS features such as virtually no cold start, transparent suspend and resume, and no cost idle. OCI Functions Powered by GraalOS? The first use of GraalOS is in OCI Functions: it will add a new ¡°Graal Function¡± type that will start much faster and require less memory than existing OCI functions. Thanks to the built-in OCI Functions triggers provided by OCI services such as Events, Connector Hub, Data Integration, API Gateway, and Notifications, all these services will be able to take advantage of GraalOS-powered functions with no changes. To learn more, see Rishikesh Palve¡¯s blog ¡°Ultra-fast Serverless Functions Powered by GraalOS¡±.