Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Micronaut & Quarkus: The secret behind of them

Micronaut & Quarkus: The secret behind of them

Over the years, the microservice architecture has been adopted in conjunction with Spring Boot. But recently, we are introducing a rise in microframework like Micronaut and Quarkus, which innovate or build microservices by providing low memory footprint, fast startup, non-locking and other important features. Both frameworks prove booting in milliseconds and memory consumption in megabytes, but how do they do this magic? Here, this talk demystifies this magic, bringing concepts such as AOT (Ahead Of Time Compilation), Just In Time Compilation (JIT), GraalVM and Native applications.

Ef3b48913ea26665c25b2ad78e449d16?s=128

Luram Archanjo

November 28, 2019
Tweet

Transcript

  1. The secret behind of them Luram Archanjo

  2. Who am I? • Software Engineer at Sensedia • MBA

    in Java projects • Java and Microservice enthusiastic
  3. Agenda • Microservices • Java & Frameworks • Ahead of

    Time (AOT) Compilation • GraalVM • Questions
  4. Moving to Microservices Feature A Feature B Feature C Monolith

    Microservice Microservice Microservices Microservice
  5. Scalability Feature A Monolith Scalability Microservice Microservice Microservices Scalability Microservice

    Microservice Microservice Microservice Microservice Microservice Microservice Microservice Feature B Feature C Feature A Feature B Feature C Feature A Feature B Feature C Waste Waste Waste Waste Waste
  6. Our resources are finite!

  7. How to use less resources using Java language?

  8. Our frameworks are design to low memory footprint?

  9. No, because we’ve tried to adapt existing legacy technologies for

    Microservices
  10. What do Spring and Jakarta EE undertaking? What are the

    results about it? Spring is an amazing technical achievement and does so many things, but does them at Runtime. • Reads the byte code of every bean it finds. • Synthesizes new annotations for each annotation on each bean method, constructor, field etc. to support Annotation metadata. • Builds Reflective Metadata for each bean for every method, constructor, field etc.
  11. The rise of Java Microframeworks

  12. Microframeworks A microframework is a term used to refer to

    minimalistic web application frameworks: • Without authentication and authorization • Without database abstraction via an object-relational mapping. • Without input validation and input sanitation.
  13. Less modules, functions and dependencies are not enough!

  14. Ahead of Time (AOT) Compilation Ahead-of-time compilation (AOT compilation) is

    the act of compiling a higher-level programming language, or an intermediate representation such as Java bytecode, into a native machine code so that the resulting binary file can execute natively. Web Android Java Google Dagger 2 ?
  15. use Ahead of Time (AOT) Compilation

  16. What are the results of using Ahead of Time (AOT)

    Compilation?
  17. The results of using Ahead of Time (AOT) Compilation •

    Startup time around a second. • All Dependency Injection, AOP and Proxy generation happens at compile time. • Can be run with as little as 15mb Max Heap.
  18. I don't believe, show me!

  19. Is it possible to improve more?

  20. Yes, with

  21. GraalVM is an universal virtual machine: • Runs Java, Scala,

    Kotlin etc. • Native image Native image works well when: • Little or no runtime reflection is used. ◦ Use third party libraries selectively. • Limited or no dynamic classloading.
  22. What are the results of using Native Image?

  23. The results of using Native Image Source: https://www.graalvm.org/docs/why-graal/

  24. The results of using Native Image Source: https://www.graalvm.org/docs/why-graal/

  25. GraalVM Native Image, currently available as an Early Adopter Technology

    Source: https://www.graalvm.org/docs/why-graal/
  26. What else Micronaut & Quarkus do?

  27. There were born in Microservices and Cloud era

  28. There were born in Microservices and Cloud era • Observability

    ◦ Open Tracing ▪ Zipkin ▪ Jaeger ◦ Health Checks ◦ Metrics • Fault Tolerance ◦ Timeout ◦ Retry ◦ Circuit Breaker ◦ Fallback • Dependency Injection and Inversion of Control (IoC) • Blocking or Non-Blocking HTTP Server
  29. They are providing Java Serverless Application Adoption

  30. Summary 2º Place 1º Place 3º Place Ahead of Time

    (AOT) Compilation • Low memory footprint • Fast Startup • IoC Native Image • Low memory footprint 5x lower • Fast Startup 50x lower Cloud Native Features • Observability • Fault Tolerance • Distributed Configuration
  31. Which one is the best? You decide! The important thing

    is that they are changing the Java World
  32. Thanks a million! Questions? /larchanjo /luram-archanjo