Graalvm Specific Benefits
Total Page:16
File Type:pdf, Size:1020Kb
1 About Me Stuart Douglas ● Senior Principal Engineer at Red Hat ● Quarkus Co-founder ● Servlet Specification Co-lead ● Founder of the Undertow Project ● Core Contributor to WildFly 2 3 Benefit No. 1: Developer Joy A cohesive platform for optimized developer joy: ● ● ● ● ● 4 Benefit No. 2: Supersonic Subatomic Java Quarkus + Native Quarkus + JVM Traditional (via GraalVM) (via OpenJDK) Cloud-Native Stack 12 MB 73 MB 136 MB 5 Benefit No. 2: Supersonic Subatomic Java Quarkus + Native Quarkus + JVM Traditional (via GraalVM) (via OpenJDK) Cloud-Native Stack 28 MB 145 MB 209 MB 6 Benefit No. 2: Supersonic Subatomic Java Quarkus + Native (via GraalVM) 0.016 Seconds Quarkus + JVM (via OpenJDK) 0.943 Seconds Traditional Cloud-Native Stack 4.3 Seconds Quarkus + Native (via GraalVM) 0.042 Seconds Quarkus + JVM (via OpenJDK) 2.033 Seconds Traditional Cloud-Native Stack 9.5 Seconds 7 Benefit No. 3: Unifies Imperative and Reactive @Inject @Inject @Channel(”kafka”) SayService say; Publisher<String> reactiveSay; @GET @GET @Produces(MediaType.TEXT_PLAIN) @Produces(MediaType.SERVER_SENT_EVENTS) public String hello() { public Publisher<String> stream() { return say.hello(); return reactiveSay; } } ● ● ● 8 Benefit No. 4: Best of Breed Frameworks & Standards 9 Quarkus Benefits Developer Joy Supersonic Subatomic Java Unifies Best of breed imperative and reactive libraries and standards 10 11 F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F MONOLITH F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F ● ● ● 12 Enterprise Java was Designed for 3-Tier Architecture 13 How Application Services Deployed Java Apps 14 Microservices Changed How We Deploy Apps 15 The hidden truth about Java + containers ● ○ ● ○ RSS 16 The hidden truth about Java + containers 17 The hidden truth about Java + containers Node Node Node Node NodeJS Quarkus Quarkus Go Go Go Traditional Cloud-Native Java Stack NodeJS Quarkus Quarkus Go Go Go Traditional Cloud-Native NodeJS Quarkus Quarkus Go Go Go Java Stack NodeJS Quarkus Quarkus Go Go Go Traditional Cloud-Native NodeJS Quarkus Quarkus Go Go Go Java Stack NodeJS Quarkus Quarkus Go Go Go Traditional Cloud-Native Java Stack NodeJS Quarkus Quarkus Go Go Go CONTAINER ORCHESTRATION 18 Java on cloud native: a Red Hat journey Standards Ahead of time compilation ● Java EE streamlining ● Lead gcj ● Eclipse MicroProfile ● Looked at Dalvik, Avian, Excelsior JET Runtimes OpenJDK ● WildFly on OpenShift ● Container ergonomics ● JVM metadata reduction Hardware architectures ● Raspberry Pi and Plug Computer ● Android 19 How does a framework start? @ </> @ Build time (maven, gradle…) How does a framework start? @ </> @ Load config file from file system Parse it How does a framework start? @ </> @ Classpath scanning to find annotated classes Attempt to load class to enable/disable features How does a framework start? @ </> @ Build its model of the world. How does a framework start? @ </> @ Start the management (thread, pool…) The Quarkus way @ </> @ @ </> @ The Quarkus way - Closed-World Assumption @ </> @ Limited variability The Quarkus way - Benefits @ </> @ Prepared No FS access at No scanning at Optimized initialization runtime runtime configuration (ready to serve) No need for a Less reflection Less reflection parser at runtime and classloading (proxy at runtime generation) JDK JIT - HotSpot AOTC - GraalVM Native Image 29 Conclusion Full stack Massive productivity wins 30 Sulong (LLVM) Truffle Graal Compiler JVM CI Substrate VM Java HotSpot VM 32 AOTC - GraalVM native image - Dead code elimination 33 The Dark Side Not supported OK with caveats in usage ● ● ● ● ● ● ● ● ● ● ● 34 The Dark Side Not supported OK with caveats in usage ● ● ● ● ● ● ● ● ● ● ● 35 When to use which VM with Quarkus JIT - OpenJDK HotSpot AOT - GraalVM native image High memory density requirements Highest memory density requirements High request/s/MB Highest request/s/MB Fast startup time for low heap size usages Faster startup time Best raw performance (CPU) 10s of ms for Serverless Best garbage collectors Higher heap size usage Known monitoring tools Compile Once, Run anywhere Libraries that only works in standard JDK 36 GraalVM specific benefits 100% of the ecosystem supported on GraalVM Drives the gathering of metadata needed by GraalVM ● ● ● Minimize dependencies Help dead code elimination 37 Can I add my dependencies? YES Add your own dependency Write your own extension ● Works on the JVM (OpenJDK) ● Like add your dependency plus… ● May work on AOT (GraalVM) ● Build time startup and memory improvements ● Better dead code elimination ● Developer Joy 38 39 40.