SlideShare a Scribd company logo
Adopting GraalVM
@petr_zapletal
Adopting GraalVM - NE Scala 2019
GraalVM: Run Programs Faster Anywhere
Compiling with GraalVM
Adopting GraalVM - NE Scala 2019
sbt --java-home <path-to-graal-vm>
-XX:+UnlockExperimentalVMOptions
-XX:+EnableJVMCI
-XX:+UseJVMCICompiler
● JDK 10/11 requires Scala 2.13
Limitations & Challenges
● JDK 10/11 requires Scala 2.13
● Limited library support
Limitations & Challenges
● JDK 10/11 requires Scala 2.13
● Limited library support
● Scaladex
Limitations & Challenges
● JDK 10/11 requires Scala 2.13
● Limited library support
● Scaladex
● Disabling compiler optimization
Limitations & Challenges
Adopting GraalVM - NE Scala 2019
JDK 11
[success] Total time: 571 s, ...
real 12m48.492s
user45m40.264s
sys 2m31.045s
vs.
Graal
(using the flags)
[success] Total time: 507 s, ...
real 11m34.191s
user41m52.512s
sys 2m12.863s
Stopwatch Compiling
GraalVM Runtime
Just-in-time compilation
Compilation & JVM
Just-in-time (JIT)
● Compiles while running
● Dynamic compilation
● Runtime information
● De-optimization
● Typical for JVM
Ahead-of-time (AOT)
● Compiles before running
● Static compilation
● More resources
● Way more time
● Uncommon for JVM (JDK 9+)
java -XX:+UnlockExperimentalVMOptions
-XX:+EnableJVMCI
-XX:+UseJVMCICompiler
object Main extends App {
val max = 10000000
def isPrime(n: Int): Boolean =
primes.takeWhile(p => p*p <= n).forall(n % _ != 0)
val primes = 2 #:: Stream.from(3,2).filter(isPrime)
primes.takeWhile(_ <= max).toList
}
Primes
Primes
object Main extends App {
val max = 10000000
def isPrime(n: Int): Boolean =
primes.takeWhile(p => p*p <= n).forall(n % _ != 0)
val primes = 2 #:: Stream.from(3,2).filter(isPrime)
primes.takeWhile(_ <= max).toList
}
Primes
object Main extends App {
val max = 10000000
def isPrime(n: Int): Boolean =
primes.takeWhile(p => p*p <= n).forall(n % _ != 0)
val primes = 2 #:: Stream.from(3,2).filter(isPrime)
primes.takeWhile(_ <= max).toList
}
Primes
object Main extends App {
val max = 10000000
def isPrime(n: Int): Boolean =
primes.takeWhile(p => p*p <= n).forall(n % _ != 0)
val primes = 2 #:: Stream.from(3,2).filter(isPrime)
primes.takeWhile(_ <= max).toList
}
jdk 1.8.0_161-b12
time <path-to-java>/java -jar
primes.jar
real 0m11.646s
user0m14.286s
sys 0m0.657s
vs.
graalvm-ee-1.0.0-rc8
time <path-to-graal>/java
-XX:+UnlockExperimentalVMO
ptions
-XX:+EnableJVMCI
-XX:+UseJVMCICompiler
-jar primes.jar
real 0m13.478s
user0m29.199s
sys 0m0.975s
Primes
Adopting GraalVM - NE Scala 2019
class Primes {
@Benchmark
@BenchmarkMode(Array(Mode.AverageTime))
@OutputTimeUnit(TimeUnit.MICROSECONDS)
def getPrimes() = primes.takeWhile(_ <= max).toList
}
object Main extends App {
new Primes().getPrimes()
}
Primes II
class Primes {
@Benchmark
@BenchmarkMode(Array(Mode.AverageTime))
@OutputTimeUnit(TimeUnit.MICROSECONDS)
def getPrimes() = primes.takeWhile(_ <= max).toList
}
object Main extends App {
new Primes().getPrimes()
}
Primes II
jdk 1.8.0_161-b12
jmh:run -i 10 -wi 10 -f4 -t4
Primes
[info] Benchmark Mode Cnt
Score Error Units
**[info] Primes.getPrimes
avgt 40 45652.951 ±
2083.281 us/op**
vs.
graalvm-ee-1.0.0-rc8
jmh:run -i 10 -wi 10 -f4 -t4
Primes
[info] Benchmark Mode Cnt
Score Error Units
**[info] Primes.getPrimes
avgt 40 40535.844 ±
1977.021 us/op**
Primes II
(Early) Adopters
GraalVM Runtime
Ahead-of-time compilation
<path-to-graal>/bin/native-image
● JVM starts slowly
● Scala makes it worse
● JARs bloat up quickly
● JVM needs a lot of RAM
JVM Shortcomings
JDK 1.8 (JIT)
time java -jar primes.jar
real 0m0.555s
user 0m0.613s
sys 0m0.075s
vs.
GraalVM (AOT)
<path-to-graal>/bin/native-i
mage -jar primes.jar
time ./primes
real 0m0.039s
user 0m0.004s
sys 0m0.010s
Counting Primes
JDK 1.8 (JIT)
time java -jar primes.jar
real 0m11.954s
user 0m14.077s
sys 0m0.739s
vs.
GraalVM (AOT)
<path-to-graal>/bin/native-i
mage -jar primes.jar
time ./primes
Segmentation fault: 11
real 0m0.324s
user 0m0.245s
sys 0m0.077s
Counting Primes
● Small programs/scripts/CLIs
● Alexa apps
● AWS Lambdas (using GO
runtime)
Use Cases
Do you want to use Scala
in cases like these?
There is More
Summary
Questions
References
References
● https://github.com/scala/make-release-notes/blob/2.13.x/projects-2.13.md
● https://index.scala-lang.org/search?q=fullScalaVersion%3A2.13.0-M5
● https://github.com/oracle/graal/blob/master/substratevm/LIMITATIONS.md
● https://www.youtube.com/watch?v=Rvb-kvuPzqI
● https://github.com/chrisseaton/graalvm-ten-things
● https://www.youtube.com/watch?v=wBegU4d4GRc
● https://engineering.opsgenie.com/run-native-java-using-graalvm-in-aws-lambda-with-golan
g-ba86e27930bf
● https://medium.com/graalvm/instant-netty-startup-using-graalvm-native-image-generation-
ed6f14ff7692
● https://www.infoq.com/articles/Graal-Java-JIT-Compiler
● https://medium.com/graalvm/compiling-scala-faster-with-graalvm-86c5c0857fa3
Images
● https://cdn.app.compendium.com/uploads/user/e7c690e8-6ff9-102a-ac6d-e4aebca50
425/d7eaeb73-4b9e-4764-ad10-b5785d99d114/Image/497cab5d0638a34c8a08194ef
b83b2fc/announcing_graalvm_version7.png
● https://cdn-images-1.medium.com/max/2000/1*rHZFwj8uu-x8KVCItuu53Q.png
● https://unsplash.com/photos/4m7gmLNr3M0
● https://www.tecflow.com/uk/images/slechte-koude-start-tecflow.jpg

More Related Content

PDF
Adopting GraalVM - Scale by the Bay 2018
Petr Zapletal
 
PDF
GraalVM Overview Compact version
scalaconfjp
 
PDF
GraalVM: Run Programs Faster Everywhere
J On The Beach
 
PDF
GraalVm and Quarkus
Sascha Rodekamp
 
PDF
Java and Containers: What's there to think about? | DevNation Tech Talk
Red Hat Developers
 
PPTX
Discover Quarkus and GraalVM
Romain Schlick
 
PPTX
Migration Spring PetClinic to Quarkus
Jonathan Vila
 
Adopting GraalVM - Scale by the Bay 2018
Petr Zapletal
 
GraalVM Overview Compact version
scalaconfjp
 
GraalVM: Run Programs Faster Everywhere
J On The Beach
 
GraalVm and Quarkus
Sascha Rodekamp
 
Java and Containers: What's there to think about? | DevNation Tech Talk
Red Hat Developers
 
Discover Quarkus and GraalVM
Romain Schlick
 
Migration Spring PetClinic to Quarkus
Jonathan Vila
 

What's hot (20)

PDF
Percona XtraDB Cluster before every release: Glimpse into CI testing
Raghavendra Prabhu
 
PDF
Spring Boot to Quarkus: A real app migration experience | DevNation Tech Talk
Red Hat Developers
 
PPTX
Monitoring kubernetes with prometheus-operator
Lili Cosic
 
PDF
client-go: The Good, The Bad and The Ugly
Lili Cosic
 
PPTX
Real World Enterprise Reactive Programming using Vert.x
Sascha Möllering
 
PDF
Elasticsearch Monitoring in Openshift
Lukas Vlcek
 
PDF
Serverless, Tekton, and Argo CD: How to craft modern CI/CD workflows | DevNat...
Red Hat Developers
 
PDF
Improving security with Istio | DevNation Tech Talk
Red Hat Developers
 
PDF
To the moon and beyond with Java 17 APIs! | DevNation Tech Talk
Red Hat Developers
 
PDF
jLove 2020 - Micronaut and graalvm: The power of AoT
Iván López Martín
 
PPTX
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
Owais Zahid
 
PDF
Elastic JVM for Scalable Java EE Applications Running in Containers #Jakart...
Jelastic Multi-Cloud PaaS
 
PDF
Overview of the Open Source Vulkan Driver for Raspberry Pi 4
Igalia
 
PDF
OpenCms Days 2012 - Developing OpenCms with Gradle
Alkacon Software GmbH & Co. KG
 
PDF
REST in Peace. Long live gRPC!
QAware GmbH
 
PDF
GraalVMの紹介とTruffleでPHPぽい言語を実装したら爆速だった話
なおき きしだ
 
PPTX
An OpenShift Migration: From 3.9 to 4.5
Everett Toews
 
PDF
Using GitLab CI
Lingvokot
 
PDF
The 2nd half. Scaling to the next^2
Haggai Philip Zagury
 
PPTX
Using Rally for OpenStack certification at Scale
Boris Pavlovic
 
Percona XtraDB Cluster before every release: Glimpse into CI testing
Raghavendra Prabhu
 
Spring Boot to Quarkus: A real app migration experience | DevNation Tech Talk
Red Hat Developers
 
Monitoring kubernetes with prometheus-operator
Lili Cosic
 
client-go: The Good, The Bad and The Ugly
Lili Cosic
 
Real World Enterprise Reactive Programming using Vert.x
Sascha Möllering
 
Elasticsearch Monitoring in Openshift
Lukas Vlcek
 
Serverless, Tekton, and Argo CD: How to craft modern CI/CD workflows | DevNat...
Red Hat Developers
 
Improving security with Istio | DevNation Tech Talk
Red Hat Developers
 
To the moon and beyond with Java 17 APIs! | DevNation Tech Talk
Red Hat Developers
 
jLove 2020 - Micronaut and graalvm: The power of AoT
Iván López Martín
 
HOW TO CREATE AWESOME POLYGLOT APPLICATIONS USING GRAALVM
Owais Zahid
 
Elastic JVM for Scalable Java EE Applications Running in Containers #Jakart...
Jelastic Multi-Cloud PaaS
 
Overview of the Open Source Vulkan Driver for Raspberry Pi 4
Igalia
 
OpenCms Days 2012 - Developing OpenCms with Gradle
Alkacon Software GmbH & Co. KG
 
REST in Peace. Long live gRPC!
QAware GmbH
 
GraalVMの紹介とTruffleでPHPぽい言語を実装したら爆速だった話
なおき きしだ
 
An OpenShift Migration: From 3.9 to 4.5
Everett Toews
 
Using GitLab CI
Lingvokot
 
The 2nd half. Scaling to the next^2
Haggai Philip Zagury
 
Using Rally for OpenStack certification at Scale
Boris Pavlovic
 
Ad

Similar to Adopting GraalVM - NE Scala 2019 (20)

PDF
Adopting GraalVM - Scala eXchange London 2018
Petr Zapletal
 
PDF
Native Java with GraalVM
Sylvain Wallez
 
PPT
Jvm Performance Tunning
guest1f2740
 
PPT
Jvm Performance Tunning
Terry Cho
 
PPTX
Java 어플리케이션 성능튜닝 Part1
상욱 송
 
PDF
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
Jelastic Multi-Cloud PaaS
 
PDF
JavaCro'14 - Unit testing in AngularJS – Slaven Tomac
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
PDF
My name is Trinidad
David Calavera
 
PDF
Python + GDB = Javaデバッガ
Kenji Kazumura
 
PPT
Inside the JVM - Performance & Garbage Collector Tuning in JAVA
Rafael Monteiro e Pereira
 
PPTX
Slaven tomac unit testing in angular js
Slaven Tomac
 
PDF
Java and Containers - Make it Awesome !
Dinakar Guniguntala
 
PDF
Continuous Integration for front-end JavaScript
Lars Thorup
 
PPTX
16 ARTIFACTS TO CAPTURE WHEN YOUR CONTAINER APPLICATION IS IN TROUBLE
Tier1 app
 
PPTX
Java profiling Do It Yourself (jug.msk.ru 2016)
aragozin
 
PDF
DevoxxUK: Optimizating Application Performance on Kubernetes
Dinakar Guniguntala
 
PDF
OSCON2012TroubleShootJava
William Au
 
PDF
In the Brain of Hans Dockter: Gradle
Skills Matter
 
PDF
Eric Lafortune - The Jack and Jill build system
GuardSquare
 
PPT
Java performance
Sergey D
 
Adopting GraalVM - Scala eXchange London 2018
Petr Zapletal
 
Native Java with GraalVM
Sylvain Wallez
 
Jvm Performance Tunning
guest1f2740
 
Jvm Performance Tunning
Terry Cho
 
Java 어플리케이션 성능튜닝 Part1
상욱 송
 
State of Java Elasticity. Tuning Java Efficiency - GIDS.JAVA LIVE 2020
Jelastic Multi-Cloud PaaS
 
JavaCro'14 - Unit testing in AngularJS – Slaven Tomac
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
My name is Trinidad
David Calavera
 
Python + GDB = Javaデバッガ
Kenji Kazumura
 
Inside the JVM - Performance & Garbage Collector Tuning in JAVA
Rafael Monteiro e Pereira
 
Slaven tomac unit testing in angular js
Slaven Tomac
 
Java and Containers - Make it Awesome !
Dinakar Guniguntala
 
Continuous Integration for front-end JavaScript
Lars Thorup
 
16 ARTIFACTS TO CAPTURE WHEN YOUR CONTAINER APPLICATION IS IN TROUBLE
Tier1 app
 
Java profiling Do It Yourself (jug.msk.ru 2016)
aragozin
 
DevoxxUK: Optimizating Application Performance on Kubernetes
Dinakar Guniguntala
 
OSCON2012TroubleShootJava
William Au
 
In the Brain of Hans Dockter: Gradle
Skills Matter
 
Eric Lafortune - The Jack and Jill build system
GuardSquare
 
Java performance
Sergey D
 
Ad

More from Petr Zapletal (10)

PDF
Change Data Capture - Scale by the Bay 2019
Petr Zapletal
 
PDF
Real World Serverless
Petr Zapletal
 
PDF
Reactive mistakes - ScalaDays Chicago 2017
Petr Zapletal
 
PDF
Reactive mistakes reactive nyc
Petr Zapletal
 
PDF
Distributed Stream Processing - Spark Summit East 2017
Petr Zapletal
 
PDF
Top Mistakes When Writing Reactive Applications - Scala by the Bay 2016
Petr Zapletal
 
PDF
Distributed Real-Time Stream Processing: Why and How 2.0
Petr Zapletal
 
PDF
Distributed real time stream processing- why and how
Petr Zapletal
 
PPTX
Spark Concepts - Spark SQL, Graphx, Streaming
Petr Zapletal
 
PPTX
MLlib and Machine Learning on Spark
Petr Zapletal
 
Change Data Capture - Scale by the Bay 2019
Petr Zapletal
 
Real World Serverless
Petr Zapletal
 
Reactive mistakes - ScalaDays Chicago 2017
Petr Zapletal
 
Reactive mistakes reactive nyc
Petr Zapletal
 
Distributed Stream Processing - Spark Summit East 2017
Petr Zapletal
 
Top Mistakes When Writing Reactive Applications - Scala by the Bay 2016
Petr Zapletal
 
Distributed Real-Time Stream Processing: Why and How 2.0
Petr Zapletal
 
Distributed real time stream processing- why and how
Petr Zapletal
 
Spark Concepts - Spark SQL, Graphx, Streaming
Petr Zapletal
 
MLlib and Machine Learning on Spark
Petr Zapletal
 

Recently uploaded (20)

PDF
Using licensed Data Loss Prevention (DLP) as a strategic proactive data secur...
Q-Advise
 
PDF
Balancing Resource Capacity and Workloads with OnePlan – Avoid Overloading Te...
OnePlan Solutions
 
PDF
MiniTool Power Data Recovery Crack New Pre Activated Version Latest 2025
imang66g
 
PDF
Protecting the Digital World Cyber Securit
dnthakkar16
 
PPTX
Presentation about Database and Database Administrator
abhishekchauhan86963
 
PPTX
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
PDF
vAdobe Premiere Pro 2025 (v25.2.3.004) Crack Pre-Activated Latest
imang66g
 
PPTX
Role Of Python In Programing Language.pptx
jaykoshti048
 
PPTX
Presentation about variables and constant.pptx
kr2589474
 
PPTX
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
PDF
advancepresentationskillshdhdhhdhdhdhhfhf
jasmenrojas249
 
PDF
10 posting ideas for community engagement with AI prompts
Pankaj Taneja
 
PPTX
AI-Ready Handoff: Auto-Summaries & Draft Emails from MQL to Slack in One Flow
bbedford2
 
PDF
Summary Of Odoo 18.1 to 18.4 : The Way For Odoo 19
CandidRoot Solutions Private Limited
 
PPTX
Presentation about variables and constant.pptx
safalsingh810
 
PDF
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
PPTX
slidesgo-unlocking-the-code-the-dynamic-dance-of-variables-and-constants-2024...
kr2589474
 
PDF
New Download MiniTool Partition Wizard Crack Latest Version 2025
imang66g
 
PPTX
ASSIGNMENT_1[1][1][1][1][1] (1) variables.pptx
kr2589474
 
PPTX
Contractor Management Platform and Software Solution for Compliance
SHEQ Network Limited
 
Using licensed Data Loss Prevention (DLP) as a strategic proactive data secur...
Q-Advise
 
Balancing Resource Capacity and Workloads with OnePlan – Avoid Overloading Te...
OnePlan Solutions
 
MiniTool Power Data Recovery Crack New Pre Activated Version Latest 2025
imang66g
 
Protecting the Digital World Cyber Securit
dnthakkar16
 
Presentation about Database and Database Administrator
abhishekchauhan86963
 
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
vAdobe Premiere Pro 2025 (v25.2.3.004) Crack Pre-Activated Latest
imang66g
 
Role Of Python In Programing Language.pptx
jaykoshti048
 
Presentation about variables and constant.pptx
kr2589474
 
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
advancepresentationskillshdhdhhdhdhdhhfhf
jasmenrojas249
 
10 posting ideas for community engagement with AI prompts
Pankaj Taneja
 
AI-Ready Handoff: Auto-Summaries & Draft Emails from MQL to Slack in One Flow
bbedford2
 
Summary Of Odoo 18.1 to 18.4 : The Way For Odoo 19
CandidRoot Solutions Private Limited
 
Presentation about variables and constant.pptx
safalsingh810
 
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
slidesgo-unlocking-the-code-the-dynamic-dance-of-variables-and-constants-2024...
kr2589474
 
New Download MiniTool Partition Wizard Crack Latest Version 2025
imang66g
 
ASSIGNMENT_1[1][1][1][1][1] (1) variables.pptx
kr2589474
 
Contractor Management Platform and Software Solution for Compliance
SHEQ Network Limited
 

Adopting GraalVM - NE Scala 2019