Micronaut + GraalVM
A match made in Cloud Native
Micronaut
• Desarrollado por Object Computing (OCI)
• Graeme Rocher (@GraemeRocher)
• Diseñado para desarrollar Microservicios
Features
• Compile time dependency injection.
• First class support for reactive programming
• Cloud Native
• Service Discovery (Consul, Kubernetes, Eureka)
• Distributed tracing (Zipkin, Jaeger)
• Serverless functions
Dependency Injection
• Micronaut builds its dependency injection data at compile
time.
• Fully supports JSR-330 annotations as well.
Persistence
• JDBC support
• JPA with Hibernate support
• MongoDB
• Neo4j
• Redis
• Cassandra
My thoughts
• Very good alternative to Spring Boot
• Simple, clean, small, lightweight.
• Programming model very familiar (Spring, CDI)
• Cloud Native ready!
• Ideal for microservices
• But… the JVM…
GraalVM
• OpenSource project at Oracle Labs
• Based in OpenJDK 8u
• Polyglot
• Native
• Embeddable
• GraalVM offers a comprehensive ecosystem supporting a
large set of languages (Java and other JVM-based
languages, JavaScript, Ruby, Python, R, and C/C++ and
other LLVM-based languages) and running them in different
deployment scenarios (OpenJDK, Node.js, MySQL, Oracle
Database, or standalone).
Java applications?
• GraalVM runs Java applications faster, on the OpenJDK.
• Ahead-of-time compilation for native images.
• Insane startup times, reduce memory footprint…
• Run scripting languages faster.
Performance as first class citizen
• GraalVM compiler can remove costly object allocations in
many scenarios
• http://www.graalvm.org/docs/examples/java-performance-examples/
• Better inlining and more aggressive speculative
optimizations can lead to additional benefits for complex
long-running applications
• https://www.graalvm.org/docs/examples/java-simple-stream-benchmark/
Native Image
• Running applications in the JVM implies the status and
footprint costs.
• GraalVM allow us to generate a native image without those
costs.
• The image generation process employs static analysis to
find any code reachable from the main Java method and
then performs full ahead-of-time (AOT) compilation
• The resulting native binary contains the whole program in
machine code form for its immediate execution.
GraalVM in the real world
• Twitter is running GraalVM for almost 2 years now.
• Twitter is also contributing.
• https://www.youtube.com/watch?v=pR5NDkIZBOA
Better together…
• Micronaut supports GraalVM Native Image generation.
Demo time…

Peru JUG Micronaut & GraalVM

  • 1.
    Micronaut + GraalVM Amatch made in Cloud Native
  • 3.
    Micronaut • Desarrollado porObject Computing (OCI) • Graeme Rocher (@GraemeRocher) • Diseñado para desarrollar Microservicios
  • 4.
    Features • Compile timedependency injection. • First class support for reactive programming • Cloud Native • Service Discovery (Consul, Kubernetes, Eureka) • Distributed tracing (Zipkin, Jaeger) • Serverless functions
  • 5.
    Dependency Injection • Micronautbuilds its dependency injection data at compile time. • Fully supports JSR-330 annotations as well.
  • 6.
    Persistence • JDBC support •JPA with Hibernate support • MongoDB • Neo4j • Redis • Cassandra
  • 7.
    My thoughts • Verygood alternative to Spring Boot • Simple, clean, small, lightweight. • Programming model very familiar (Spring, CDI) • Cloud Native ready! • Ideal for microservices • But… the JVM…
  • 9.
    GraalVM • OpenSource projectat Oracle Labs • Based in OpenJDK 8u • Polyglot • Native • Embeddable
  • 10.
    • GraalVM offersa comprehensive ecosystem supporting a large set of languages (Java and other JVM-based languages, JavaScript, Ruby, Python, R, and C/C++ and other LLVM-based languages) and running them in different deployment scenarios (OpenJDK, Node.js, MySQL, Oracle Database, or standalone).
  • 11.
    Java applications? • GraalVMruns Java applications faster, on the OpenJDK. • Ahead-of-time compilation for native images. • Insane startup times, reduce memory footprint… • Run scripting languages faster.
  • 12.
    Performance as firstclass citizen • GraalVM compiler can remove costly object allocations in many scenarios • http://www.graalvm.org/docs/examples/java-performance-examples/ • Better inlining and more aggressive speculative optimizations can lead to additional benefits for complex long-running applications • https://www.graalvm.org/docs/examples/java-simple-stream-benchmark/
  • 13.
    Native Image • Runningapplications in the JVM implies the status and footprint costs. • GraalVM allow us to generate a native image without those costs. • The image generation process employs static analysis to find any code reachable from the main Java method and then performs full ahead-of-time (AOT) compilation • The resulting native binary contains the whole program in machine code form for its immediate execution.
  • 14.
    GraalVM in thereal world • Twitter is running GraalVM for almost 2 years now. • Twitter is also contributing. • https://www.youtube.com/watch?v=pR5NDkIZBOA
  • 15.
    Better together… • Micronautsupports GraalVM Native Image generation.
  • 16.