SlideShare uma empresa Scribd logo
1 de 42
Java
And the Java Virtual Machine
What is Java?
• Language
• Platform
What’s a Java Platform?
• Enables you to develop and run code on varied hardware and OSes
• API specification
• Runtime environment (JRE)
• Libraries (which implement the platform API)
• Execution engine (VM)
• Development kit (JDK)
• Includes JRE (above)
• Compiler, debugger, profiler, disassembler…
Show me some Java Platforms
• Java SE (Standard Edition)
• Jakarta EE (Enterprise Edition)
• Open-sourced to the Eclipse Foundation
• Oracle is keeping the Java EE trademark
• Java ME (Micro Edition)
• Mobile devices
• Java Card
• Embedded devices, IoT
• Security-sensitive applications
Diagram of the Java SE Platform
• (Next slide)
What’s Jakarta EE?
• Java SE + specs and APIs for “enterprise” features
• Servlet (handle a client request, frequently HTTP)
• JPA (map JVM classes to database tables)
• JTA (transactions)
• JAX-RS (describe a RESTful web service)
• JAXB (un)marshalling of JSON, XML
• A Jakarta EE application server provides libraries fulfilling these APIs
• Only a handful of servers are certified as complete implementations
• There’s a (smaller) “Web Profile” with the bits people actually use
Do I need Jakarta EE?
• You could try your luck with a server that’s not certified as compatible
• TomCat remains popular, and was once certified
• You can cherry-pick the bits you want
• If you like JPA, you can have it (e.g. via Hibernate)
• You can disagree on some design points (see Spring)
• Building to a standard may protect you from vendor lock-in
• Beware drama: Oracle has restricted Eclipse’s use of trademarks
• Jakarta EE will be forced to make a big breaking change to rename packages
What’s the deal with Spring?
• Application framework
• Frequently served via an application server (e.g. TomCat)
• Spring integrates with some Jakarta EE specs
• Servlet, Bean Validation, JPA
• Differs philosophically in some places
• Spring MVC instead of JAX-RS for describing REST APIs
• “Controllers” rather than “Resources”
• You can still use JAX-RS if you want
• Jackson/Gson for (un)marshalling
• You can still use JAX-B if desired
Concerning .NET
Breaking news (May 2019)
• .NET Core now has most capabilities of .NET Framework 4.8
• .NET Framework is now deprecated
• .NET Core is rebranded as .NET
• Skips version 4
• So now we’re on .NET 5
• The upcoming slides were once correct
In case any of this sounds familiar…
Java SE .NET
Bytecode format Java bytecode CIL (e.g. MSIL)
Execution engine JVM VES (e.g. CLR)
Standard library Java SE APIs .NET Standard
Extended library Java EE APIs Additional APIs within .NET Core / .NET
Framework
Differences between .NET and Java Platform
• Bytecode-compatibility
• Old Java bytecode will run on new JVMs
• .NET bytecode breaks forward-compatibility to enable new features
• Linking
• Java “links” via an execution engine option (classpath)
• .NET libraries are dynamically linked, and can also load assemblies at runtime
• Execution
• Java has no executable; main class is an argument to execution engine
• .NET executables are libraries plus metadata
Differences between .NET and Java Platform
• Generics
• Java bytecode has no concept of generics (compilers “erase” them)
• Generics exist at runtime in .NET bytecode, and can be reified
• Special features supported in .NET bytecode
• Value types, stackalloc, pointers
• Move program counter / time-travel debugging
• JIT
• JVM JIT implementations use ambitious and complex optimizations
• .NET JIT is simpler. Performance through language features instead
Aside: .NET Framework vs .NET Core
• Original .NET specification was coupled to Windows and IIS
• Same GC and JIT (RyuJIT), same base class libraries (.NET Standard)
• Core is refactored to be modular and with fewer dependencies
• Core provides .NET Native; ahead-of-time compile CIL to native code
• Core Lacks features like Application Domains, Code Access Security
• Both implement Microsoft’s Common Language Infrastructure
• Program structure
• CIL bytecode format (e.g. MSIL)
• Virtual Execution System (e.g. CLR)
Aside: Mono
• An open-source implementation of .NET Framework
• Cross-platform
• Microsoft-sponsored non-Microsoft project
• Supported by Xamarin… who were bought by Microsoft
• Implements Microsoft’s specifications for C# and the CIL
(standardized by ECMA and ISO)
• Pretty cool until .NET Core was announced
Java is a poor man’s Docker
• Application servers (e.g. Tomcat) are basically k8s worker nodes
• JRE is basically a Container OS
• JVM is basically runc
• Java SE APIs are basically system libraries
• EAR/WAR artefacts are basically Container Images
• Compile your application once, deploy anywhere
Method signatures
• These impossible classes are possible in JVM bytecode, but not Java
• Overload method on return type
• Two fields with same name (but different types)
class C {
void a(String s) {}
int a(String s) { return 0; }
}
class C {
int a;
String a;
}
JVM for ultra low-latency computing
• Industry will pay $150k/month for a 3ms edge on the competition
• JVM GC pauses are frequently bigger than this
• Consider a Direct Market Access application
• Parse, validate, serialize message, check risk, read market data, serialize, send
• JVM can do this in ~10 microsecs, just as fast as C/C++
• Admittedly you have to write very non-idiomatic code, and complete warmup
• FPGA ~1 microsec
• ASIC ~400 nanosecs
• Python 50x slower
Should I run Java on the JVM?
1. Should I run Java on the JVM?
2. Should I run Java on the JVM?
Sun/Oracle Hotspot JVM JIT
• Method inlining, loop unrolling
• On-stack replacement
• Jump from interpreted code to JIT’d equivalent whenever code becomes hot
• Escape analysis
• Object fields are replaced with scalar values, avoiding heap allocation
• Monomorphic dispatch (avoid vtable lookup)
• Intrinsics (replace method with something more native)
• Dynamic deoptimization
• As access patterns change or new classes loaded: undo and try again
Sun/Oracle Hotspot JVM JIT
• Two compilers, tiered compilation (as of Java 7)
• C1 (Client)
• Fast startup
• Emits simple native code
• Still faster than executing bytecode in an interpreter
• C2 (Server)
• Generates better native code
• Decides how best to optimize based on execution profiles
• May frequently de-optimize
• Old, complex C++ codebase (needs replacing – more on this later)
Sun/Oracle Hotspot JVM JIT
• Tiered compilation
• Level 0 – interpreted code
• Level 1 – simple C1 compiled code (with no profiling)
• Level 2 – limited C1 compiled code (with light profiling)
• Level 3 – full C1 compiled code (with full profiling)
• Level 4 – C2 compiled code (uses profiling data from previous steps)
• Usually 0 -> 3 -> 4
• More complex code warrants more profiling, compilation
Sun/Oracle Hotspot JVM GC
• G1 (Java 8)
• Specify your latency requirements (“20 ms is the longest I’d wait for GC”)
• ZGC (Java 11)
• Low (<10ms) pause times even on multi-terabyte heaps
• Future support: multi-tiered heaps (hot objects in DRAM, cold in NVMe flash)
• Heap compression
• Pointer colouring (sell more SPARC machines)
• Shenandoah (Java 12)
• Low, constant pause time
• Most work done concurrently
Dalvik
• Google’s implementation of JVM for Android
• Caused Oracle to sue Google for 9 years (so far)
• Uses registers as primarily unit of data-storage instead of stack
• Avoid instruction dispatch, unnecessary memory access
• Higher semantic density per instruction
• 30% fewer instructions, 35% fewer code units
• 35% more bytes in instruction stream (but we consume two at a time)
• Combines .class files into .dex (Dalvik Executables)
• De-dupes any repeated information, saving 50% space
OpenJDK vs Oracle JDK
• Around Java SE 7, various JVMs converged.
• Oracle provided some extra ”commercial features”
• Incident analysis
• Font rendering
• Class sharing (for faster startup, smaller footprint)
• ZGC garbage collector
• For Java 11, Oracle upstreamed these. Basically the same now.
• Oracle JDK is (now) commercial
• OpenJDK is (now) provided by Red Hat (previously Oracle)
Hipster JVMs
• Amazon Corretto
• Zero-cost LTS
• Azul Zing
• Faster startup (saves previously-used JIT profile for re-use)
• Falcon JIT (high-performance server JIT based on LLVM)
• C4 garbage collector (concurrent, compacting, no GC pause)
• TeaVM
• AoT compiles JVM bytecode to JS or WebAssembly
• GraalVM (more on this later)
Hipster JVMs
• Or use the CLR
• Not standards-compliant
• Due to native interface
Should I run Java on the JVM?
1. Should I run Java on the JVM?
2. Should I run Java on the JVM?
JavaScript on the JVM
• Rhino; Java 1.4/1997 – part of an all-Java Netscape Navigator
• JVM JIT outperformed C++, but memory leaky and slow startup
• Interpreted mode was
• Nashorn; Java 8/2011
• “Several orders of magnitude” faster
• Deprecated in Java 11 because JavaScript was changing too fast to keep up
• GraalVM
• Suggested as a way to replace Nashorn
• More on this later
Other JVM languages
• Scala
• Has a “criticism” section on Wikipedia
• Kotlin
• Made by JetBrains (i.e. IntelliJ, Resharper)
• Coroutines, generators, safe navigation, elvis ?:, reification, data classes, FP
• Fast compilation (aiming to be as fast as Java, and not slow like Scala)
• Compiles to JS and native code
• Clojure
• Lisp, REPL
• Compiles to JS too
Other JVM languages
• Groovy
• Used for DSLs (for example data engineering)
• Used for Gradle config (now being replaced by Kotlin)
• JRuby
• Contributed invokedynamic instruction to JVM (not used by Java!)
• Dynamically changes classes and methods at runtime
• Outperforms real Ruby, especially in concurrent code (thanks to JVM threads)
• Jython
• Sounds like it’s for people who concede JVM has good libraries, but hate Java
GraalVM
• Oracle Labs research project based on JDK 8
• Universal Virtual Machine
• JVM-based languages
• LLVM-based languages
• Node.js, Python, Ruby, R
• JIT and AoT compiler (Graal)
• Language AST interpreter (Truffle)
• Enables language-agnostic debugger, profiler, heap viewer
• Compilation to native images, with minimal runtime (SubstrateVM)
GraalVM – JIT Compiler (Graal)
• Written in Java
• Compile Java using Java, rather than C++ (“Java-on-Java”)
• Generates native code (like LLVM/Clang does)
• Integrates into any JDK that supports JVM CI (Compiler Interface)
• JVM CI lets a JVM use as its dynamic compiler: any compiler written in Java
• Oracle Labs has backported JVM CI to JDK 8
• JVM CI ships with JDK 11 proper
• Replace Hotspot JIT’s C2 compiler
• Optimized performance for Truffle-based languages running on JVM
GraalVM – Ahead-of-time compilation
• Uses Graal compiler too
• Includes minimal runtime, SubstrateVM
• Smaller memory footprint
• Zero-dependency native image
• Tiny filesize (Spring web application + runtime in 36MB)
• Instant startup (deploy Spring web application in about 50ms)
• Produce native libraries (for your other native code to link to)
• Optionally include Graal compiler to complement AoT with JIT
• Build image with profile-guided optimizations from previous runs
GraalVM – Truffle
• Library for building programming language implementations
• Describe language as an interpreter for a self-modifying Abstract Syntax Tree
• Low-overhead language interop
• Performance matches or exceeds other language runtimes
• General instrumentation framework
• Multi-language debugging (via Chrome DevTools!)
• Profiling
• Heap view
GraalVM – Truffle
GraalVM – LLVM
• GraalVM implements LLVM’s LLI tool
• Directly execute programs from LLVM bitcode
• First you must compile any program (e.g. C, C++, Rust) to LLVM IR
• Note: platform-dependent
• LLI interprets the IR, then dynamically compiles hot parts using Graal
• Enables seamless interop with other dynamic languages in GraalVM
GraalVM – Database embed
• Oracle Database, MySQL
• Use GraalVM languages and modules… inside a SQL statement
• Write SELECT statements that:
• Classify whether a string is an email address
• Detect credit card brand
GraalVM – Performance
• Twitter cut their CPU usage by 13% by switching to GraalVM
• Across thousands of machines running thousands of JVMs
• See “Twitter’s Quest for a Wholly Graal Runtime”
• Better inlining, and across language boundaries
• Partial escape analysis
• Remove costly object allocations in more scenarios
• More aggressive speculative optimizations
• Full set of optimizations only available with Enterprise license!
Advantages compared to standard runtime
• Run Node.js with large-heap configuration and JVM’s GC
• V8 is tuned for browsers and small-heap scenarios
• Re-use libraries from Java, R, or Python… in Node.js
• Use Python for data science
• Use R for plotting graphs
• Use Java for Spark or Flink
That’s all
• Alex Birch

Mais conteúdo relacionado

Mais procurados

OSGi Community Event 2010 - OSGi Technical Update
OSGi Community Event 2010 - OSGi Technical UpdateOSGi Community Event 2010 - OSGi Technical Update
OSGi Community Event 2010 - OSGi Technical Updatemfrancis
 
Java Application Servers Are Dead!
Java Application Servers Are Dead!Java Application Servers Are Dead!
Java Application Servers Are Dead!Eberhard Wolff
 
Java byte code presentation
Java byte code presentationJava byte code presentation
Java byte code presentationMahnoor Hashmi
 
Peeling back the Lambda layers
Peeling back the Lambda layersPeeling back the Lambda layers
Peeling back the Lambda layersPatrick McCaffrey
 
Ruby for devops
Ruby for devopsRuby for devops
Ruby for devopsAdam Klein
 
Handling 1 Billion Requests/hr with Minimal Latency Using Docker
Handling 1 Billion Requests/hr with Minimal Latency Using DockerHandling 1 Billion Requests/hr with Minimal Latency Using Docker
Handling 1 Billion Requests/hr with Minimal Latency Using DockerMatomy
 
Ekon21 Microservices - Event Driven Design
Ekon21 Microservices - Event Driven DesignEkon21 Microservices - Event Driven Design
Ekon21 Microservices - Event Driven DesignArnaud Bouchez
 
Adding Real-time Features to PHP Applications
Adding Real-time Features to PHP ApplicationsAdding Real-time Features to PHP Applications
Adding Real-time Features to PHP ApplicationsRonny López
 
Java Persistence API (JPA) - A Brief Overview
Java Persistence API (JPA) - A Brief OverviewJava Persistence API (JPA) - A Brief Overview
Java Persistence API (JPA) - A Brief OverviewCraig Dickson
 
Multi-threading in the modern era: Vertx Akka and Quasar
Multi-threading in the modern era: Vertx Akka and QuasarMulti-threading in the modern era: Vertx Akka and Quasar
Multi-threading in the modern era: Vertx Akka and QuasarGal Marder
 
OSGi In Anger - Tara Simpson
OSGi In Anger - Tara SimpsonOSGi In Anger - Tara Simpson
OSGi In Anger - Tara Simpsonmfrancis
 
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...J V
 
Aws Lambda for Java Architects - Illinois VJug -2016-05-03
Aws Lambda for Java Architects - Illinois VJug -2016-05-03Aws Lambda for Java Architects - Illinois VJug -2016-05-03
Aws Lambda for Java Architects - Illinois VJug -2016-05-03Derek Ashmore
 
Repository performance tuning
Repository performance tuningRepository performance tuning
Repository performance tuningJukka Zitting
 
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...Lucas Jellema
 

Mais procurados (19)

OSGi Community Event 2010 - OSGi Technical Update
OSGi Community Event 2010 - OSGi Technical UpdateOSGi Community Event 2010 - OSGi Technical Update
OSGi Community Event 2010 - OSGi Technical Update
 
Java Application Servers Are Dead!
Java Application Servers Are Dead!Java Application Servers Are Dead!
Java Application Servers Are Dead!
 
Testing Automaton - CFSummit 2016
Testing Automaton - CFSummit 2016Testing Automaton - CFSummit 2016
Testing Automaton - CFSummit 2016
 
Java byte code presentation
Java byte code presentationJava byte code presentation
Java byte code presentation
 
Peeling back the Lambda layers
Peeling back the Lambda layersPeeling back the Lambda layers
Peeling back the Lambda layers
 
Ruby for devops
Ruby for devopsRuby for devops
Ruby for devops
 
Handling 1 Billion Requests/hr with Minimal Latency Using Docker
Handling 1 Billion Requests/hr with Minimal Latency Using DockerHandling 1 Billion Requests/hr with Minimal Latency Using Docker
Handling 1 Billion Requests/hr with Minimal Latency Using Docker
 
JVM
JVMJVM
JVM
 
Ekon21 Microservices - Event Driven Design
Ekon21 Microservices - Event Driven DesignEkon21 Microservices - Event Driven Design
Ekon21 Microservices - Event Driven Design
 
Adding Real-time Features to PHP Applications
Adding Real-time Features to PHP ApplicationsAdding Real-time Features to PHP Applications
Adding Real-time Features to PHP Applications
 
MariaDB - The Future of MySQL?
MariaDB - The Future of MySQL?MariaDB - The Future of MySQL?
MariaDB - The Future of MySQL?
 
Lesson1 intro
Lesson1 introLesson1 intro
Lesson1 intro
 
Java Persistence API (JPA) - A Brief Overview
Java Persistence API (JPA) - A Brief OverviewJava Persistence API (JPA) - A Brief Overview
Java Persistence API (JPA) - A Brief Overview
 
Multi-threading in the modern era: Vertx Akka and Quasar
Multi-threading in the modern era: Vertx Akka and QuasarMulti-threading in the modern era: Vertx Akka and Quasar
Multi-threading in the modern era: Vertx Akka and Quasar
 
OSGi In Anger - Tara Simpson
OSGi In Anger - Tara SimpsonOSGi In Anger - Tara Simpson
OSGi In Anger - Tara Simpson
 
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
 
Aws Lambda for Java Architects - Illinois VJug -2016-05-03
Aws Lambda for Java Architects - Illinois VJug -2016-05-03Aws Lambda for Java Architects - Illinois VJug -2016-05-03
Aws Lambda for Java Architects - Illinois VJug -2016-05-03
 
Repository performance tuning
Repository performance tuningRepository performance tuning
Repository performance tuning
 
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...
 

Semelhante a A tour of Java and the JVM

Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019graemerocher
 
T4T Training day - NodeJS
T4T Training day - NodeJST4T Training day - NodeJS
T4T Training day - NodeJSTim Sommer
 
JAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxJAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxMurugesh33
 
JAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxJAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxMurugesh33
 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of JavaFu Cheng
 
Lecture-01 _Java Introduction CS 441 Fast
Lecture-01 _Java Introduction CS 441 FastLecture-01 _Java Introduction CS 441 Fast
Lecture-01 _Java Introduction CS 441 FastUzairSaeed18
 
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para TiGustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para TiSoftware Guru
 
Java-light-speed NebraskaCode.pdf
Java-light-speed NebraskaCode.pdfJava-light-speed NebraskaCode.pdf
Java-light-speed NebraskaCode.pdfRichHagarty
 
Towards "write once - run whenever possible" with Safety Critical Java af Ben...
Towards "write once - run whenever possible" with Safety Critical Java af Ben...Towards "write once - run whenever possible" with Safety Critical Java af Ben...
Towards "write once - run whenever possible" with Safety Critical Java af Ben...InfinIT - Innovationsnetværket for it
 
Simple tweaks to get the most out of your jvm
Simple tweaks to get the most out of your jvmSimple tweaks to get the most out of your jvm
Simple tweaks to get the most out of your jvmJamie Coleman
 
JCConf 2018 - Retrospect and Prospect of Java
JCConf 2018 - Retrospect and Prospect of JavaJCConf 2018 - Retrospect and Prospect of Java
JCConf 2018 - Retrospect and Prospect of JavaJoseph Kuo
 
Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"
Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"
Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"GlobalLogic Ukraine
 
Polygot Java EE on the GraalVM
Polygot Java EE on the GraalVMPolygot Java EE on the GraalVM
Polygot Java EE on the GraalVMRyan Cuprak
 
JAVA-History-buzzwords-JVM_architecture.pptx
JAVA-History-buzzwords-JVM_architecture.pptxJAVA-History-buzzwords-JVM_architecture.pptx
JAVA-History-buzzwords-JVM_architecture.pptx20EUEE018DEEPAKM
 
Building Asynchronous Applications
Building Asynchronous ApplicationsBuilding Asynchronous Applications
Building Asynchronous ApplicationsJohan Edstrom
 
Performance of Microservice Frameworks on different JVMs
Performance of Microservice Frameworks on different JVMsPerformance of Microservice Frameworks on different JVMs
Performance of Microservice Frameworks on different JVMsMaarten Smeets
 
Kubernetes Manchester - 6th December 2018
Kubernetes Manchester - 6th December 2018Kubernetes Manchester - 6th December 2018
Kubernetes Manchester - 6th December 2018David Stockton
 

Semelhante a A tour of Java and the JVM (20)

Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019
 
T4T Training day - NodeJS
T4T Training day - NodeJST4T Training day - NodeJS
T4T Training day - NodeJS
 
JAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptx
JAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptxJAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptx
JAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptx
 
JAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxJAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptx
 
JAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxJAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptx
 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of Java
 
Lecture-01 _Java Introduction CS 441 Fast
Lecture-01 _Java Introduction CS 441 FastLecture-01 _Java Introduction CS 441 Fast
Lecture-01 _Java Introduction CS 441 Fast
 
Java Introduction
Java IntroductionJava Introduction
Java Introduction
 
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para TiGustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
 
Java-light-speed NebraskaCode.pdf
Java-light-speed NebraskaCode.pdfJava-light-speed NebraskaCode.pdf
Java-light-speed NebraskaCode.pdf
 
Towards "write once - run whenever possible" with Safety Critical Java af Ben...
Towards "write once - run whenever possible" with Safety Critical Java af Ben...Towards "write once - run whenever possible" with Safety Critical Java af Ben...
Towards "write once - run whenever possible" with Safety Critical Java af Ben...
 
Simple tweaks to get the most out of your jvm
Simple tweaks to get the most out of your jvmSimple tweaks to get the most out of your jvm
Simple tweaks to get the most out of your jvm
 
JCConf 2018 - Retrospect and Prospect of Java
JCConf 2018 - Retrospect and Prospect of JavaJCConf 2018 - Retrospect and Prospect of Java
JCConf 2018 - Retrospect and Prospect of Java
 
01 java intro
01 java intro01 java intro
01 java intro
 
Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"
Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"
Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"
 
Polygot Java EE on the GraalVM
Polygot Java EE on the GraalVMPolygot Java EE on the GraalVM
Polygot Java EE on the GraalVM
 
JAVA-History-buzzwords-JVM_architecture.pptx
JAVA-History-buzzwords-JVM_architecture.pptxJAVA-History-buzzwords-JVM_architecture.pptx
JAVA-History-buzzwords-JVM_architecture.pptx
 
Building Asynchronous Applications
Building Asynchronous ApplicationsBuilding Asynchronous Applications
Building Asynchronous Applications
 
Performance of Microservice Frameworks on different JVMs
Performance of Microservice Frameworks on different JVMsPerformance of Microservice Frameworks on different JVMs
Performance of Microservice Frameworks on different JVMs
 
Kubernetes Manchester - 6th December 2018
Kubernetes Manchester - 6th December 2018Kubernetes Manchester - 6th December 2018
Kubernetes Manchester - 6th December 2018
 

Último

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 

Último (20)

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 

A tour of Java and the JVM

  • 1. Java And the Java Virtual Machine
  • 2. What is Java? • Language • Platform
  • 3. What’s a Java Platform? • Enables you to develop and run code on varied hardware and OSes • API specification • Runtime environment (JRE) • Libraries (which implement the platform API) • Execution engine (VM) • Development kit (JDK) • Includes JRE (above) • Compiler, debugger, profiler, disassembler…
  • 4. Show me some Java Platforms • Java SE (Standard Edition) • Jakarta EE (Enterprise Edition) • Open-sourced to the Eclipse Foundation • Oracle is keeping the Java EE trademark • Java ME (Micro Edition) • Mobile devices • Java Card • Embedded devices, IoT • Security-sensitive applications
  • 5. Diagram of the Java SE Platform • (Next slide)
  • 6.
  • 7. What’s Jakarta EE? • Java SE + specs and APIs for “enterprise” features • Servlet (handle a client request, frequently HTTP) • JPA (map JVM classes to database tables) • JTA (transactions) • JAX-RS (describe a RESTful web service) • JAXB (un)marshalling of JSON, XML • A Jakarta EE application server provides libraries fulfilling these APIs • Only a handful of servers are certified as complete implementations • There’s a (smaller) “Web Profile” with the bits people actually use
  • 8. Do I need Jakarta EE? • You could try your luck with a server that’s not certified as compatible • TomCat remains popular, and was once certified • You can cherry-pick the bits you want • If you like JPA, you can have it (e.g. via Hibernate) • You can disagree on some design points (see Spring) • Building to a standard may protect you from vendor lock-in • Beware drama: Oracle has restricted Eclipse’s use of trademarks • Jakarta EE will be forced to make a big breaking change to rename packages
  • 9. What’s the deal with Spring? • Application framework • Frequently served via an application server (e.g. TomCat) • Spring integrates with some Jakarta EE specs • Servlet, Bean Validation, JPA • Differs philosophically in some places • Spring MVC instead of JAX-RS for describing REST APIs • “Controllers” rather than “Resources” • You can still use JAX-RS if you want • Jackson/Gson for (un)marshalling • You can still use JAX-B if desired
  • 11. Breaking news (May 2019) • .NET Core now has most capabilities of .NET Framework 4.8 • .NET Framework is now deprecated • .NET Core is rebranded as .NET • Skips version 4 • So now we’re on .NET 5 • The upcoming slides were once correct
  • 12. In case any of this sounds familiar… Java SE .NET Bytecode format Java bytecode CIL (e.g. MSIL) Execution engine JVM VES (e.g. CLR) Standard library Java SE APIs .NET Standard Extended library Java EE APIs Additional APIs within .NET Core / .NET Framework
  • 13. Differences between .NET and Java Platform • Bytecode-compatibility • Old Java bytecode will run on new JVMs • .NET bytecode breaks forward-compatibility to enable new features • Linking • Java “links” via an execution engine option (classpath) • .NET libraries are dynamically linked, and can also load assemblies at runtime • Execution • Java has no executable; main class is an argument to execution engine • .NET executables are libraries plus metadata
  • 14. Differences between .NET and Java Platform • Generics • Java bytecode has no concept of generics (compilers “erase” them) • Generics exist at runtime in .NET bytecode, and can be reified • Special features supported in .NET bytecode • Value types, stackalloc, pointers • Move program counter / time-travel debugging • JIT • JVM JIT implementations use ambitious and complex optimizations • .NET JIT is simpler. Performance through language features instead
  • 15. Aside: .NET Framework vs .NET Core • Original .NET specification was coupled to Windows and IIS • Same GC and JIT (RyuJIT), same base class libraries (.NET Standard) • Core is refactored to be modular and with fewer dependencies • Core provides .NET Native; ahead-of-time compile CIL to native code • Core Lacks features like Application Domains, Code Access Security • Both implement Microsoft’s Common Language Infrastructure • Program structure • CIL bytecode format (e.g. MSIL) • Virtual Execution System (e.g. CLR)
  • 16. Aside: Mono • An open-source implementation of .NET Framework • Cross-platform • Microsoft-sponsored non-Microsoft project • Supported by Xamarin… who were bought by Microsoft • Implements Microsoft’s specifications for C# and the CIL (standardized by ECMA and ISO) • Pretty cool until .NET Core was announced
  • 17. Java is a poor man’s Docker • Application servers (e.g. Tomcat) are basically k8s worker nodes • JRE is basically a Container OS • JVM is basically runc • Java SE APIs are basically system libraries • EAR/WAR artefacts are basically Container Images • Compile your application once, deploy anywhere
  • 18. Method signatures • These impossible classes are possible in JVM bytecode, but not Java • Overload method on return type • Two fields with same name (but different types) class C { void a(String s) {} int a(String s) { return 0; } } class C { int a; String a; }
  • 19. JVM for ultra low-latency computing • Industry will pay $150k/month for a 3ms edge on the competition • JVM GC pauses are frequently bigger than this • Consider a Direct Market Access application • Parse, validate, serialize message, check risk, read market data, serialize, send • JVM can do this in ~10 microsecs, just as fast as C/C++ • Admittedly you have to write very non-idiomatic code, and complete warmup • FPGA ~1 microsec • ASIC ~400 nanosecs • Python 50x slower
  • 20. Should I run Java on the JVM? 1. Should I run Java on the JVM? 2. Should I run Java on the JVM?
  • 21. Sun/Oracle Hotspot JVM JIT • Method inlining, loop unrolling • On-stack replacement • Jump from interpreted code to JIT’d equivalent whenever code becomes hot • Escape analysis • Object fields are replaced with scalar values, avoiding heap allocation • Monomorphic dispatch (avoid vtable lookup) • Intrinsics (replace method with something more native) • Dynamic deoptimization • As access patterns change or new classes loaded: undo and try again
  • 22. Sun/Oracle Hotspot JVM JIT • Two compilers, tiered compilation (as of Java 7) • C1 (Client) • Fast startup • Emits simple native code • Still faster than executing bytecode in an interpreter • C2 (Server) • Generates better native code • Decides how best to optimize based on execution profiles • May frequently de-optimize • Old, complex C++ codebase (needs replacing – more on this later)
  • 23. Sun/Oracle Hotspot JVM JIT • Tiered compilation • Level 0 – interpreted code • Level 1 – simple C1 compiled code (with no profiling) • Level 2 – limited C1 compiled code (with light profiling) • Level 3 – full C1 compiled code (with full profiling) • Level 4 – C2 compiled code (uses profiling data from previous steps) • Usually 0 -> 3 -> 4 • More complex code warrants more profiling, compilation
  • 24. Sun/Oracle Hotspot JVM GC • G1 (Java 8) • Specify your latency requirements (“20 ms is the longest I’d wait for GC”) • ZGC (Java 11) • Low (<10ms) pause times even on multi-terabyte heaps • Future support: multi-tiered heaps (hot objects in DRAM, cold in NVMe flash) • Heap compression • Pointer colouring (sell more SPARC machines) • Shenandoah (Java 12) • Low, constant pause time • Most work done concurrently
  • 25. Dalvik • Google’s implementation of JVM for Android • Caused Oracle to sue Google for 9 years (so far) • Uses registers as primarily unit of data-storage instead of stack • Avoid instruction dispatch, unnecessary memory access • Higher semantic density per instruction • 30% fewer instructions, 35% fewer code units • 35% more bytes in instruction stream (but we consume two at a time) • Combines .class files into .dex (Dalvik Executables) • De-dupes any repeated information, saving 50% space
  • 26. OpenJDK vs Oracle JDK • Around Java SE 7, various JVMs converged. • Oracle provided some extra ”commercial features” • Incident analysis • Font rendering • Class sharing (for faster startup, smaller footprint) • ZGC garbage collector • For Java 11, Oracle upstreamed these. Basically the same now. • Oracle JDK is (now) commercial • OpenJDK is (now) provided by Red Hat (previously Oracle)
  • 27. Hipster JVMs • Amazon Corretto • Zero-cost LTS • Azul Zing • Faster startup (saves previously-used JIT profile for re-use) • Falcon JIT (high-performance server JIT based on LLVM) • C4 garbage collector (concurrent, compacting, no GC pause) • TeaVM • AoT compiles JVM bytecode to JS or WebAssembly • GraalVM (more on this later)
  • 28. Hipster JVMs • Or use the CLR • Not standards-compliant • Due to native interface
  • 29. Should I run Java on the JVM? 1. Should I run Java on the JVM? 2. Should I run Java on the JVM?
  • 30. JavaScript on the JVM • Rhino; Java 1.4/1997 – part of an all-Java Netscape Navigator • JVM JIT outperformed C++, but memory leaky and slow startup • Interpreted mode was • Nashorn; Java 8/2011 • “Several orders of magnitude” faster • Deprecated in Java 11 because JavaScript was changing too fast to keep up • GraalVM • Suggested as a way to replace Nashorn • More on this later
  • 31. Other JVM languages • Scala • Has a “criticism” section on Wikipedia • Kotlin • Made by JetBrains (i.e. IntelliJ, Resharper) • Coroutines, generators, safe navigation, elvis ?:, reification, data classes, FP • Fast compilation (aiming to be as fast as Java, and not slow like Scala) • Compiles to JS and native code • Clojure • Lisp, REPL • Compiles to JS too
  • 32. Other JVM languages • Groovy • Used for DSLs (for example data engineering) • Used for Gradle config (now being replaced by Kotlin) • JRuby • Contributed invokedynamic instruction to JVM (not used by Java!) • Dynamically changes classes and methods at runtime • Outperforms real Ruby, especially in concurrent code (thanks to JVM threads) • Jython • Sounds like it’s for people who concede JVM has good libraries, but hate Java
  • 33. GraalVM • Oracle Labs research project based on JDK 8 • Universal Virtual Machine • JVM-based languages • LLVM-based languages • Node.js, Python, Ruby, R • JIT and AoT compiler (Graal) • Language AST interpreter (Truffle) • Enables language-agnostic debugger, profiler, heap viewer • Compilation to native images, with minimal runtime (SubstrateVM)
  • 34. GraalVM – JIT Compiler (Graal) • Written in Java • Compile Java using Java, rather than C++ (“Java-on-Java”) • Generates native code (like LLVM/Clang does) • Integrates into any JDK that supports JVM CI (Compiler Interface) • JVM CI lets a JVM use as its dynamic compiler: any compiler written in Java • Oracle Labs has backported JVM CI to JDK 8 • JVM CI ships with JDK 11 proper • Replace Hotspot JIT’s C2 compiler • Optimized performance for Truffle-based languages running on JVM
  • 35. GraalVM – Ahead-of-time compilation • Uses Graal compiler too • Includes minimal runtime, SubstrateVM • Smaller memory footprint • Zero-dependency native image • Tiny filesize (Spring web application + runtime in 36MB) • Instant startup (deploy Spring web application in about 50ms) • Produce native libraries (for your other native code to link to) • Optionally include Graal compiler to complement AoT with JIT • Build image with profile-guided optimizations from previous runs
  • 36. GraalVM – Truffle • Library for building programming language implementations • Describe language as an interpreter for a self-modifying Abstract Syntax Tree • Low-overhead language interop • Performance matches or exceeds other language runtimes • General instrumentation framework • Multi-language debugging (via Chrome DevTools!) • Profiling • Heap view
  • 38. GraalVM – LLVM • GraalVM implements LLVM’s LLI tool • Directly execute programs from LLVM bitcode • First you must compile any program (e.g. C, C++, Rust) to LLVM IR • Note: platform-dependent • LLI interprets the IR, then dynamically compiles hot parts using Graal • Enables seamless interop with other dynamic languages in GraalVM
  • 39. GraalVM – Database embed • Oracle Database, MySQL • Use GraalVM languages and modules… inside a SQL statement • Write SELECT statements that: • Classify whether a string is an email address • Detect credit card brand
  • 40. GraalVM – Performance • Twitter cut their CPU usage by 13% by switching to GraalVM • Across thousands of machines running thousands of JVMs • See “Twitter’s Quest for a Wholly Graal Runtime” • Better inlining, and across language boundaries • Partial escape analysis • Remove costly object allocations in more scenarios • More aggressive speculative optimizations • Full set of optimizations only available with Enterprise license!
  • 41. Advantages compared to standard runtime • Run Node.js with large-heap configuration and JVM’s GC • V8 is tuned for browsers and small-heap scenarios • Re-use libraries from Java, R, or Python… in Node.js • Use Python for data science • Use R for plotting graphs • Use Java for Spark or Flink

Notas do Editor

  1. Platform was decoupled from language as of Java SE 7 https://docs.oracle.com/javase/specs/jls/se7/html/jls-0-preface7.html Java 7 JVM implements JSR 292: Supporting Dynamically Typed Languages[7] on the Java Platform, a new feature which supports dynamically typed languages in the JVM. This feature is developed within the Da Vinci Machine project whose mission is to extend the JVM so that it supports languages other than Java.[8][9]
  2. https://news.ycombinator.com/item?id=19825059
  3. *Until Java 1.7, where the platform was decoupled from the language
  4. https://docs.google.com/document/d/1IpYv5t3tYrH3JkctwkNQZmt8c19TAC0hxIrBdorT4y4/edit https://headcrashing.wordpress.com/2019/05/03/negotiations-failed-how-oracle-killed-java-ee/
  5. https://docs.google.com/document/d/1IpYv5t3tYrH3JkctwkNQZmt8c19TAC0hxIrBdorT4y4/edit https://content.pivotal.io/spring/oct-4-getting-reactive-with-spring-framework-5-0-s-ga-release-webinar
  6. https://devblogs.microsoft.com/dotnet/introducing-net-5/
  7. https://news.ycombinator.com/item?id=15955685 https://stackoverflow.com/a/295248/5257399 https://bugs.eclipse.org/bugs/show_bug.cgi?id=287795 https://bugs.openjdk.java.net/browse/JDK-4059717
  8. https://stackoverflow.com/a/26908101/5257399 https://stackoverflow.com/a/48599338/5257399 https://devblogs.microsoft.com/dotnet/introducing-net-core/
  9. https://stackoverflow.com/a/39740592/5257399
  10. https://blog.jessfraz.com/post/getting-towards-real-sandbox-containers/ https://blog.jessfraz.com/post/containers-zones-jails-vms/ https://twitter.com/thejsj/status/840295431779172352/photo/1?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E840295431779172352&ref_url=https%3A%2F%2Fblog.jessfraz.com%2Fpost%2Fcontainers-zones-jails-vms%2F https://blog.jessfraz.com/post/containers-security-and-echo-chambers/
  11. https://news.ycombinator.com/item?id=13976533 https://barahilia.github.io/blog/computers/2017/03/26/impossible-java.html
  12. https://www.youtube.com/watch?v=BD9cRbxWQx8&t=1776s
  13. https://jakubstransky.com/2018/08/28/hotspot-jvm-jit-optimisation-techniques/ https://stackoverflow.com/a/45781033/5257399 https://www.oracle.com/technetwork/java/whitepaper-135217.html
  14. https://dzone.com/articles/client-server-and-tiered-compilation
  15. https://dzone.com/articles/client-server-and-tiered-compilation
  16. https://www.opsian.com/blog/javas-new-zgc-is-very-exciting/
  17. https://stackoverflow.com/questions/2719469/why-is-the-jvm-stack-based-and-the-dalvik-vm-register-based https://markfaction.wordpress.com/2012/07/15/stack-based-vs-register-based-virtual-machine-architecture-and-the-dalvik-vm/
  18. https://stackoverflow.com/a/53749226/5257399 https://blog.joda.org/2018/09/do-not-fall-into-oracles-java-11-trap.html
  19. https://www.e4developer.com/2019/03/30/which-java-jdk-should-i-use-which-provide-free-lts/ https://www.azul.com/products/zulu-enterprise/jdk-comparison-matrix-2/ https://www.azul.com/resources/azul-technology/azul-c4-garbage-collector/
  20. https://stackoverflow.com/questions/1859865/what-is-jython-and-is-it-useful-at-all
  21. https://www.infoworld.com/article/3187868/oracles-java-on-java-experiment-picks-up-steam.html https://bugs.openjdk.java.net/browse/JDK-8062493 https://medium.com/@jponge/the-graalvm-frenzy-f54257f5932c
  22. https://www.infoworld.com/article/3187868/oracles-java-on-java-experiment-picks-up-steam.html https://bugs.openjdk.java.net/browse/JDK-8062493 https://medium.com/@jponge/the-graalvm-frenzy-f54257f5932c