SlideShare a Scribd company logo
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
NEW PROFESSIONAL
JAVA EVENT
MARCH 21ST, 2020
KYIV, UKRAINE
Vadym Kazulkin
Projects Valhalla, Loom and GraalVM
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Contact
Vadym Kazulkin, ip.labs GmbH
v.kazulkin@gmail.com
https://www.linkedin.com/in/vadymkazulkin/
@VKazulkin
Co-Org Java User Group Bonn and Serverless Bonn Meetup
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
ip.labs GmbH
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Agenda
• Project Valhalla (Inline Types)
• Project Loom (Lightweight Threads and Continuations)
• GraalVM
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Valhalla
Inline Types
Source: http://openjdk.java.net/projects/valhalla/
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Inline types = Value types
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Valhalla
Goal:
• Reboot the layout of data in memory
Source: Brian Goetz, Oracle „Evolving the Java Language” https://www.youtube.com/watch?v=A-mxj2vhVAA
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Valhalla
Motivation:
• Hardware has changed
• Multi-core
• The cost of cache misses has increased
Source: Brian Goetz, Oracle „Evolving the Java Language” https://www.youtube.com/watch?v=A-mxj2vhVAA
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Valhalla
Hardware Memory Model
Source: https://www.enterpriseai.news/2014/06/30/shared-memory-clusters-101/
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Valhalla
Motivation
Source: „Latency Numbers Every Programmer Should Know”
https://people.eecs.berkeley.edu/~rcs/research/interactive_latency.html
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Valhalla
Motivation
Source: „Latency Numbers Every Programmer Should Know”
https://people.eecs.berkeley.edu/~rcs/research/interactive_latency.html
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Valhalla
Storing objects in the Java Heap has its price, because storing
object’s metadata consumes additional memory for :
• flags facilitating synchronization/locking
• Identity and polymorphismus
• garbage collection
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Valhalla
Inline Types
Inline Type is an immutable type that is distinguishable only
by the state of its properties
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Valhalla
Inline Types
Immutable: an instance of an inline-type can’t change, once it’s been
created
Identity-less: inline-types of the same type with the same contents are
indistinguishable from each other
Flattenable: JVMs are allowed to flatten an inline-type inside of its
container
Source: Tobi Ajila “Welcome to LWorld: The current state of value types in Java “
https://www.youtube.com/watch?v=Xf22I16jVyE&list=LLYgjRSI2oCzI9eooyFrWR7A&index=11
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Valhalla
Source: „What Is Project Valhalla?” https://dzone.com/articles/what-is-project-valhalla
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Valhalla
Benefits:
• Reduced memory usage
• Reduced indirection
• Increased locality
Codes like a class, works like a primitive (Brian
Goetz)
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Valhalla
Benefit: Reduced Memory Usage
No additional memory to store object metadata, such as flags
facilitating synchronization, identity, polymorphismus and
garbage collection
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Valhalla
Benefit: Reduced indirection
• Since objects are stored as reference types in Java, each time
an object is accessed it must first be dereferenced, causing
additional instructions to be executed
• The flattened data associated with inline types are immediately
present in the location in which they are needed and therefore,
require no dereferencing
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Valhalla
Benefit: Increased locality
• Flattened value objects remove indirection which increases the
likelihood that values are adjacently stored in memory–
especially for arrays or other contiguous memory structures
such as classes (i.e. if a class contains inline type fields)
• Consequently increases the chance of cache hits, because of
hardware prefetch of the cache lines
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Valhalla
Inline Types
inline class Point {long x, y ;}
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Valhalla
Inline Types
Can
• have method and field
• implement interfaces
• use encapsulation
• be generic
Can’t
• be mutated
• be sub-classed
• be cloned
• be Enums
Source: Tobi Ajila “Welcome to LWorld: The current state of value types in Java “
https://www.youtube.com/watch?v=Xf22I16jVyE&list=LLYgjRSI2oCzI9eooyFrWR7A&index=11
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Valhalla
Inline Types Hierarchy
Source: Tobi Ajila “Welcome to LWorld: The current state of value types in Java “
https://www.youtube.com/watch?v=Xf22I16jVyE&list=LLYgjRSI2oCzI9eooyFrWR7A&index=11
Object
Point?
Point
Nullable Inline Type (Point or null)
Inline Type
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Valhalla
Inline Types Hierarchy
Source: Tobi Ajila “Welcome to LWorld: The current state of value types in Java “
https://www.youtube.com/watch?v=Xf22I16jVyE&list=LLYgjRSI2oCzI9eooyFrWR7A&index=11
Object
Point?
Point
Nullable Inline Type (Point or null)
Inline Type
Object[]
Point?[]
Point[]
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Valhalla
Current Status:
• Released public prototype LW2
• Can declare and use inline types (inline classes)
• No support for generics yet List<Point> // compilation error
• No support for specialized generics (Point<T>)
• No Support for migration of existing classes (like Optional)
• Memory Layout optimizations implemented
• Compiler/Virtual Machine optimizations implemented
• A lot of challenges to solve (read the article
https://www.infoq.com/news/2019/07/valhalla-openjdk-lw2-released/)
Source: Brian Goetz, Oracle „Valhalla Update” https://www.youtube.com/watch?v=1H4vmT-Va4o
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Valhalla
Open Questions:
• Migration of existing classes (Option, LocaDateTime) to inline classes
• Nullity
• Equality
• GraalVM Support
• How Java type system should look like
Source: Brian Goetz, Oracle „Valhalla Update” https://www.youtube.com/watch?v=1H4vmT-Va4o
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Valhalla
How Java type system should look like ?
Source: Tobi Ajila “Welcome to LWorld: The current state of value types in Java “
https://www.youtube.com/watch?v=Xf22I16jVyE&list=LLYgjRSI2oCzI9eooyFrWR7A&index=11
Object
ValObject
Inline
Types
RefObject
References
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Loom
Lightweight Thread and Continuations
Source: http://openjdk.java.net/projects/loom
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Lightweight Threads = Fibers
Lightweight Threads = Virtual Threads in the
newest prototype?
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Loom
Motivation:
Developers currently have 2 choices to write concurrent code:
• use blocking/synchronous API, which is simple, but less scalable (number of
threads, that OS supports is far less that open and concurrent connections
required)
• asynchronous API (Spring Project Reactor, RXJava 2), which is scalable, but
complex, harder to debug and profile and limited (no asynchronous JDBC
standard in this area)
Sources: Alan Bateman, Oracle „Project Loom: Fibers and Continuations for Java” https://www.youtube.com/watch?v=vbGbXUjlRyQ
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Loom
Goal:
To write simple and scalable code
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Loom
Lightweight Thread
Lightweight thread scheduled not by the OS, but by the Java Runtime
with low memory footprint and low task-switching cost
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Loom
Continuation
Continuation is a program object, representing a computation that
may be suspended and resumed
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Continuation
package java.lang;
public class Continuation {
public Continuation (ContinuationScope scope, Runnable target)
public final void run()
public static void yield (ContinuationScope scope)
public boolean isDone()
}
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Loom
Continuations
example () {
var scope = new ContinuationScope(„Example_Scope“);
var continuation = new Continuation (scope, () -> {
out.print(„1“);
Continuation.yield(scope);
out.print(„2“);
Continuation.yield(scope);
out.print(„3“);
Continuation.yield(scope);
});
while (! continuation.isDone()) {
out.print(„ run.. “);
continuation.run();
}
}
Output: run.. 1 run.. 2 run.. 3
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Loom
Lightweight Thread & Continuations
Thread
=
Continuation + Schedular
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Loom
Schedular
Schedular executes the task on a pool of carrier threads
• java.util.concurrent.Executor API exposes the Schedular
• Default schedular is a ForJoinPool
Source: Alan Bateman, Oracle „Project Loom Update” https://www.youtube.com/watch?v=NV46KFV1m-4
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Loom
Lightweight Thread Implementation
• Currently Thread and Lightweight Thread don’t have a common
supertype
• Thread.currentThread() in context of Lightweight Thread
• Creates adaptor (Shadow Thread)
• Adaptor emulates legacy Thread API (except deprecated methods like stop,
suspend and resume)
• Thread Local becomes Lightweight Thread Local
Source: Alan Bateman, Oracle „Project Loom Update” https://www.youtube.com/watch?v=NV46KFV1m-4
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Loom
Structured Concurrency
Basic idea: Everytime that the control splits into multiple concurrent paths, we
want to guarantee that they join up again
try (var scope= ThreadScope. open()) {
scope.schedule(task1);
scope.schedule(task2);
} //blocks until task1 and task2 terminate
Sources: Nathanial J. Smith „Notes on structured concurrency, or: Go statement considered harmful”
https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/
Roman Elizarov: “Structured concurrency with Coroutines in Kotlin” https://medium.com/@elizarov/structured-concurrency-722d765aa952
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Loom
Structured Concurrency
Cancelation:
• Each Lightweight Thread has cancel status which can only be set once, which sets
the interrupt status and unparks the Lightweight Thread
• The task can poll canceled status
try (var scope= ThreadScope. open(PROPAGATE_CANCEL)) {
scope.schedule(task1);
scope.schedule(task2);
} //canceling the lightweight thread executing this code will task1 and task2
Source: Alan Bateman, Oracle „Project Loom Update” https://www.youtube.com/watch?v=NV46KFV1m-4
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Loom
Lightweight Thread
Current Status:
• Lightweight Thread currently supports:
• scheduling
• parking/unparking
• waiting for a Lightweight Thread to terminate
• Lightweight Thread -friendly APIs
• java.util.concurrent Locks
• java.net.Socket/ServerSocket (since JDK 13)
• java.nio.channels.SocketChannel and Pipes (since JDK 11)
• Thread.sleep
• JSSE implementation of TLS
• AccessControl.doPrivileged (since JDK 12)
Source: Ron Pressler, Project Loom: Helping Write Concurrent Applications on the Java Platform
https://www.youtube.com/watch?v=lIq-x_iI-kc
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Loom
Current Status:
• Implemented initial prototype with Continuation and Lightweight
Thread support
• Current prototype of Continuations and Lightweight Thread can run
existing code
• Debugger Support
Current focus on:
• Performance improvement
• Stable Lightweight Thread API
• Java Flight Recorder support
Source: Alan Bateman, Oracle „Project Loom Update” https://www.youtube.com/watch?v=NV46KFV1m-4
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Loom
Limitations:
• Can‘t yield with native frames
Further Work:
• java.net.InetAddress
• Console I/O
• File I/O
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Loom
Open Questions:
• Should the existing Thread API be completely re-examined?
• Can all existing code be run on top of Lightweight Threads?
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Polyglot GraalVM
Source: http://openjdk.java.net/projects/metropolis
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Project Metropolis
Goals:
• Low footprint ahead-of-time mode for JVM-based languages
• High performance for all languages
• Convenient language interoperability and polyglot tooling
Source: „Everything you need to know about GraalVM by Oleg Šelajev & Thomas Wuerthinger”
https://www.youtube.com/watch?v=ANN9rxYo5Hg
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
JEP 317
Experimental Java-Based JIT Compiler
Graal, a Java-based JIT compiler on the Linux/x64 platform, is the basis of the
experimental Ahead-of-Time (AOT) compiler introduced in JDK 9.
To Enable:
-XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
GraalVM
Architecture
Sources: Practical Partial Evaluation for High-Performance Dynamic Language Runtimes http://chrisseaton.com/rubytruffle/pldi17-
truffle/pldi17-truffle.pdf
„The LLVM Compiler Infrastructure“ https://llvm.org/
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
GraalVM
Benchmarks
Sources: Renaissance Suite https://renaissance.dev/
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
GraalVM
libgraal Library
Sources: „libgraal: GraalVM compiler as a precompiled GraalVM native image“
https://medium.com/graalvm/libgraal-graalvm-compiler-as-a-precompiled-graalvm-native-image-26e354bee5c
libgraal jargraal
• libgraal is a shared library, produced by GraalVM Native Image with a pre-compiled
version of the GraalVM compiler
• In Java applications on GraalVM libgraal used as the top tier Just-In-Time compiler
• libgraal improves startup
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
GraalVM
Architecture
Sources: Practical Partial Evaluation for High-Performance Dynamic Language Runtimes http://chrisseaton.com/rubytruffle/pldi17-
truffle/pldi17-truffle.pdf
„The LLVM Compiler Infrastructure“ https://llvm.org/
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
SubstrateVM
Source: Oleg Šelajev, Thomas Wuerthinger, Oracle: “Deep dive into using GraalVM for Java and JavaScript”
https://www.youtube.com/watch?v=a-XEZobXspo
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
GraalVM and SubstrateVM
Source: Oleg Selajev, Oracle : “Run Code in Any Language Anywhere with GraalVM” https://www.youtube.com/watch?v=JoDOo4FyYMU
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
GraalVM on SubstrateVM
A game changer for Java & Serverless?
Cold Start :
Source: Ajay Nair „Become a Serverless Black Belt” https://www.youtube.com/watch?v=oQFORsso2go
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
AWS Lambda cold start time
by supported language
Source: Yan Cui: https://read.acloud.guru/does-coding-language-memory-or-package-size-affect-cold-starts-of-aws-lambda-a15e26d12c76
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
GraalVM on SubstrateVM
A game changer for Java & Serverless?
Java Function compiled into a native executable using GraalVM on
SubstrateVM reduces
• “cold start” times
• memory footprint
by order of magnitude compared to running on JVM.
And both memory and execution time are cost dimension, when using
Serverless in the cloud
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
GraalVM on SubstrateVM
A game changer for Java & Serverless?
Current challenges native executable using GraalVM :
• Most Cloud Providers (AWS) doesn’t provide GraalVM as Java Runtime
out of the box, only Open JDK (e.g. AWS provides Corretto)
• Some Cloud Providers (AWS) provide Custom Runtime Option
• Docker Image with GraalVM instead of Open JDK
• Frameworks like Micronaut and Quarkus which provide tooling for generating
Custom Runtime for cloud providers
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
GraalVM Complitation Modes
Source: „Everything you need to know about GraalVM by Oleg Šelajev & Thomas Wuerthinger”
https://www.youtube.com/watch?v=ANN9rxYo5Hg
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
AOT vs JIT
Source: „Everything you need to know about GraalVM by Oleg Šelajev & Thomas Wuerthinger”
https://www.youtube.com/watch?v=ANN9rxYo5Hg
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
Support of GraalVM native images in Frameworks
• Spring Framework: working toward GraalVM native image support without
requiring additional configuration or workaround is one of the themes of
upcoming Spring Framework 5.3
• Spring Boot: Ongoing work on experimental Spring Graal Native project. Probably
ready for the 2.4 release
• Quarkus: a Kubernetes Native Java framework developed by Red Hat tailored for
GraalVM and HotSpot, crafted from best-of-breed Java libraries and standards.
• Micronaut: a modern, JVM-based, full-stack framework for building modular,
easily testable microservice and serverless applications.
Source: „GraalVM native image support“ https://github.com/spring-projects/spring-framework/wiki/GraalVM-native-image-support
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
GraalVM Current State
Source: „Everything you need to know about GraalVM by Oleg Šelajev & Thomas Wuerthinger”
https://www.youtube.com/watch?v=ANN9rxYo5Hg
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
is still an interesting and great
programming language
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
NEW PROFESSIONAL JAVA EVENT KYIV, 2020
www.iplabs.de
Thank You!

More Related Content

What's hot (20)

PPTX
Moving to the Client - JavaFX and HTML5
Stephen Chin
 
PDF
GR8Conf 2011: Adopting Grails
GR8Conf
 
PPT
Developing modular Java applications
Julien Dubois
 
PDF
Migrating to Java 9 Modules
Sander Mak (@Sander_Mak)
 
PPT
Moving to the Client - JavaFX and HTML5 (PowerPoint Version)
Stephen Chin
 
PPTX
Why jakarta ee matters (ConFoo 2021)
Ryan Cuprak
 
PDF
Java 9 Modularity in Action
Sander Mak (@Sander_Mak)
 
PDF
Modular Java applications with OSGi on Apache Karaf
Ioan Eugen Stan
 
PPTX
GWT – The Java Advantage
Yoav Aharoni
 
PDF
Java Modularity: the Year After
Sander Mak (@Sander_Mak)
 
PDF
Project Jigsaw in JDK 9: Modularity Comes To Java
C4Media
 
PDF
Polygot Java EE on the GraalVM
Ryan Cuprak
 
PPTX
Java modules using project jigsaw@jdk 9
Mauricio "Maltron" Leal
 
PDF
Origyn Web Browser 2008 (Rmll)
Jean-Charles Verdié
 
PDF
Java APIs- The missing manual (concurrency)
Hendrik Ebbers
 
PDF
Nadeus Education Services session on Google Apps and Google App Engine
Nadeus Education Services
 
PPTX
Modularization With Project Jigsaw in JDK 9
Simon Ritter
 
PDF
Karaf ee-apachecon eu-2012
Charles Moulliard
 
PPTX
JavaFX 2 Using the Spring Framework
Stephen Chin
 
PDF
Java 11 OMG
Hendrik Ebbers
 
Moving to the Client - JavaFX and HTML5
Stephen Chin
 
GR8Conf 2011: Adopting Grails
GR8Conf
 
Developing modular Java applications
Julien Dubois
 
Migrating to Java 9 Modules
Sander Mak (@Sander_Mak)
 
Moving to the Client - JavaFX and HTML5 (PowerPoint Version)
Stephen Chin
 
Why jakarta ee matters (ConFoo 2021)
Ryan Cuprak
 
Java 9 Modularity in Action
Sander Mak (@Sander_Mak)
 
Modular Java applications with OSGi on Apache Karaf
Ioan Eugen Stan
 
GWT – The Java Advantage
Yoav Aharoni
 
Java Modularity: the Year After
Sander Mak (@Sander_Mak)
 
Project Jigsaw in JDK 9: Modularity Comes To Java
C4Media
 
Polygot Java EE on the GraalVM
Ryan Cuprak
 
Java modules using project jigsaw@jdk 9
Mauricio "Maltron" Leal
 
Origyn Web Browser 2008 (Rmll)
Jean-Charles Verdié
 
Java APIs- The missing manual (concurrency)
Hendrik Ebbers
 
Nadeus Education Services session on Google Apps and Google App Engine
Nadeus Education Services
 
Modularization With Project Jigsaw in JDK 9
Simon Ritter
 
Karaf ee-apachecon eu-2012
Charles Moulliard
 
JavaFX 2 Using the Spring Framework
Stephen Chin
 
Java 11 OMG
Hendrik Ebbers
 

Similar to JavaFest. Вадим Казулькин. Projects Valhalla, Loom and GraalVM (20)

PDF
Projects Valhalla and Loom at IT Tage 2021
Vadym Kazulkin
 
PDF
Highlights from Java 10-13 and Future of Java at JCON 2019 by Alukhanov and K...
Vadym Kazulkin
 
PDF
Projects Valhalla, Loom and GraalVM at JUG Mainz
Vadym Kazulkin
 
PDF
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Vadym Kazulkin
 
PDF
Java 23 and Beyond - A Roadmap Of Innovations
Ana-Maria Mihalceanu
 
PPTX
Projects Valhalla, Loom and GraalVM at JCon 2020
Vadym Kazulkin
 
PDF
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
PDF
Lecture 8 - Qooxdoo - Rap Course At The University Of Szeged
Fabian Jakobs
 
PDF
Java in a world of containers
Docker, Inc.
 
PDF
Java in a World of Containers - DockerCon 2018
Arun Gupta
 
PPTX
Could Virtual Threads cast away the usage of Kotlin Coroutines
João Esperancinha
 
PDF
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
Vadym Kazulkin
 
PPTX
Trends and future of java
Csaba Toth
 
PDF
Cannibalising The Google App Engine
catherinewall
 
PDF
Cloud Conference Day - Revolutionize Java Database App Development with React...
Juarez Junior
 
PDF
Exciting Features and Enhancements in Java 23 and 24
Ana-Maria Mihalceanu
 
PDF
GraalVM and Oracle's Documentation Trends.pdf
ohupalo
 
PDF
Java Course 15: Ant, Scripting, Spring, Hibernate
Anton Keks
 
PPTX
Jenkins advance topic
Kalkey
 
PDF
Eclipse MicroProfile 과 Microservice Java framework – Helidon
Oracle Korea
 
Projects Valhalla and Loom at IT Tage 2021
Vadym Kazulkin
 
Highlights from Java 10-13 and Future of Java at JCON 2019 by Alukhanov and K...
Vadym Kazulkin
 
Projects Valhalla, Loom and GraalVM at JUG Mainz
Vadym Kazulkin
 
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Vadym Kazulkin
 
Java 23 and Beyond - A Roadmap Of Innovations
Ana-Maria Mihalceanu
 
Projects Valhalla, Loom and GraalVM at JCon 2020
Vadym Kazulkin
 
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
Lecture 8 - Qooxdoo - Rap Course At The University Of Szeged
Fabian Jakobs
 
Java in a world of containers
Docker, Inc.
 
Java in a World of Containers - DockerCon 2018
Arun Gupta
 
Could Virtual Threads cast away the usage of Kotlin Coroutines
João Esperancinha
 
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
Vadym Kazulkin
 
Trends and future of java
Csaba Toth
 
Cannibalising The Google App Engine
catherinewall
 
Cloud Conference Day - Revolutionize Java Database App Development with React...
Juarez Junior
 
Exciting Features and Enhancements in Java 23 and 24
Ana-Maria Mihalceanu
 
GraalVM and Oracle's Documentation Trends.pdf
ohupalo
 
Java Course 15: Ant, Scripting, Spring, Hibernate
Anton Keks
 
Jenkins advance topic
Kalkey
 
Eclipse MicroProfile 과 Microservice Java framework – Helidon
Oracle Korea
 
Ad

More from FestGroup (10)

PPTX
JavaFest. Барух Садогурский. DevOps для разработчиков (или против них?!)
FestGroup
 
PDF
JavaFest. Виктор Полищук. Legacy: как победить в гонке
FestGroup
 
PDF
JavaFest. Cedrick Lunven. Build APIS with SpringBoot - REST, GRPC, GRAPHQL wh...
FestGroup
 
PDF
JavaFest. Philipp Krenn. Scale Elasticsearch for Your Java Applications
FestGroup
 
PDF
JavaFest. Grzegorz Piwowarek. Hazelcast - Hitchhiker’s Guide
FestGroup
 
PDF
JavaFest. Денис Макогон. 6 заблуждений относительно современной Java
FestGroup
 
PDF
JavaFest. Taras Boychuk. There is always a choice. Spring Data JDBC vs. Hiber...
FestGroup
 
PDF
JavaFest. Антон Лемешко. Model-Driven Development in the Open Java Universe
FestGroup
 
PDF
JavaFest. Дмитрий Сергеев. Data processing with Kafka Streams and Spring Fram...
FestGroup
 
PDF
JavaFest. Nanne Baars. Web application security for developers
FestGroup
 
JavaFest. Барух Садогурский. DevOps для разработчиков (или против них?!)
FestGroup
 
JavaFest. Виктор Полищук. Legacy: как победить в гонке
FestGroup
 
JavaFest. Cedrick Lunven. Build APIS with SpringBoot - REST, GRPC, GRAPHQL wh...
FestGroup
 
JavaFest. Philipp Krenn. Scale Elasticsearch for Your Java Applications
FestGroup
 
JavaFest. Grzegorz Piwowarek. Hazelcast - Hitchhiker’s Guide
FestGroup
 
JavaFest. Денис Макогон. 6 заблуждений относительно современной Java
FestGroup
 
JavaFest. Taras Boychuk. There is always a choice. Spring Data JDBC vs. Hiber...
FestGroup
 
JavaFest. Антон Лемешко. Model-Driven Development in the Open Java Universe
FestGroup
 
JavaFest. Дмитрий Сергеев. Data processing with Kafka Streams and Spring Fram...
FestGroup
 
JavaFest. Nanne Baars. Web application security for developers
FestGroup
 
Ad

Recently uploaded (20)

PPTX
Capitol Doctoral Presentation -July 2025.pptx
CapitolTechU
 
PPTX
How to Manage Access Rights & User Types in Odoo 18
Celine George
 
PPTX
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
PPTX
Explorando Recursos do Summer '25: Dicas Essenciais - 02
Mauricio Alexandre Silva
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PPTX
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PPTX
Gall bladder, Small intestine and Large intestine.pptx
rekhapositivity
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PPTX
LEGAL ASPECTS OF PSYCHIATRUC NURSING.pptx
PoojaSen20
 
PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
PPTX
SCHOOL-BASED SEXUAL HARASSMENT PREVENTION AND RESPONSE WORKSHOP
komlalokoe
 
PDF
IMP NAAC REFORMS 2024 - 10 Attributes.pdf
BHARTIWADEKAR
 
PDF
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
PPTX
How to Configure Prepayments in Odoo 18 Sales
Celine George
 
PPTX
How to Define Translation to Custom Module And Add a new language in Odoo 18
Celine George
 
PDF
Federal dollars withheld by district, charter, grant recipient
Mebane Rash
 
PPTX
Presentation: Climate Citizenship Digital Education
Karl Donert
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PPTX
How to Configure Lost Reasons in Odoo 18 CRM
Celine George
 
Capitol Doctoral Presentation -July 2025.pptx
CapitolTechU
 
How to Manage Access Rights & User Types in Odoo 18
Celine George
 
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
Explorando Recursos do Summer '25: Dicas Essenciais - 02
Mauricio Alexandre Silva
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
Gall bladder, Small intestine and Large intestine.pptx
rekhapositivity
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
LEGAL ASPECTS OF PSYCHIATRUC NURSING.pptx
PoojaSen20
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
SCHOOL-BASED SEXUAL HARASSMENT PREVENTION AND RESPONSE WORKSHOP
komlalokoe
 
IMP NAAC REFORMS 2024 - 10 Attributes.pdf
BHARTIWADEKAR
 
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
How to Configure Prepayments in Odoo 18 Sales
Celine George
 
How to Define Translation to Custom Module And Add a new language in Odoo 18
Celine George
 
Federal dollars withheld by district, charter, grant recipient
Mebane Rash
 
Presentation: Climate Citizenship Digital Education
Karl Donert
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
How to Configure Lost Reasons in Odoo 18 CRM
Celine George
 

JavaFest. Вадим Казулькин. Projects Valhalla, Loom and GraalVM

  • 1. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 NEW PROFESSIONAL JAVA EVENT MARCH 21ST, 2020 KYIV, UKRAINE Vadym Kazulkin Projects Valhalla, Loom and GraalVM
  • 2. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Contact Vadym Kazulkin, ip.labs GmbH [email protected] https://www.linkedin.com/in/vadymkazulkin/ @VKazulkin Co-Org Java User Group Bonn and Serverless Bonn Meetup
  • 3. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 ip.labs GmbH
  • 4. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Agenda • Project Valhalla (Inline Types) • Project Loom (Lightweight Threads and Continuations) • GraalVM
  • 5. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Valhalla Inline Types Source: http://openjdk.java.net/projects/valhalla/
  • 6. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Inline types = Value types
  • 7. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Valhalla Goal: • Reboot the layout of data in memory Source: Brian Goetz, Oracle „Evolving the Java Language” https://www.youtube.com/watch?v=A-mxj2vhVAA
  • 8. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Valhalla Motivation: • Hardware has changed • Multi-core • The cost of cache misses has increased Source: Brian Goetz, Oracle „Evolving the Java Language” https://www.youtube.com/watch?v=A-mxj2vhVAA
  • 9. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Valhalla Hardware Memory Model Source: https://www.enterpriseai.news/2014/06/30/shared-memory-clusters-101/
  • 10. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Valhalla Motivation Source: „Latency Numbers Every Programmer Should Know” https://people.eecs.berkeley.edu/~rcs/research/interactive_latency.html
  • 11. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Valhalla Motivation Source: „Latency Numbers Every Programmer Should Know” https://people.eecs.berkeley.edu/~rcs/research/interactive_latency.html
  • 12. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Valhalla Storing objects in the Java Heap has its price, because storing object’s metadata consumes additional memory for : • flags facilitating synchronization/locking • Identity and polymorphismus • garbage collection
  • 13. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Valhalla Inline Types Inline Type is an immutable type that is distinguishable only by the state of its properties
  • 14. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Valhalla Inline Types Immutable: an instance of an inline-type can’t change, once it’s been created Identity-less: inline-types of the same type with the same contents are indistinguishable from each other Flattenable: JVMs are allowed to flatten an inline-type inside of its container Source: Tobi Ajila “Welcome to LWorld: The current state of value types in Java “ https://www.youtube.com/watch?v=Xf22I16jVyE&list=LLYgjRSI2oCzI9eooyFrWR7A&index=11
  • 15. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Valhalla Source: „What Is Project Valhalla?” https://dzone.com/articles/what-is-project-valhalla
  • 16. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Valhalla Benefits: • Reduced memory usage • Reduced indirection • Increased locality Codes like a class, works like a primitive (Brian Goetz)
  • 17. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Valhalla Benefit: Reduced Memory Usage No additional memory to store object metadata, such as flags facilitating synchronization, identity, polymorphismus and garbage collection
  • 18. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Valhalla Benefit: Reduced indirection • Since objects are stored as reference types in Java, each time an object is accessed it must first be dereferenced, causing additional instructions to be executed • The flattened data associated with inline types are immediately present in the location in which they are needed and therefore, require no dereferencing
  • 19. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Valhalla Benefit: Increased locality • Flattened value objects remove indirection which increases the likelihood that values are adjacently stored in memory– especially for arrays or other contiguous memory structures such as classes (i.e. if a class contains inline type fields) • Consequently increases the chance of cache hits, because of hardware prefetch of the cache lines
  • 20. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Valhalla Inline Types inline class Point {long x, y ;}
  • 21. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Valhalla Inline Types Can • have method and field • implement interfaces • use encapsulation • be generic Can’t • be mutated • be sub-classed • be cloned • be Enums Source: Tobi Ajila “Welcome to LWorld: The current state of value types in Java “ https://www.youtube.com/watch?v=Xf22I16jVyE&list=LLYgjRSI2oCzI9eooyFrWR7A&index=11
  • 22. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Valhalla Inline Types Hierarchy Source: Tobi Ajila “Welcome to LWorld: The current state of value types in Java “ https://www.youtube.com/watch?v=Xf22I16jVyE&list=LLYgjRSI2oCzI9eooyFrWR7A&index=11 Object Point? Point Nullable Inline Type (Point or null) Inline Type
  • 23. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Valhalla Inline Types Hierarchy Source: Tobi Ajila “Welcome to LWorld: The current state of value types in Java “ https://www.youtube.com/watch?v=Xf22I16jVyE&list=LLYgjRSI2oCzI9eooyFrWR7A&index=11 Object Point? Point Nullable Inline Type (Point or null) Inline Type Object[] Point?[] Point[]
  • 24. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Valhalla Current Status: • Released public prototype LW2 • Can declare and use inline types (inline classes) • No support for generics yet List<Point> // compilation error • No support for specialized generics (Point<T>) • No Support for migration of existing classes (like Optional) • Memory Layout optimizations implemented • Compiler/Virtual Machine optimizations implemented • A lot of challenges to solve (read the article https://www.infoq.com/news/2019/07/valhalla-openjdk-lw2-released/) Source: Brian Goetz, Oracle „Valhalla Update” https://www.youtube.com/watch?v=1H4vmT-Va4o
  • 25. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Valhalla Open Questions: • Migration of existing classes (Option, LocaDateTime) to inline classes • Nullity • Equality • GraalVM Support • How Java type system should look like Source: Brian Goetz, Oracle „Valhalla Update” https://www.youtube.com/watch?v=1H4vmT-Va4o
  • 26. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Valhalla How Java type system should look like ? Source: Tobi Ajila “Welcome to LWorld: The current state of value types in Java “ https://www.youtube.com/watch?v=Xf22I16jVyE&list=LLYgjRSI2oCzI9eooyFrWR7A&index=11 Object ValObject Inline Types RefObject References
  • 27. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Loom Lightweight Thread and Continuations Source: http://openjdk.java.net/projects/loom
  • 28. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Lightweight Threads = Fibers Lightweight Threads = Virtual Threads in the newest prototype?
  • 29. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Loom Motivation: Developers currently have 2 choices to write concurrent code: • use blocking/synchronous API, which is simple, but less scalable (number of threads, that OS supports is far less that open and concurrent connections required) • asynchronous API (Spring Project Reactor, RXJava 2), which is scalable, but complex, harder to debug and profile and limited (no asynchronous JDBC standard in this area) Sources: Alan Bateman, Oracle „Project Loom: Fibers and Continuations for Java” https://www.youtube.com/watch?v=vbGbXUjlRyQ
  • 30. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Loom Goal: To write simple and scalable code
  • 31. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Loom Lightweight Thread Lightweight thread scheduled not by the OS, but by the Java Runtime with low memory footprint and low task-switching cost
  • 32. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Loom Continuation Continuation is a program object, representing a computation that may be suspended and resumed
  • 33. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Continuation package java.lang; public class Continuation { public Continuation (ContinuationScope scope, Runnable target) public final void run() public static void yield (ContinuationScope scope) public boolean isDone() }
  • 34. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Loom Continuations example () { var scope = new ContinuationScope(„Example_Scope“); var continuation = new Continuation (scope, () -> { out.print(„1“); Continuation.yield(scope); out.print(„2“); Continuation.yield(scope); out.print(„3“); Continuation.yield(scope); }); while (! continuation.isDone()) { out.print(„ run.. “); continuation.run(); } } Output: run.. 1 run.. 2 run.. 3
  • 35. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Loom Lightweight Thread & Continuations Thread = Continuation + Schedular
  • 36. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Loom Schedular Schedular executes the task on a pool of carrier threads • java.util.concurrent.Executor API exposes the Schedular • Default schedular is a ForJoinPool Source: Alan Bateman, Oracle „Project Loom Update” https://www.youtube.com/watch?v=NV46KFV1m-4
  • 37. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Loom Lightweight Thread Implementation • Currently Thread and Lightweight Thread don’t have a common supertype • Thread.currentThread() in context of Lightweight Thread • Creates adaptor (Shadow Thread) • Adaptor emulates legacy Thread API (except deprecated methods like stop, suspend and resume) • Thread Local becomes Lightweight Thread Local Source: Alan Bateman, Oracle „Project Loom Update” https://www.youtube.com/watch?v=NV46KFV1m-4
  • 38. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Loom Structured Concurrency Basic idea: Everytime that the control splits into multiple concurrent paths, we want to guarantee that they join up again try (var scope= ThreadScope. open()) { scope.schedule(task1); scope.schedule(task2); } //blocks until task1 and task2 terminate Sources: Nathanial J. Smith „Notes on structured concurrency, or: Go statement considered harmful” https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/ Roman Elizarov: “Structured concurrency with Coroutines in Kotlin” https://medium.com/@elizarov/structured-concurrency-722d765aa952
  • 39. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Loom Structured Concurrency Cancelation: • Each Lightweight Thread has cancel status which can only be set once, which sets the interrupt status and unparks the Lightweight Thread • The task can poll canceled status try (var scope= ThreadScope. open(PROPAGATE_CANCEL)) { scope.schedule(task1); scope.schedule(task2); } //canceling the lightweight thread executing this code will task1 and task2 Source: Alan Bateman, Oracle „Project Loom Update” https://www.youtube.com/watch?v=NV46KFV1m-4
  • 40. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Loom Lightweight Thread Current Status: • Lightweight Thread currently supports: • scheduling • parking/unparking • waiting for a Lightweight Thread to terminate • Lightweight Thread -friendly APIs • java.util.concurrent Locks • java.net.Socket/ServerSocket (since JDK 13) • java.nio.channels.SocketChannel and Pipes (since JDK 11) • Thread.sleep • JSSE implementation of TLS • AccessControl.doPrivileged (since JDK 12) Source: Ron Pressler, Project Loom: Helping Write Concurrent Applications on the Java Platform https://www.youtube.com/watch?v=lIq-x_iI-kc
  • 41. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Loom Current Status: • Implemented initial prototype with Continuation and Lightweight Thread support • Current prototype of Continuations and Lightweight Thread can run existing code • Debugger Support Current focus on: • Performance improvement • Stable Lightweight Thread API • Java Flight Recorder support Source: Alan Bateman, Oracle „Project Loom Update” https://www.youtube.com/watch?v=NV46KFV1m-4
  • 42. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Loom Limitations: • Can‘t yield with native frames Further Work: • java.net.InetAddress • Console I/O • File I/O
  • 43. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Loom Open Questions: • Should the existing Thread API be completely re-examined? • Can all existing code be run on top of Lightweight Threads?
  • 44. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Polyglot GraalVM Source: http://openjdk.java.net/projects/metropolis
  • 45. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Project Metropolis Goals: • Low footprint ahead-of-time mode for JVM-based languages • High performance for all languages • Convenient language interoperability and polyglot tooling Source: „Everything you need to know about GraalVM by Oleg Šelajev & Thomas Wuerthinger” https://www.youtube.com/watch?v=ANN9rxYo5Hg
  • 46. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 JEP 317 Experimental Java-Based JIT Compiler Graal, a Java-based JIT compiler on the Linux/x64 platform, is the basis of the experimental Ahead-of-Time (AOT) compiler introduced in JDK 9. To Enable: -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler
  • 47. NEW PROFESSIONAL JAVA EVENT KYIV, 2020
  • 48. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 GraalVM Architecture Sources: Practical Partial Evaluation for High-Performance Dynamic Language Runtimes http://chrisseaton.com/rubytruffle/pldi17- truffle/pldi17-truffle.pdf „The LLVM Compiler Infrastructure“ https://llvm.org/
  • 49. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 GraalVM Benchmarks Sources: Renaissance Suite https://renaissance.dev/
  • 50. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 GraalVM libgraal Library Sources: „libgraal: GraalVM compiler as a precompiled GraalVM native image“ https://medium.com/graalvm/libgraal-graalvm-compiler-as-a-precompiled-graalvm-native-image-26e354bee5c libgraal jargraal • libgraal is a shared library, produced by GraalVM Native Image with a pre-compiled version of the GraalVM compiler • In Java applications on GraalVM libgraal used as the top tier Just-In-Time compiler • libgraal improves startup
  • 51. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 GraalVM Architecture Sources: Practical Partial Evaluation for High-Performance Dynamic Language Runtimes http://chrisseaton.com/rubytruffle/pldi17- truffle/pldi17-truffle.pdf „The LLVM Compiler Infrastructure“ https://llvm.org/
  • 52. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 SubstrateVM Source: Oleg Šelajev, Thomas Wuerthinger, Oracle: “Deep dive into using GraalVM for Java and JavaScript” https://www.youtube.com/watch?v=a-XEZobXspo
  • 53. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 GraalVM and SubstrateVM Source: Oleg Selajev, Oracle : “Run Code in Any Language Anywhere with GraalVM” https://www.youtube.com/watch?v=JoDOo4FyYMU
  • 54. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 GraalVM on SubstrateVM A game changer for Java & Serverless? Cold Start : Source: Ajay Nair „Become a Serverless Black Belt” https://www.youtube.com/watch?v=oQFORsso2go
  • 55. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 AWS Lambda cold start time by supported language Source: Yan Cui: https://read.acloud.guru/does-coding-language-memory-or-package-size-affect-cold-starts-of-aws-lambda-a15e26d12c76
  • 56. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 GraalVM on SubstrateVM A game changer for Java & Serverless? Java Function compiled into a native executable using GraalVM on SubstrateVM reduces • “cold start” times • memory footprint by order of magnitude compared to running on JVM. And both memory and execution time are cost dimension, when using Serverless in the cloud
  • 57. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 GraalVM on SubstrateVM A game changer for Java & Serverless? Current challenges native executable using GraalVM : • Most Cloud Providers (AWS) doesn’t provide GraalVM as Java Runtime out of the box, only Open JDK (e.g. AWS provides Corretto) • Some Cloud Providers (AWS) provide Custom Runtime Option • Docker Image with GraalVM instead of Open JDK • Frameworks like Micronaut and Quarkus which provide tooling for generating Custom Runtime for cloud providers
  • 58. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 GraalVM Complitation Modes Source: „Everything you need to know about GraalVM by Oleg Šelajev & Thomas Wuerthinger” https://www.youtube.com/watch?v=ANN9rxYo5Hg
  • 59. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 AOT vs JIT Source: „Everything you need to know about GraalVM by Oleg Šelajev & Thomas Wuerthinger” https://www.youtube.com/watch?v=ANN9rxYo5Hg
  • 60. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 Support of GraalVM native images in Frameworks • Spring Framework: working toward GraalVM native image support without requiring additional configuration or workaround is one of the themes of upcoming Spring Framework 5.3 • Spring Boot: Ongoing work on experimental Spring Graal Native project. Probably ready for the 2.4 release • Quarkus: a Kubernetes Native Java framework developed by Red Hat tailored for GraalVM and HotSpot, crafted from best-of-breed Java libraries and standards. • Micronaut: a modern, JVM-based, full-stack framework for building modular, easily testable microservice and serverless applications. Source: „GraalVM native image support“ https://github.com/spring-projects/spring-framework/wiki/GraalVM-native-image-support
  • 61. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 GraalVM Current State Source: „Everything you need to know about GraalVM by Oleg Šelajev & Thomas Wuerthinger” https://www.youtube.com/watch?v=ANN9rxYo5Hg
  • 62. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 is still an interesting and great programming language
  • 63. NEW PROFESSIONAL JAVA EVENT KYIV, 2020
  • 64. NEW PROFESSIONAL JAVA EVENT KYIV, 2020 www.iplabs.de Thank You!