SlideShare a Scribd company logo
Projects Valhalla, Loom and GraalVM
JCON2020#
www.jcon.one
Vadym Kazulkin, ip.labs
Our Partners 2020:
Contact
Vadym Kazulkin
ip.labs GmbH Bonn, Germany
Co-Organizer of the Java User Group
Bonn and Serverless Bonn Meetup
v.kazulkin@gmail.com
@VKazulkin
@ServerlessBonn (Meetup)
https://www.linkedin.com/in/vadymk
azulkin/
https://www.iplabs.de/
ip.labs GmbH
https://www.iplabs.de/
Agenda
Project Valhalla (Inline Types)
Project Loom (Virtual Threads and Continuations)
GraalVM
Project Valhalla
Inline Types
Source: http://openjdk.java.net/projects/valhalla/
Inline types = Value types
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
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
Project Valhalla
Hardware Memory Model
Source: https://www.enterpriseai.news/2014/06/30/shared-memory-clusters-101/
Project Valhalla
Motivation
Source: „Latency Numbers Every Programmer Should Know”
https://people.eecs.berkeley.edu/~rcs/research/interactive_latency.html
Project Valhalla
Motivation
Source: „Latency Numbers Every Programmer Should Know”
https://people.eecs.berkeley.edu/~rcs/research/interactive_latency.html
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
Project Valhalla
Inline Types
Inline Type is an immutable type that is distinguishable only by the
state of its properties
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
Project Valhalla
Source: „What Is Project Valhalla?” https://dzone.com/articles/what-is-project-valhalla
Project Valhalla
Benefits:
• Reduced memory usage
• Reduced indirection
• Increased locality
Codes like a class, works like a primitive
(Brian Goetz)
Project Valhalla
Benefit: Reduced Memory Usage
No additional memory to store object metadata, such as flags
facilitating synchronization, identity, polymorphismus and
garbage collection
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
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
Project Valhalla
Inline Types
inline class Point {long x, y ;}
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
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
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[]
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
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
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
Project Loom
Virtual Thread and Continuations
Source: http://openjdk.java.net/projects/loom
Virtual Threads = Fibers=Lightweight Threads
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
Project Loom
Goal:
To write simple and scalable code
Project Loom
Lightweight Thread
Virtual thread scheduled not by the OS, but by the Java Runtime with
low memory footprint and low task-switching cost
Project Loom
Continuation
Continuation is a program object, representing a computation that
may be suspended and resumed
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()
}
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
Project Loom
Virtual Thread & Continuations
Thread
=
Continuation + Schedular
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
Project Loom
Virtual Thread Implementation
Currently Thread and Virtual Thread don’t have a common
supertype
Thread.currentThread() in context of Virtual Thread
• Creates adaptor (Shadow Thread)
• Adaptor emulates legacy Thread API (except deprecated methods like stop, suspend and
resume)
• Thread Local becomes Virtual Thread Local
Source: Alan Bateman, Oracle „Project Loom Update” https://www.youtube.com/watch?v=NV46KFV1m-4
Project Loom
Virtual Thread Implementation
Thread t = Thread.startVirtualThread (() -> {
System.out.println(„Hello World“);
});
Thread t = Thread.builder().virtual().task( () -> { … }).build();
Thread t = Thread.builder().virtual().task( () -> { … }).start();
ThreadFactory factory = Thread.builder().virtual().factory();
Source: Ron Pressler: “Project Loom: Modern Scalable Concurrency for the Java”
https://www.youtube.com/watch?v=23HjZBOIshY
https://cr.openjdk.java.net/~rpressler/loom/loom/
Project Loom
Structured Concurrency
Basic idea: Everytime that the control splits into multiple concurrent
paths, we want to guarantee that they join up again
ThreadFactory factory = Thread.builder().virtual().factory();
try (var executor= Executors.newThreadExecutor(factory)) {
executor.submit(task1);
executor.submit(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-
Project Loom
Structured Concurrency
Cancelation probable solution:
Each Virtual Thread has cancel status which can only be set once, which
sets the interrupt status and unparks the Virtual Thread
The task can poll canceled status
ThreadFactory factory = Thread.builder().virtual().factory();
try (var executor= Executors.newThreadExecutor(factory),
PROPAGATE_CANCEL) {
executor.submit(task1);
executor.submit(task2);
} //canceling the virtual thread executing this code will task1 and task2
Source: Ron Pressler: “Project Loom: Modern Scalable Concurrency for the Java”
https://www.youtube.com/watch?v=23HjZBOIshY
https://cr.openjdk.java.net/~rpressler/loom/loom/
Project Loom
Structured Concurrency
Cancelation :
We can also give all tasks a deadline that will interrupt those children that
have yet to terminate by the time it expires (as well as the current thread)
ThreadFactory factory = Thread.builder().virtual().factory();
try (var executor= Executors.newUnboundedExecutor(factory).
withDeadline(Instant.now().plusSeconds(60))) {
executor.submit(task1);
executor.submit(task2);
}
Source: Ron Pressler: “Project Loom: Modern Scalable Concurrency for the Java”
https://www.youtube.com/watch?v=23HjZBOIshY
https://cr.openjdk.java.net/~rpressler/loom/loom/
Project Loom
Virtual Thread
Current Status:
Virtual Thread currently supports:
• scheduling
• parking/unparking
• waiting for a Virtual Thread to terminate
Virtual 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
Project Loom
Current Status:
• Implemented initial prototype with Continuation and Virtual
Thread support
• Current prototype of Continuations and Virtual Thread can run
existing code
• Debugger Support
Current focus on:
• Performance improvement
• Stable Virtual Thread API
• Java Flight Recorder support
Source: Alan Bateman, Oracle „Project Loom Update” https://www.youtube.com/watch?v=NV46KFV1m-4
Project Loom
Limitations:
Can‘t yield with native frames
Further Work:
• java.net.InetAddress
• Console I/O
• File I/O
Project Loom
Open Questions:
Should the existing Thread API be completely re-examined?
Can all existing code be run on top of Virtual Threads?
Current answers:
• Since Java 5 and 6 developers and library creators are encouraged
to use Executors and ThreadFactory APIs instead of Thread directly
• In order to use Virtual Thread instead of Thread another Executor
implementation must be chosen
ThreadFactory factory = Thread.builder().virtual().factory();
//ThreadFactory factory = ThreadFactory.builder().factory();
Executor executor= Executors.newThreadExecutor(factory);
GraalVM
Source: http://openjdk.java.net/projects/metropolis
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
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
Projects Valhalla, Loom and GraalVM at JCon 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/
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/
SubstrateVM
Source: Oleg Šelajev, Thomas Wuerthinger, Oracle: “Deep dive into using GraalVM for Java and JavaScript”
https://www.youtube.com/watch?v=a-XEZobXspo
GraalVM and SubstrateVM
Source: Oleg Selajev, Oracle : “Run Code in Any Language Anywhere with GraalVM”
https://www.youtube.com/watch?v=JoDOo4FyYMU
Creating AWS Lambda with Java 1/2
:
Source https://blog.runscope.com/posts/how-to-write-your-first-aws-lambda-function
Creating AWS Lambda with Java 2/2
:
Source https://blog.runscope.com/posts/how-to-write-your-first-aws-lambda-function
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
Bootstrap the Java Runtime Phase
• AWS Lambda starts the JVM
• Java runtime loads and initializes
handler class
• Static initializer block of the handler class is
executed
• Lambda calls the handler method
Vadym Kazulkin @VKazulkin , ip.labs GmbH
Source: Stefano Buliani : "Best practices for AWS Lambda and Java„ https://www.youtube.com/watch?v=ddg1u5HLwg8
AWS Lambda cold start duration
per programming language
Source: Mikhail Shilkov: „AWS Lambda: Cold Start Duration per Language. 2020 edition” https://mikhail.io/serverless/coldstarts/aws/languages/
Cold start duration with Java
• Below 1 second is best-case cold start duration for very simple
Lambda like HelloWorld with no dependencies
• It goes up significantly with more complex scenarios
• Dependencies to multiple OS projects
• Clients instantiation to communicate with other (AWS) services (e.g. DynamoDB,
SNS, SQS, 3rd party)
Source: Stefano Buliani : "Best practices for AWS Lambda and Java„ https://www.youtube.com/watch?v=ddg1u5HLwg8
Sean O‘Toole „AWS Lambda Java Tutorial: Best Practices to Lower Cold Starts” https://www.capitalone.com/tech/cloud/aws-lambda-java-tutorial-reduce-cold-starts/
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 dimensions,
when using Serverless in the cloud
GraalVM on SubstrateVM
A game changer for Java & Serverless?
Current challenges with 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 (e.g. AWS) provide Custom Runtime Option
GraalVM Complitation Modes
Source: „Everything you need to know about GraalVM by Oleg Šelajev & Thomas Wuerthinger”
https://www.youtube.com/watch?v=ANN9rxYo5Hg
AOT vs JIT
Source: „Everything you need to know about GraalVM by Oleg Šelajev & Thomas Wuerthinger”
https://www.youtube.com/watch?v=ANN9rxYo5Hg
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
is still an interesting and great
programming language
Thank You !
JCON2020#
www.jcon.one
Our Partners 2020:
Projects Valhalla, Loom and GraalVM at JCon 2020

More Related Content

PDF
Projects Valhalla and Loom at IT Tage 2021
PDF
Projects Valhalla, Loom and GraalVM at JUG Mainz
PPT
Gwt and rpc use 2007 1
PDF
Reactive integrations with Akka Streams
PDF
Akka Streams in Action @ ScalaDays Berlin 2016
PDF
[Japanese] How Reactive Streams and Akka Streams change the JVM Ecosystem @ R...
PPTX
Scala in the Wild
PDF
Not Only Streams for Akademia JLabs
Projects Valhalla and Loom at IT Tage 2021
Projects Valhalla, Loom and GraalVM at JUG Mainz
Gwt and rpc use 2007 1
Reactive integrations with Akka Streams
Akka Streams in Action @ ScalaDays Berlin 2016
[Japanese] How Reactive Streams and Akka Streams change the JVM Ecosystem @ R...
Scala in the Wild
Not Only Streams for Akademia JLabs

What's hot (20)

PDF
End to End Akka Streams / Reactive Streams - from Business to Socket
PPTX
Using Apache Camel as AKKA
PDF
ITSubbotik - как скрестить ежа с ужом или подводные камни внедрения функциона...
PDF
How Reactive Streams & Akka Streams change the JVM Ecosystem
PDF
The Cloud-natives are RESTless @ JavaOne
PDF
Scala Days NYC 2016
PDF
The things we don't see – stories of Software, Scala and Akka
PDF
Reactive Streams, j.u.concurrent & Beyond!
PPTX
Hybrid Mobile Development with Apache Cordova and
PPTX
Integration Testing with Selenium
PDF
Java APIs- The missing manual (concurrency)
PDF
State of Akka 2017 - The best is yet to come
PDF
GraphQL 101
PDF
2015 Java update and roadmap, JUG sevilla
PPTX
Composable Futures with Akka 2.0
PPT
Sbt, idea and eclipse
PPTX
What’s expected in Java 9
PDF
Java 11 OMG
PPTX
Multi-threading in the modern era: Vertx Akka and Quasar
PPTX
What’s expected in Spring 5
End to End Akka Streams / Reactive Streams - from Business to Socket
Using Apache Camel as AKKA
ITSubbotik - как скрестить ежа с ужом или подводные камни внедрения функциона...
How Reactive Streams & Akka Streams change the JVM Ecosystem
The Cloud-natives are RESTless @ JavaOne
Scala Days NYC 2016
The things we don't see – stories of Software, Scala and Akka
Reactive Streams, j.u.concurrent & Beyond!
Hybrid Mobile Development with Apache Cordova and
Integration Testing with Selenium
Java APIs- The missing manual (concurrency)
State of Akka 2017 - The best is yet to come
GraphQL 101
2015 Java update and roadmap, JUG sevilla
Composable Futures with Akka 2.0
Sbt, idea and eclipse
What’s expected in Java 9
Java 11 OMG
Multi-threading in the modern era: Vertx Akka and Quasar
What’s expected in Spring 5
Ad

Similar to Projects Valhalla, Loom and GraalVM at JCon 2020 (20)

PDF
Projects Valhalla and Loom DWX 2022
PDF
JavaFest. Вадим Казулькин. Projects Valhalla, Loom and GraalVM
PDF
Projects Valhalla, Loom and GraalVM at virtual JavaFest 2020 in Kiev, Ukraine...
PDF
Highlights from Java 10-13 and Future of Java at JCON 2019 by Alukhanov and K...
PDF
Java 25 and Beyond - A Roadmap of Innovations
PDF
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
PDF
Hacking Java - Enhancing Java Code at Build or Runtime
PDF
Building Concurrent WebObjects applications with Scala
PDF
Server Side JavaScript on the JVM - Project Avatar - QCon London March 2014
PPTX
Apache Cayenne: a Java ORM Alternative
PDF
Troubleshooting Virtual Threads in Java!
PPT
D Baker - Galaxy Update
PPTX
object oriented programming unit one ppt
PDF
Apache Cayenne for WO Devs
PDF
WTF is Twisted?
PDF
Virtual Threads in Java: A New Dimension of Scalability and Performance
PDF
Scala, Akka, and Play: An Introduction on Heroku
PDF
Rapid Web API development with Kotlin and Ktor
KEY
Scala Introduction
PPTX
Advanced JavaScript
Projects Valhalla and Loom DWX 2022
JavaFest. Вадим Казулькин. Projects Valhalla, Loom and GraalVM
Projects Valhalla, Loom and GraalVM at virtual JavaFest 2020 in Kiev, Ukraine...
Highlights from Java 10-13 and Future of Java at JCON 2019 by Alukhanov and K...
Java 25 and Beyond - A Roadmap of Innovations
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Hacking Java - Enhancing Java Code at Build or Runtime
Building Concurrent WebObjects applications with Scala
Server Side JavaScript on the JVM - Project Avatar - QCon London March 2014
Apache Cayenne: a Java ORM Alternative
Troubleshooting Virtual Threads in Java!
D Baker - Galaxy Update
object oriented programming unit one ppt
Apache Cayenne for WO Devs
WTF is Twisted?
Virtual Threads in Java: A New Dimension of Scalability and Performance
Scala, Akka, and Play: An Introduction on Heroku
Rapid Web API development with Kotlin and Ktor
Scala Introduction
Advanced JavaScript
Ad

More from Vadym Kazulkin (20)

PDF
How to develop, run and optimize Spring Boot 3 application on AWS Lambda - Wa...
PDF
Event-driven architecture patterns in highly scalable image storage solution-...
PDF
High performance Serverless Java on AWS- Serverless Architecture Javaland 2025
PDF
How to develop, run and optimize Spring Boot 3 application on AWS Lambda-OBI ...
PPTX
Making sense of AWS Serverless operations- AWS User Group Nuremberg
PDF
How to develop, run and optimize Spring Boot 3 application on AWS Lambda at V...
PPTX
Making sense of AWS Serverless operations at Believe in Serverless community ...
PDF
How to develop, run and optimize Spring Boot 3 application on AWS Lambda at I...
PDF
Making sense of AWS Serverless operations - Amarathon Geek China 2024
PDF
Event-driven architecture patterns in highly scalable image storage solution-...
PDF
High performance Serverless Java on AWS- Serverless Meetup Toronto
PDF
High performance Serverless Java on AWS- Serverless Architecture Conference B...
PDF
Making sense of AWS Serverless operations- Serverless Architecture Conference...
PDF
Detect operational anomalies in Serverless Applications with Amazon DevOps Gu...
PDF
Detect operational anomalies in Serverless Applications with Amazon DevOps Gu...
PDF
High performance Serverless Java on AWS- AWS Community Day Budapest 2024
PDF
Making sense of AWS Serverless operations AWS Community Day NL 2024-
PDF
Event-driven architecture patterns in highly scalable image storage solution ...
PDF
Detect operational anomalies in Serverless Applications with Amazon DevOps Gu...
PDF
High performance Serverless Java on AWS at We Are Developers 2024
How to develop, run and optimize Spring Boot 3 application on AWS Lambda - Wa...
Event-driven architecture patterns in highly scalable image storage solution-...
High performance Serverless Java on AWS- Serverless Architecture Javaland 2025
How to develop, run and optimize Spring Boot 3 application on AWS Lambda-OBI ...
Making sense of AWS Serverless operations- AWS User Group Nuremberg
How to develop, run and optimize Spring Boot 3 application on AWS Lambda at V...
Making sense of AWS Serverless operations at Believe in Serverless community ...
How to develop, run and optimize Spring Boot 3 application on AWS Lambda at I...
Making sense of AWS Serverless operations - Amarathon Geek China 2024
Event-driven architecture patterns in highly scalable image storage solution-...
High performance Serverless Java on AWS- Serverless Meetup Toronto
High performance Serverless Java on AWS- Serverless Architecture Conference B...
Making sense of AWS Serverless operations- Serverless Architecture Conference...
Detect operational anomalies in Serverless Applications with Amazon DevOps Gu...
Detect operational anomalies in Serverless Applications with Amazon DevOps Gu...
High performance Serverless Java on AWS- AWS Community Day Budapest 2024
Making sense of AWS Serverless operations AWS Community Day NL 2024-
Event-driven architecture patterns in highly scalable image storage solution ...
Detect operational anomalies in Serverless Applications with Amazon DevOps Gu...
High performance Serverless Java on AWS at We Are Developers 2024

Recently uploaded (20)

PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Architecture types and enterprise applications.pdf
PPTX
Modernising the Digital Integration Hub
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
Zenith AI: Advanced Artificial Intelligence
PPTX
OMC Textile Division Presentation 2021.pptx
PPTX
Tartificialntelligence_presentation.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
Hybrid model detection and classification of lung cancer
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Univ-Connecticut-ChatGPT-Presentaion.pdf
A comparative study of natural language inference in Swahili using monolingua...
Enhancing emotion recognition model for a student engagement use case through...
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Programs and apps: productivity, graphics, security and other tools
Architecture types and enterprise applications.pdf
Modernising the Digital Integration Hub
A contest of sentiment analysis: k-nearest neighbor versus neural network
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
TLE Review Electricity (Electricity).pptx
Getting started with AI Agents and Multi-Agent Systems
DP Operators-handbook-extract for the Mautical Institute
Zenith AI: Advanced Artificial Intelligence
OMC Textile Division Presentation 2021.pptx
Tartificialntelligence_presentation.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Hybrid model detection and classification of lung cancer
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf

Projects Valhalla, Loom and GraalVM at JCon 2020

  • 1. Projects Valhalla, Loom and GraalVM JCON2020# www.jcon.one Vadym Kazulkin, ip.labs Our Partners 2020:
  • 2. Contact Vadym Kazulkin ip.labs GmbH Bonn, Germany Co-Organizer of the Java User Group Bonn and Serverless Bonn Meetup v.kazulkin@gmail.com @VKazulkin @ServerlessBonn (Meetup) https://www.linkedin.com/in/vadymk azulkin/ https://www.iplabs.de/
  • 4. Agenda Project Valhalla (Inline Types) Project Loom (Virtual Threads and Continuations) GraalVM
  • 5. Project Valhalla Inline Types Source: http://openjdk.java.net/projects/valhalla/
  • 6. Inline types = Value types
  • 7. 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. 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. Project Valhalla Hardware Memory Model Source: https://www.enterpriseai.news/2014/06/30/shared-memory-clusters-101/
  • 10. Project Valhalla Motivation Source: „Latency Numbers Every Programmer Should Know” https://people.eecs.berkeley.edu/~rcs/research/interactive_latency.html
  • 11. Project Valhalla Motivation Source: „Latency Numbers Every Programmer Should Know” https://people.eecs.berkeley.edu/~rcs/research/interactive_latency.html
  • 12. 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. Project Valhalla Inline Types Inline Type is an immutable type that is distinguishable only by the state of its properties
  • 14. 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. Project Valhalla Source: „What Is Project Valhalla?” https://dzone.com/articles/what-is-project-valhalla
  • 16. Project Valhalla Benefits: • Reduced memory usage • Reduced indirection • Increased locality Codes like a class, works like a primitive (Brian Goetz)
  • 17. Project Valhalla Benefit: Reduced Memory Usage No additional memory to store object metadata, such as flags facilitating synchronization, identity, polymorphismus and garbage collection
  • 18. 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. 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. Project Valhalla Inline Types inline class Point {long x, y ;}
  • 21. 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. 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. 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. 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. 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. 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. Project Loom Virtual Thread and Continuations Source: http://openjdk.java.net/projects/loom
  • 28. Virtual Threads = Fibers=Lightweight Threads
  • 29. 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. Project Loom Goal: To write simple and scalable code
  • 31. Project Loom Lightweight Thread Virtual thread scheduled not by the OS, but by the Java Runtime with low memory footprint and low task-switching cost
  • 32. Project Loom Continuation Continuation is a program object, representing a computation that may be suspended and resumed
  • 33. 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. 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. Project Loom Virtual Thread & Continuations Thread = Continuation + Schedular
  • 36. 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. Project Loom Virtual Thread Implementation Currently Thread and Virtual Thread don’t have a common supertype Thread.currentThread() in context of Virtual Thread • Creates adaptor (Shadow Thread) • Adaptor emulates legacy Thread API (except deprecated methods like stop, suspend and resume) • Thread Local becomes Virtual Thread Local Source: Alan Bateman, Oracle „Project Loom Update” https://www.youtube.com/watch?v=NV46KFV1m-4
  • 38. Project Loom Virtual Thread Implementation Thread t = Thread.startVirtualThread (() -> { System.out.println(„Hello World“); }); Thread t = Thread.builder().virtual().task( () -> { … }).build(); Thread t = Thread.builder().virtual().task( () -> { … }).start(); ThreadFactory factory = Thread.builder().virtual().factory(); Source: Ron Pressler: “Project Loom: Modern Scalable Concurrency for the Java” https://www.youtube.com/watch?v=23HjZBOIshY https://cr.openjdk.java.net/~rpressler/loom/loom/
  • 39. Project Loom Structured Concurrency Basic idea: Everytime that the control splits into multiple concurrent paths, we want to guarantee that they join up again ThreadFactory factory = Thread.builder().virtual().factory(); try (var executor= Executors.newThreadExecutor(factory)) { executor.submit(task1); executor.submit(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-
  • 40. Project Loom Structured Concurrency Cancelation probable solution: Each Virtual Thread has cancel status which can only be set once, which sets the interrupt status and unparks the Virtual Thread The task can poll canceled status ThreadFactory factory = Thread.builder().virtual().factory(); try (var executor= Executors.newThreadExecutor(factory), PROPAGATE_CANCEL) { executor.submit(task1); executor.submit(task2); } //canceling the virtual thread executing this code will task1 and task2 Source: Ron Pressler: “Project Loom: Modern Scalable Concurrency for the Java” https://www.youtube.com/watch?v=23HjZBOIshY https://cr.openjdk.java.net/~rpressler/loom/loom/
  • 41. Project Loom Structured Concurrency Cancelation : We can also give all tasks a deadline that will interrupt those children that have yet to terminate by the time it expires (as well as the current thread) ThreadFactory factory = Thread.builder().virtual().factory(); try (var executor= Executors.newUnboundedExecutor(factory). withDeadline(Instant.now().plusSeconds(60))) { executor.submit(task1); executor.submit(task2); } Source: Ron Pressler: “Project Loom: Modern Scalable Concurrency for the Java” https://www.youtube.com/watch?v=23HjZBOIshY https://cr.openjdk.java.net/~rpressler/loom/loom/
  • 42. Project Loom Virtual Thread Current Status: Virtual Thread currently supports: • scheduling • parking/unparking • waiting for a Virtual Thread to terminate Virtual 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
  • 43. Project Loom Current Status: • Implemented initial prototype with Continuation and Virtual Thread support • Current prototype of Continuations and Virtual Thread can run existing code • Debugger Support Current focus on: • Performance improvement • Stable Virtual Thread API • Java Flight Recorder support Source: Alan Bateman, Oracle „Project Loom Update” https://www.youtube.com/watch?v=NV46KFV1m-4
  • 44. Project Loom Limitations: Can‘t yield with native frames Further Work: • java.net.InetAddress • Console I/O • File I/O
  • 45. Project Loom Open Questions: Should the existing Thread API be completely re-examined? Can all existing code be run on top of Virtual Threads? Current answers: • Since Java 5 and 6 developers and library creators are encouraged to use Executors and ThreadFactory APIs instead of Thread directly • In order to use Virtual Thread instead of Thread another Executor implementation must be chosen ThreadFactory factory = Thread.builder().virtual().factory(); //ThreadFactory factory = ThreadFactory.builder().factory(); Executor executor= Executors.newThreadExecutor(factory);
  • 47. 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
  • 48. 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
  • 50. 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/
  • 51. 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. 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. GraalVM and SubstrateVM Source: Oleg Selajev, Oracle : “Run Code in Any Language Anywhere with GraalVM” https://www.youtube.com/watch?v=JoDOo4FyYMU
  • 54. Creating AWS Lambda with Java 1/2 : Source https://blog.runscope.com/posts/how-to-write-your-first-aws-lambda-function
  • 55. Creating AWS Lambda with Java 2/2 : Source https://blog.runscope.com/posts/how-to-write-your-first-aws-lambda-function
  • 56. 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
  • 57. Bootstrap the Java Runtime Phase • AWS Lambda starts the JVM • Java runtime loads and initializes handler class • Static initializer block of the handler class is executed • Lambda calls the handler method Vadym Kazulkin @VKazulkin , ip.labs GmbH Source: Stefano Buliani : "Best practices for AWS Lambda and Java„ https://www.youtube.com/watch?v=ddg1u5HLwg8
  • 58. AWS Lambda cold start duration per programming language Source: Mikhail Shilkov: „AWS Lambda: Cold Start Duration per Language. 2020 edition” https://mikhail.io/serverless/coldstarts/aws/languages/
  • 59. Cold start duration with Java • Below 1 second is best-case cold start duration for very simple Lambda like HelloWorld with no dependencies • It goes up significantly with more complex scenarios • Dependencies to multiple OS projects • Clients instantiation to communicate with other (AWS) services (e.g. DynamoDB, SNS, SQS, 3rd party) Source: Stefano Buliani : "Best practices for AWS Lambda and Java„ https://www.youtube.com/watch?v=ddg1u5HLwg8 Sean O‘Toole „AWS Lambda Java Tutorial: Best Practices to Lower Cold Starts” https://www.capitalone.com/tech/cloud/aws-lambda-java-tutorial-reduce-cold-starts/
  • 60. 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 dimensions, when using Serverless in the cloud
  • 61. GraalVM on SubstrateVM A game changer for Java & Serverless? Current challenges with 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 (e.g. AWS) provide Custom Runtime Option
  • 62. GraalVM Complitation Modes Source: „Everything you need to know about GraalVM by Oleg Šelajev & Thomas Wuerthinger” https://www.youtube.com/watch?v=ANN9rxYo5Hg
  • 63. AOT vs JIT Source: „Everything you need to know about GraalVM by Oleg Šelajev & Thomas Wuerthinger” https://www.youtube.com/watch?v=ANN9rxYo5Hg
  • 64. 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
  • 65. is still an interesting and great programming language

Editor's Notes

  • #6: JDK 16 Mercuriual to Git to GitHub would be similar to a C struct, which the JVM does not support. Two obvious examples of candidates for this are Optional and LocalDateTime - both have the properties that would be expected of value types. This is related to the fact that the Java type system lacks a top type - there is no type that is the supertype of both Object and int. Another way of saying this is that the Java type system is not single-rooted
  • #7: would be similar to a C struct, which the JVM does not support. Two obvious examples of candidates for this are Optional and LocalDateTime - both have the properties that would be expected of value types. This is related to the fact that the Java type system lacks a top type - there is no type that is the supertype of both Object and int. Another way of saying this is that the Java type system is not single-rooted
  • #8: Перезагрузите расположение данных в памяти
  • #9: Много ядерные
  • #10: Ядро, оперативная память Inter-socket connection меж сокетная окоммуникация Mesi protocol производительность aus Performanzgründen auf die ganzen Cache-Lines (normalerweise 64 Bytes groß), wo sich mehrere Cache-Einträge befinden.
  • #11: Задержка, латенция оперативная память, процессор
  • #12: оперативная память
  • #13: For a small object such as Integer, the overhead for an object (such as a boxed Integer object) can match or even surpass the size of the data itself (a primitive int requires 32 bits in Java). Идентичность подлинность, полиморфизм сборщик мусора
  • #14: Eric Evans Domai Driven Design Value Type Entity. What classes to implement in JDK : LocalDateTime Optional Состояние статус
  • #15: Have the same characteristics as primitives Выравнивать, сглаживать
  • #17: Использования памяти Уменьшенная косвенность и локальность Увеличенная местность/локальность Reduced memory usage: No additional memory is used to store object metadata, such as flags facilitating synchronization, identity, and garbage collection. Treat value classes like restricted objects. (made object primitve devide worse,+ boxing), painful migration, specailization and array (covariants) 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 value types are immediately present in the location in which they are needed and therefore, require no dereferencing. 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 value type fields). (which increases locality and, consequently, the chance of cache hits).
  • #18: Reduced memory usage: No additional memory is used to store object metadata, such as flags facilitating synchronization, identity, and garbage collection. Treat value classes like restricted objects. (made object primitve devide worse,+ boxing), painful migration, specailization and array (covariants)
  • #19: Flatenning= Выравнивать или разглаживание? 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 value types are immediately present in the location in which they are needed and therefore, require no dereferencing. classes (i.e. if a class contains value type fields). (which increases locality and, consequently, the chance of cache hits).
  • #20: 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 value type fields). (which increases locality and, consequently, the chance of cache hits).
  • #22: Not point in cloning them, no identity Enum has identity and can mutable. Longer answer: While the basic enum type doesn't contain mutators (and so it is immutable), your own Enum can. The problem with this is that Java enums are always singletons. If you add mutators to your enum you should keep this in mind since mutating your enum in a multithreaded application can have unforeseen
  • #23: Don‘t want flattening because of recursive structures, JVM won‘t flatten container with ? Arrays are covariant
  • #24: Don‘t want flattening because of recursive structures, JVM won‘t flatten container with ? Arrays are covariant. Primitive arrays don‘t subclass object arrays Массив ковариантность
  • #25: Memory layout opt- value types are flattened, object headers and indiractions eliminated Compiler opt – value class methods are monomorphic because no polymorpysms of value classes allowed, so on dynamic dispatching by calling, that‘s why inlined. Value type fields are paassed in registers between compiled methods
  • #26: Non-Nullability is sensible default, what what about migrating existing classes to value object, which can be null. Extra nullable Inline type inline class Point? 2 values are equals if they have the same type and all fields are equal (recurisve). But fields cann be objects that contains objects refs and value types
  • #27: Don‘t want flattening because of recursive structures, JVM won‘t flatten container with ? Arrays are covariant. Primitive arrays don‘t subclass object arrays
  • #28: Облегченный поток Продолжение?возобновление Parallel Universe which ... The author of Quasar, Ron Pressler Co-Routines in Oracle, Go
  • #29: would be similar to a C struct, which the JVM does not support. Two obvious examples of candidates for this are Optional and LocalDateTime - both have the properties that would be expected of value types. This is related to the fact that the Java type system lacks a top type - there is no type that is the supertype of both Object and int. Another way of saying this is that the Java type system is not single-rooted
  • #30: Поток. Неконтролируем главный поток A Oracle 64 bit JVM will default to 1M stack size per thread. For each gigabyte of memory you would get 1024 threads using the defaults (https://stackoverflow.com/questions/7726871/maximum-number-of-threads-in-a-jvm) ADBA is Asynchronous Database Access, a non-blocking database access api that Oracle is proposing as a Java standard. AoJ: ADBA over JDBC
  • #31: Parallel Universe which ... The author of Quasar, Ron Pressler (Co-Routines in Kotlin, Go-Green Threads)
  • #32: Scheduled планируется, стартуется Облегченный поток
  • #33: возобновление
  • #38: Pipe NIO Channel and Pipes Strand
  • #39: Pipe NIO Channel and Pipes Strand
  • #40: Executor now implements AutoClosable Interface and possible with try with ressources Trio library, Python Nursery concept Nesting- отвлетвения Структурированный параллелизм
  • #41: Nesting
  • #42: Nesting
  • #43: Nesting
  • #44: Pipe NIO Channel and Pipes
  • #45: Java Flight Recorder (JFR) is a tool for collecting diagnostic, monitoring and profiling data about a running Java application. It is integrated into the Java Virtual Machine (JVM) and causes almost no performance overhead, so it can be used even in heavily loaded production environments.
  • #46: Monitor with using directly Object.wait, Object.notify, reimplement your code with java.util.concurrent library Yield паузировать, останавливаться
  • #48: GraalVM: The one to rule them all Speaker: Виктор Полищук
  • #49: Shared Tools : Profiling und Debugger Производительность языковая совместимость
  • #50: Throughput производительность C2 server compiler c++
  • #51: Версия 20.1 Oracle Cloud
  • #52: Truffle is an Open Source library for building programming language implementations as interpreters for self-modifying Abstract Syntax Trees (AST). Truffle - a toolkit and API for building language interpreters. Truffle. programming languages that can be transformed to LLVM bitcode on Graal VM. LLVM is collection of modular and reusable compiler and toolchain technologies. Sulong : LLVM compiles into the same LLVM bitcode instead of native machine code of the platform. Then GraalVM interpret this bit code and run it on JVM Interpretor for Ruby, R, JS must exist. TruffleRuby, Graal.js, FastR Not ScriptEngine and JSR 223 Nashorn JS API.
  • #54: Native mashine code without interpreter, ahead-of-time compiler (all the classes to be used should be known at compile time)…optionally include dynamic compiler, no dynamic class loading, because of Ahead-of-Time-Compiler, to know in advance, what classes you need ELF- Linux Executable and Linking Format Closed-world-assumption
  • #55: Native mashine code without interpreter, ahead-of-time compiler…optionally include dynamic compiler, no dynamic class loading, because of Ahead-of-Time-Compiler, to know in advance, what classes you need. Dynamic runtime : Gargbage Collector and ThreadSchedular and Memory Management modular aufgebaut
  • #65: Complete CPU access during boost, Lambda hast fraction of CPU proportional to chosen RAM settings
  • #67: -High throughput (network bandwidth): limited bandwidth (an order of magnitude lower than a single modern SSD) that is shared between all functions packed on the same VM -Communication: functions not directly network accessible, they must communicate via an intermediary service writing state out to slow storage and reading it back in again on subsequent calls
  • #69: Максим Говорищев Quarkus
  • #70: Native mashine code without interpreter, ahead-of-time compiler…optionally include dynamic compiler, no dynamic class loading, because of Ahead-of-Time-Compiler, to know in advance, what classes you need. Dynamic runtime : Gargbage Collector and ThreadSchedular and Memory Management modular aufgebaut
  • #71: пропускная способность Native mashine code without interpreter, ahead-of-time compiler…optionally include dynamic compiler, no dynamic class loading, because of Ahead-of-Time-Compiler, to know in advance, what classes you need. Dynamic runtime : Gargbage Collector and ThreadSchedular and Memory Management modular aufgebaut
  • #72: Максим Говорищев Quarkus
  • #73: Native mashine code without interpreter, ahead-of-time compiler…optionally include dynamic compiler, no dynamic class loading, because of Ahead-of-Time-Compiler, to know in advance, what classes you need. Dynamic runtime : Gargbage Collector and ThreadSchedular and Memory Management modular aufgebaut
  • #76: FinDev approach per per use/invocation proce models