@ C H R I S T H A L I N G E R
G R A A L : H O W T O U S E T H E
N E W J V M J I T C O M P I L E R I N
R E A L L I F E
@ C H R I S T H A L I N G E R
# T W I T T E R V M T E A M
WHY THI S TALK?
The main purpose of my talks is to get people to try Graal
Save money, fix bugs, improve Graal
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
WHY THI S TALK?
The main purpose of my talks is to get people to try Graal
Save money, fix bugs, improve Graal
Also, people come up to me and ask…
Is it save to use it? How do I use it? Where do I get it?
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
WHY THI S TALK?
The main purpose of my talks is to get people to try Graal
Save money, fix bugs, improve Graal
Also, people come up to me and ask…
Is it save to use it? How do I use it? Where do I get it?
Sometimes they send me emails
Mostly complaining about benchmark numbers
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
WHY THI S TALK?
The main purpose of my talks is to get people to try Graal
Save money, fix bugs, improve Graal
Also, people come up to me and ask…
Is it save to use it? How do I use it? Where do I get it?
Sometimes they send me emails
Mostly complaining about benchmark numbers
…and that it SUCKS!
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
WANNA KNOW M ORE ABOU T SAVIN G MONEY?
Lots of details in my talk (available on YouTube):
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
WHAT IS G RAAL?
Java Virtual Machine Just-in-Time (JIT) compiler
Actively developed by Oracle Labs
http://openjdk.java.net/projects/graal/
https://github.com/oracle/graal
Uses JVMCI (JEP 243)
Written in Java
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
WRITTEN IN
JAVA!!!
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
WHERE D O I GE T IT?
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
WHERE D O I GE T IT?
JEP 295: Ahead-of-Time Compilation
http://openjdk.java.net/jeps/295
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
WHERE D O I GE T IT?
JEP 295: Ahead-of-Time Compilation
http://openjdk.java.net/jeps/295
JEP 317: Experimental Java-Based JIT Compiler
http://openjdk.java.net/jeps/317
JDK 10: http://jdk.java.net/10
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
Get it demo
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
https://cloud.oracle.com
ABOUT ME…
Working on JVMs for over 13 years
Sun Microsystems/Oracle HotSpot compiler team
JSR 292: Supporting Dynamically Typed Languages on the
JavaTM Platform
JEP 243: Java-Level JVM Compiler Interface
JEP 295: Ahead-of-Time Compilation
Twitter VM team
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
Back to demo
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
HOW DO I USE IT ?
Get a JDK with Graal (jdk.internal.vm.compiler)
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
HOW DO I USE IT ?
Get a JDK with Graal (jdk.internal.vm.compiler)
✅
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
HOW DO I USE IT ?
Get a JDK with Graal (jdk.internal.vm.compiler)
✅
Turn it on!
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
Use it demo
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
WHAT IS BOOTST RAP PIN G?
Graal is just another Java application running in your JVM
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
WHAT IS BOOTST RAP PIN G?
Graal is just another Java application running in your JVM
It loads Java classes
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
WHAT IS BOOTST RAP PIN G?
Graal is just another Java application running in your JVM
It loads Java classes
Has Java methods
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
WHAT IS BOOTST RAP PIN G?
Graal is just another Java application running in your JVM
It loads Java classes
Has Java methods
Which (at some point) need to be compiled, obviously
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
Bootstrap
demo
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
WHAT WE LE ARNE D
Bootstrapping compiles a lot of methods
tiered: about 2,500
non-tiered: about 4,800
Either upfront or on-demand during runtime
By default on-demand compiles Graal with C1 only
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
JAVA HEAP U SAGE
Graal is…
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
WRITTEN IN
JAVA!!!
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
JAVA HEAP U SAGE
Compiling application methods will use Java heap memory
Graal methods possibly too
Remember CompileGraalWithC1Only?
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
Java heap
demo
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
WHAT WE LE ARNE D
Graal uses Java heap memory
There is no heap isolation (yet)
Most memory usage during startup
Usually when application isn’t fully up yet
Memory is used anyway
Either malloc or Java heap
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
RUNNING BLEE DING E DGE
Get Graal from GitHub
https://github.com/oracle/graal
https://github.com/graalvm/mx
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
Build Graal
demo
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
RUNNING IN PRODUCTION
The bootstrapping overhead is usually negligible
Additional time (mostly) disappears in the startup noise
Free CPU cores are used for compilation
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
Production
demo
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
Scala demo
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
SUMMARY
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
-XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
@ C H R I S T H A L I N G E R | # T W I T T E R V M T E A M
# T W I T T E R V M T E A M
Dostları ilə paylaş: |