SlideShare une entreprise Scribd logo
The Cloud Native Compiler:
JIT-as-a-Service
Presented by Simon Ritter, Deputy CTO | Azul
2
Why Is Java So Popular?
• It's a great language
o Easy to write, easy to read
• It has great libraries
o Pretty much anything you can think off, almost always a FOSS version as well as commercial
• It has a great community
o JUGs, Champions, conferences, etc, etc
o Easy to find Java programmers
• But really, it's the Java Virtual Machine
o Write once, run anywhere
o Excellent backwards compatibility
o A managed runtime environment
3
JVM Performance Warmup
• Classfiles contain bytecodes (instructions for a Virtual Machine)
• Initially, these are interpreted
o Each bytecode is converted to equivalent native instructions
• Frequently used methods (hotspots) are identified and compiled
o Just-in-Time (JIT) compilation
o Uses two compilers, C1 (fast compile, low optimisation) and C2 (slow compile, high optimisation)
• Each time the application is started, the same process begins again
o Profile code looking for hot methods
o Compile using C1 JIT, recompile using C2 JIT when hot enough
4
JVM Performance Graph
Application
Warmup
5
The Way JVMs Work Now
• Isolated
• Not connected to other instances
o No memory of past runs
• Entirely self-reliant
o Limited to local resources
o Limited to local functionality
o Results in multiple trade-offs
• No Magic Cloud
• Limited compute power
• Limited storage
• Limited local functionality
• Limited analytical capabilities
• Limited knowledge
6
Microservice-Based Application
7
Microservice-Based Application
8
Microservice-Based Application
9
JVMs In The Cloud
• Connected to vast networks
• Can leverage and rely on…
o external resources
o external functionality
o external experience
• Can leverage (and contribute to) additional value
• Assume access to a “magic cloud”
o “unlimited” compute power
o “unlimited” data storage
o “unlimited” analytical capabilities
o “knowledge”, “experience”, …
10
Cloud Native JVMs
• Has all the functionality of a JVM
• Outsources some of that core functionality to the cloud
• Delivers value to the cloud and to other JVMs that use that cloud
11
JVM Architecture
12
Basic Theory of JIT Compiler
• JVM provides “here is code I’d like to make better”
• JIT Compiler asks many “what do you know about X?” questions
• JIT Compiler eventually provides “here is code for your situation”
• JVM replaces existing code with new (hopefully better) code
• This is (currently) done with in-JVM JIT compilers
Speculative Optimisation
(The Secret of Java's Speed)
14
Example 1: Inlining Monomorphic Sites
public class Animal {
private int color;
public int getColor() { return color };
}
myColor = animal.getColor();
can be transformed to:
myColor = animal.color;
As long as only one implementer of getColor() existslic
class Animal {
15
Example 2: Branch Analysis
int computeMagnitude(int value) {
if (value > 9)
bias = computeBias(value);
else
bias = 1;
return Math.log10(bias + 99);
}
Profiling data shows that value (so far) has never been greater than 9
16
Example 2: Branch Analysis
Assume that, based on profiling, value will continue to be less than 10
int computeMagnitude(int value) {
if (value > 9)
uncommonTrap(); // Deoptimise
return 2; // Math.log10(100)
}
17
JVM Performance Graph
Deoptimisation
18
Speculatively Optimised Code
Optimised Code
Assumptions
(That must hold true
for code to work)
Only one getColor()
method exists
value is less than 10
19
JVM Performance Graph
Better optimisations
20
How To Get Better Optimisations?
• Array processing example
21
OpenJDK Hotspot C2 JIT
Per element jumps
2 elements per iteration
22
Azul Prime JVM Falcon JIT
Using AVX2 vector instructions
32 elements per iteration
Broadwell E5-2690-v4
23
Faster Code is... Faster
• Azul Prime JVM Falcon comparisson
24
The Reality Of Better JIT
25
Better JIT Compilation Has Cost
• We can apply more powerful optimizations and get (much) faster code
• But the JIT CPU and wall-clock time costs can grow significantly
• And so does the (JIT) memory footprint
• On powerful machines (e.g. 64 vcores) we can afford to do this
• But on more constrained/container environments…
o JIT CPU costs and wall clock time (& slowness) to optimization can become prohibitive
o JIT Memory footprint can lead to OOM Killer
• Can lead to tradeoffs between over-provisioning and foregoing higher optimization levels
26
Speed and CPU Usage Over Time
• 2 Vcore container
27
Speed and CPU Usage Over Time
• 2 Vcore container
28
What If We Took The JIT Out Of The JVM?
JIT Compiler
29
And Made It A Cloud-Based Resource
Cloud Native Compiler
30
Why?
31
Efficiency
Speed
Speed
Speed
Reduced
Warmup Time
Reduced
Memory Footprint
Right-sizing
$£€
32
Speed and CPU Usage Over Time
• 2 Vcore container
33
Speed and CPU Usage Over Time
• 2 Vcore container
34
Speed and CPU Usage Over Time
• 2 Vcore container
35
Isn't This Just Shifting The Cost?
• Well, Yes…
• But we are shifting it to a much more efficient place
• optimization resources are used for a tiny fraction of wall clock time
• When a JVM optimizes locally, it must carry dedicated resources to do so
• When outsourced to a Cloud Native Compiler
o The resources are shared and reused
o The resources can be elastic
36
JIT-as-a-Service
Cloud Native Compiler
37
JIT-as-a-Service
Cloud Native
Compiler
That's elastic
38
There's More...
39
Application Code Realities
• The vast majority of application code:
o Executes more than once
o Runs on more than one device
o Repeats the same tasks across runs and devices
o Has a limited set of common behavior profiles
• This is true even for rapidly changing applications…
• This is “lost” when JVMs do their own local, ephemeral optimizations
40
Code Can Be Reused
Even with speculative optimisations
41
Optimised Code
Assumptions
(That must hold true
for code to work)
Cloud Native
Compiler
42
Isn't This Just Shifting The Cost?
• Well, Yes…
• But we are shifting it to a much more efficient place
• optimization resources are used for a tiny fraction of wall clock time
• When a JVM optimizes locally, it must carry dedicated resources to do so
• When outsourced to a Cloud Native Compiler
o The resources are shared and reused
o The resources can be elastic
• The work can be reused
43
Cloud Native Compiler Is Better
44
Cloud Native Compiler Is Better
Cloud Native
Compiler
45
Summary
46
Cloud Native Compiler
• Decoupling the JIT from the JVM has many advantages
o Better resource utilisation
o Better optimised code reuse
o Faster warmup
o and more...
• The cloud Native Compiler exists today
• Azul Platform Prime
• Try for free
https://www.azul.com/products/prime/stream-download/
Thank You.
Simon Ritter, Deputy CTO
@speakjava

Contenu connexe

Similaire à Cloud Native Compiler

What's Inside a JVM?
What's Inside a JVM?What's Inside a JVM?
What's Inside a JVM?
Azul Systems Inc.
 
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot RuntimesJfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
Charlie Gracie
 
Latest (storage IO) patterns for cloud-native applications
Latest (storage IO) patterns for cloud-native applications Latest (storage IO) patterns for cloud-native applications
Latest (storage IO) patterns for cloud-native applications
OpenEBS
 
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, AzulBetter Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
HostedbyConfluent
 
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, AzulBetter Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
HostedbyConfluent
 
Secrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on KubernetesSecrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on Kubernetes
Bruno Borges
 
How the HotSpot and Graal JVMs execute Java Code
How the HotSpot and Graal JVMs execute Java CodeHow the HotSpot and Graal JVMs execute Java Code
How the HotSpot and Graal JVMs execute Java Code
Jim Gough
 
Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019
graemerocher
 
A tour of Java and the JVM
A tour of Java and the JVMA tour of Java and the JVM
A tour of Java and the JVM
Alex Birch
 
Sista: Improving Cog’s JIT performance
Sista: Improving Cog’s JIT performanceSista: Improving Cog’s JIT performance
Sista: Improving Cog’s JIT performance
ESUG
 
Distributed Tensorflow with Kubernetes - data2day - Jakob Karalus
Distributed Tensorflow with Kubernetes - data2day - Jakob KaralusDistributed Tensorflow with Kubernetes - data2day - Jakob Karalus
Distributed Tensorflow with Kubernetes - data2day - Jakob Karalus
Jakob Karalus
 
JPrime_JITServer.pptx
JPrime_JITServer.pptxJPrime_JITServer.pptx
JPrime_JITServer.pptx
Grace Jansen
 
"JIT compiler overview" @ JEEConf 2013, Kiev, Ukraine
"JIT compiler overview" @ JEEConf 2013, Kiev, Ukraine"JIT compiler overview" @ JEEConf 2013, Kiev, Ukraine
"JIT compiler overview" @ JEEConf 2013, Kiev, UkraineVladimir Ivanov
 
Real-Time Voice Actuation
Real-Time Voice ActuationReal-Time Voice Actuation
Real-Time Voice ActuationPragya Agrawal
 
Java On CRaC
Java On CRaCJava On CRaC
Java On CRaC
Simon Ritter
 
Javaland_JITServerTalk.pptx
Javaland_JITServerTalk.pptxJavaland_JITServerTalk.pptx
Javaland_JITServerTalk.pptx
Grace Jansen
 
Understand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsUnderstand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java Applications
C4Media
 
Optimizing Java Notes
Optimizing Java NotesOptimizing Java Notes
Optimizing Java Notes
Adam Feldscher
 
Java performance monitoring
Java performance monitoringJava performance monitoring
Java performance monitoring
Simon Ritter
 
FOSDEM 2017 - Open J9 The Next Free Java VM
FOSDEM 2017 - Open J9 The Next Free Java VMFOSDEM 2017 - Open J9 The Next Free Java VM
FOSDEM 2017 - Open J9 The Next Free Java VM
Charlie Gracie
 

Similaire à Cloud Native Compiler (20)

What's Inside a JVM?
What's Inside a JVM?What's Inside a JVM?
What's Inside a JVM?
 
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot RuntimesJfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
 
Latest (storage IO) patterns for cloud-native applications
Latest (storage IO) patterns for cloud-native applications Latest (storage IO) patterns for cloud-native applications
Latest (storage IO) patterns for cloud-native applications
 
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, AzulBetter Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
 
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, AzulBetter Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
 
Secrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on KubernetesSecrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on Kubernetes
 
How the HotSpot and Graal JVMs execute Java Code
How the HotSpot and Graal JVMs execute Java CodeHow the HotSpot and Graal JVMs execute Java Code
How the HotSpot and Graal JVMs execute Java Code
 
Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019
 
A tour of Java and the JVM
A tour of Java and the JVMA tour of Java and the JVM
A tour of Java and the JVM
 
Sista: Improving Cog’s JIT performance
Sista: Improving Cog’s JIT performanceSista: Improving Cog’s JIT performance
Sista: Improving Cog’s JIT performance
 
Distributed Tensorflow with Kubernetes - data2day - Jakob Karalus
Distributed Tensorflow with Kubernetes - data2day - Jakob KaralusDistributed Tensorflow with Kubernetes - data2day - Jakob Karalus
Distributed Tensorflow with Kubernetes - data2day - Jakob Karalus
 
JPrime_JITServer.pptx
JPrime_JITServer.pptxJPrime_JITServer.pptx
JPrime_JITServer.pptx
 
"JIT compiler overview" @ JEEConf 2013, Kiev, Ukraine
"JIT compiler overview" @ JEEConf 2013, Kiev, Ukraine"JIT compiler overview" @ JEEConf 2013, Kiev, Ukraine
"JIT compiler overview" @ JEEConf 2013, Kiev, Ukraine
 
Real-Time Voice Actuation
Real-Time Voice ActuationReal-Time Voice Actuation
Real-Time Voice Actuation
 
Java On CRaC
Java On CRaCJava On CRaC
Java On CRaC
 
Javaland_JITServerTalk.pptx
Javaland_JITServerTalk.pptxJavaland_JITServerTalk.pptx
Javaland_JITServerTalk.pptx
 
Understand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsUnderstand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java Applications
 
Optimizing Java Notes
Optimizing Java NotesOptimizing Java Notes
Optimizing Java Notes
 
Java performance monitoring
Java performance monitoringJava performance monitoring
Java performance monitoring
 
FOSDEM 2017 - Open J9 The Next Free Java VM
FOSDEM 2017 - Open J9 The Next Free Java VMFOSDEM 2017 - Open J9 The Next Free Java VM
FOSDEM 2017 - Open J9 The Next Free Java VM
 

Plus de Simon Ritter

The Art of Java Type Patterns
The Art of Java Type PatternsThe Art of Java Type Patterns
The Art of Java Type Patterns
Simon Ritter
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java Workshop
Simon Ritter
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java Workshop
Simon Ritter
 
Getting the Most From Modern Java
Getting the Most From Modern JavaGetting the Most From Modern Java
Getting the Most From Modern Java
Simon Ritter
 
Building a Better JVM
Building a Better JVMBuilding a Better JVM
Building a Better JVM
Simon Ritter
 
JDK 14 Lots of New Features
JDK 14 Lots of New FeaturesJDK 14 Lots of New Features
JDK 14 Lots of New Features
Simon Ritter
 
Java after 8
Java after 8Java after 8
Java after 8
Simon Ritter
 
How to Choose a JDK
How to Choose a JDKHow to Choose a JDK
How to Choose a JDK
Simon Ritter
 
Java Programming
Java ProgrammingJava Programming
Java Programming
Simon Ritter
 
The Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans TechnologyThe Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans Technology
Simon Ritter
 
Developing Enterprise Applications Using Java Technology
Developing Enterprise Applications Using Java TechnologyDeveloping Enterprise Applications Using Java Technology
Developing Enterprise Applications Using Java Technology
Simon Ritter
 
Is Java Still Free?
Is Java Still Free?Is Java Still Free?
Is Java Still Free?
Simon Ritter
 
Moving Towards JDK 12
Moving Towards JDK 12Moving Towards JDK 12
Moving Towards JDK 12
Simon Ritter
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and Beyond
Simon Ritter
 
Java Is Still Free
Java Is Still FreeJava Is Still Free
Java Is Still Free
Simon Ritter
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and Beyond
Simon Ritter
 
JDK 9 and JDK 10 Deep Dive
JDK 9 and JDK 10 Deep DiveJDK 9 and JDK 10 Deep Dive
JDK 9 and JDK 10 Deep Dive
Simon Ritter
 
JDK 9 Deep Dive
JDK 9 Deep DiveJDK 9 Deep Dive
JDK 9 Deep Dive
Simon Ritter
 
Java Support: What's changing
Java Support:  What's changingJava Support:  What's changing
Java Support: What's changing
Simon Ritter
 
JDK 9: The Start of a New Future for Java
JDK 9: The Start of a New Future for JavaJDK 9: The Start of a New Future for Java
JDK 9: The Start of a New Future for Java
Simon Ritter
 

Plus de Simon Ritter (20)

The Art of Java Type Patterns
The Art of Java Type PatternsThe Art of Java Type Patterns
The Art of Java Type Patterns
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java Workshop
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java Workshop
 
Getting the Most From Modern Java
Getting the Most From Modern JavaGetting the Most From Modern Java
Getting the Most From Modern Java
 
Building a Better JVM
Building a Better JVMBuilding a Better JVM
Building a Better JVM
 
JDK 14 Lots of New Features
JDK 14 Lots of New FeaturesJDK 14 Lots of New Features
JDK 14 Lots of New Features
 
Java after 8
Java after 8Java after 8
Java after 8
 
How to Choose a JDK
How to Choose a JDKHow to Choose a JDK
How to Choose a JDK
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
The Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans TechnologyThe Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans Technology
 
Developing Enterprise Applications Using Java Technology
Developing Enterprise Applications Using Java TechnologyDeveloping Enterprise Applications Using Java Technology
Developing Enterprise Applications Using Java Technology
 
Is Java Still Free?
Is Java Still Free?Is Java Still Free?
Is Java Still Free?
 
Moving Towards JDK 12
Moving Towards JDK 12Moving Towards JDK 12
Moving Towards JDK 12
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and Beyond
 
Java Is Still Free
Java Is Still FreeJava Is Still Free
Java Is Still Free
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and Beyond
 
JDK 9 and JDK 10 Deep Dive
JDK 9 and JDK 10 Deep DiveJDK 9 and JDK 10 Deep Dive
JDK 9 and JDK 10 Deep Dive
 
JDK 9 Deep Dive
JDK 9 Deep DiveJDK 9 Deep Dive
JDK 9 Deep Dive
 
Java Support: What's changing
Java Support:  What's changingJava Support:  What's changing
Java Support: What's changing
 
JDK 9: The Start of a New Future for Java
JDK 9: The Start of a New Future for JavaJDK 9: The Start of a New Future for Java
JDK 9: The Start of a New Future for Java
 

Dernier

Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 

Dernier (20)

Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 

Cloud Native Compiler

  • 1. The Cloud Native Compiler: JIT-as-a-Service Presented by Simon Ritter, Deputy CTO | Azul
  • 2. 2 Why Is Java So Popular? • It's a great language o Easy to write, easy to read • It has great libraries o Pretty much anything you can think off, almost always a FOSS version as well as commercial • It has a great community o JUGs, Champions, conferences, etc, etc o Easy to find Java programmers • But really, it's the Java Virtual Machine o Write once, run anywhere o Excellent backwards compatibility o A managed runtime environment
  • 3. 3 JVM Performance Warmup • Classfiles contain bytecodes (instructions for a Virtual Machine) • Initially, these are interpreted o Each bytecode is converted to equivalent native instructions • Frequently used methods (hotspots) are identified and compiled o Just-in-Time (JIT) compilation o Uses two compilers, C1 (fast compile, low optimisation) and C2 (slow compile, high optimisation) • Each time the application is started, the same process begins again o Profile code looking for hot methods o Compile using C1 JIT, recompile using C2 JIT when hot enough
  • 5. 5 The Way JVMs Work Now • Isolated • Not connected to other instances o No memory of past runs • Entirely self-reliant o Limited to local resources o Limited to local functionality o Results in multiple trade-offs • No Magic Cloud • Limited compute power • Limited storage • Limited local functionality • Limited analytical capabilities • Limited knowledge
  • 9. 9 JVMs In The Cloud • Connected to vast networks • Can leverage and rely on… o external resources o external functionality o external experience • Can leverage (and contribute to) additional value • Assume access to a “magic cloud” o “unlimited” compute power o “unlimited” data storage o “unlimited” analytical capabilities o “knowledge”, “experience”, …
  • 10. 10 Cloud Native JVMs • Has all the functionality of a JVM • Outsources some of that core functionality to the cloud • Delivers value to the cloud and to other JVMs that use that cloud
  • 12. 12 Basic Theory of JIT Compiler • JVM provides “here is code I’d like to make better” • JIT Compiler asks many “what do you know about X?” questions • JIT Compiler eventually provides “here is code for your situation” • JVM replaces existing code with new (hopefully better) code • This is (currently) done with in-JVM JIT compilers
  • 14. 14 Example 1: Inlining Monomorphic Sites public class Animal { private int color; public int getColor() { return color }; } myColor = animal.getColor(); can be transformed to: myColor = animal.color; As long as only one implementer of getColor() existslic class Animal {
  • 15. 15 Example 2: Branch Analysis int computeMagnitude(int value) { if (value > 9) bias = computeBias(value); else bias = 1; return Math.log10(bias + 99); } Profiling data shows that value (so far) has never been greater than 9
  • 16. 16 Example 2: Branch Analysis Assume that, based on profiling, value will continue to be less than 10 int computeMagnitude(int value) { if (value > 9) uncommonTrap(); // Deoptimise return 2; // Math.log10(100) }
  • 18. 18 Speculatively Optimised Code Optimised Code Assumptions (That must hold true for code to work) Only one getColor() method exists value is less than 10
  • 20. 20 How To Get Better Optimisations? • Array processing example
  • 21. 21 OpenJDK Hotspot C2 JIT Per element jumps 2 elements per iteration
  • 22. 22 Azul Prime JVM Falcon JIT Using AVX2 vector instructions 32 elements per iteration Broadwell E5-2690-v4
  • 23. 23 Faster Code is... Faster • Azul Prime JVM Falcon comparisson
  • 24. 24 The Reality Of Better JIT
  • 25. 25 Better JIT Compilation Has Cost • We can apply more powerful optimizations and get (much) faster code • But the JIT CPU and wall-clock time costs can grow significantly • And so does the (JIT) memory footprint • On powerful machines (e.g. 64 vcores) we can afford to do this • But on more constrained/container environments… o JIT CPU costs and wall clock time (& slowness) to optimization can become prohibitive o JIT Memory footprint can lead to OOM Killer • Can lead to tradeoffs between over-provisioning and foregoing higher optimization levels
  • 26. 26 Speed and CPU Usage Over Time • 2 Vcore container
  • 27. 27 Speed and CPU Usage Over Time • 2 Vcore container
  • 28. 28 What If We Took The JIT Out Of The JVM? JIT Compiler
  • 29. 29 And Made It A Cloud-Based Resource Cloud Native Compiler
  • 32. 32 Speed and CPU Usage Over Time • 2 Vcore container
  • 33. 33 Speed and CPU Usage Over Time • 2 Vcore container
  • 34. 34 Speed and CPU Usage Over Time • 2 Vcore container
  • 35. 35 Isn't This Just Shifting The Cost? • Well, Yes… • But we are shifting it to a much more efficient place • optimization resources are used for a tiny fraction of wall clock time • When a JVM optimizes locally, it must carry dedicated resources to do so • When outsourced to a Cloud Native Compiler o The resources are shared and reused o The resources can be elastic
  • 39. 39 Application Code Realities • The vast majority of application code: o Executes more than once o Runs on more than one device o Repeats the same tasks across runs and devices o Has a limited set of common behavior profiles • This is true even for rapidly changing applications… • This is “lost” when JVMs do their own local, ephemeral optimizations
  • 40. 40 Code Can Be Reused Even with speculative optimisations
  • 41. 41 Optimised Code Assumptions (That must hold true for code to work) Cloud Native Compiler
  • 42. 42 Isn't This Just Shifting The Cost? • Well, Yes… • But we are shifting it to a much more efficient place • optimization resources are used for a tiny fraction of wall clock time • When a JVM optimizes locally, it must carry dedicated resources to do so • When outsourced to a Cloud Native Compiler o The resources are shared and reused o The resources can be elastic • The work can be reused
  • 44. 44 Cloud Native Compiler Is Better Cloud Native Compiler
  • 46. 46 Cloud Native Compiler • Decoupling the JIT from the JVM has many advantages o Better resource utilisation o Better optimised code reuse o Faster warmup o and more... • The cloud Native Compiler exists today • Azul Platform Prime • Try for free https://www.azul.com/products/prime/stream-download/
  • 47. Thank You. Simon Ritter, Deputy CTO @speakjava