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

1/23/25 - Montreal JUG - Quarkus Compare and Co...

1/23/25 - Montreal JUG - Quarkus Compare and Contrast

Are you a Spring developer and interested in learning something new ?

In this session I will show concepts and conventions familiar to Spring developers and how those same concepts and conventions can be implemented in Quarkus, all while highlighting similarities and differences between them, including how testing is done.

Additionally, I will highlight performance characteristics between them and prove, live, that you could save 50% in your operational costs and reduce your carbon emissions 2-3x simply by switching your Java runtime.

Eric Deandrea

January 23, 2025
Tweet

More Decks by Eric Deandrea

Other Decks in Technology

Transcript

  1. @edeandrea Who’s on Stage Today? Eric Deandrea 🤘 25+ years

    software development experience Java Champion 🤘 Contributor to Open Source projects Quarkus Spring Boot, Spring Framework, Spring Security LangChain4j (& Quarkus LangChain4j) Wiremock Microcks 🤘 Boston Java Users ACM Chapter Board Member 🤘 Published author
  2. @edeandrea • How Quarkus enables modern Java development & the

    Kubernetes-native experience • Introduce familiar Spring concepts, constructs, & conventions and how they map to Quarkus • Emphasis on testing patterns & practices https://red.ht/quarkus-spring-devs
  3. @edeandrea Monolith J2SE / J2EE Java / Jakarta EE Cloud-Native

    Microservices Spring Boot MicroProfile Java,The Enterprise Workhorse
  4. @edeandrea Monolith J2SE / J2EE Java / Jakarta EE Cloud-Native

    Microservices Spring Boot MicroProfile Java,The Enterprise Workhorse
  5. @edeandrea Monolith J2SE / J2EE Java / Jakarta EE Cloud-Native

    Microservices Spring Boot MicroProfile Java,The Enterprise Workhorse
  6. @edeandrea Java / Jakarta EE J2SE / J2EE Monolith Cloud-Native

    Microservices Spring Boot MicroProfile Java,The Enterprise Workhorse
  7. @edeandrea Java / Jakarta EE J2SE / J2EE Monolith Cloud-Native

    Microservices Serverless Event-Driven Microservices Cloud-Native Spring Boot MicroProfile Java,The Enterprise Workhorse
  8. @edeandrea The Warmup Issue with Java Simon Ritter - Azul

    Systems - https://youtu.be/bWmuqh6wHgE (first 13 minutes)
  9. @edeandrea Build Time Runtime Packaging (maven, etc) gradle…) Load config

    file from file system Parse it Classpath scanning to find annotated classes Attempt to load class to enable/disable features Build its model of the world. Start the management (thread, pool…) @ @ </> How Does a Framework Start?
  10. @edeandrea JVM Build Time @ @ </> Package model Native

    The Quarkus Way enables Native Compilation
  11. @edeandrea What’s the Secret Sauce? 🤘Don’t be dynamic 🤘Dead code

    elimination / inlining Holly Cummins - https://youtu.be/vnrXXvnqriA
  12. @edeandrea What’s the Secret Sauce? 🤘Don’t be dynamic 🤘Dead code

    elimination / inlining Holly Cummins - https://youtu.be/vnrXXvnqriA
  13. @edeandrea What’s the Secret Sauce? 🤘Don’t be dynamic 🤘Dead code

    elimination / inlining Holly Cummins - https://youtu.be/vnrXXvnqriA
  14. @edeandrea What’s the Secret Sauce? 🤘Don’t be dynamic 🤘Dead code

    elimination / inlining Holly Cummins - https://youtu.be/vnrXXvnqriA
  15. @edeandrea What’s the Secret Sauce? 🤘Don’t be dynamic 🤘Dead code

    elimination / inlining Holly Cummins - https://youtu.be/vnrXXvnqriA
  16. @edeandrea What’s the Secret Sauce? 🤘Don’t be dynamic 🤘Dead code

    elimination / inlining 🤘Extensible build process so libraries can participate Holly Cummins - https://youtu.be/vnrXXvnqriA
  17. @edeandrea What’s the Secret Sauce? 🤘Don’t be dynamic 🤘Dead code

    elimination / inlining 🤘Extensible build process so libraries can participate 🤘Jandex Indexing (offline reflection) Holly Cummins - https://youtu.be/vnrXXvnqriA
  18. @edeandrea What’s the Secret Sauce? 🤘Don’t be dynamic 🤘Dead code

    elimination / inlining 🤘Extensible build process so libraries can participate 🤘Jandex Indexing (offline reflection) Holly Cummins - https://youtu.be/vnrXXvnqriA
  19. @edeandrea What’s the Secret Sauce? 🤘Don’t be dynamic 🤘Dead code

    elimination / inlining 🤘Extensible build process so libraries can participate 🤘Jandex Indexing (offline reflection) 🤘Don’t make humans tell the computer what it knows Holly Cummins - https://youtu.be/vnrXXvnqriA
  20. @edeandrea What’s the Secret Sauce? 🤘Don’t be dynamic 🤘Dead code

    elimination / inlining 🤘Extensible build process so libraries can participate 🤘Jandex Indexing (offline reflection) 🤘Don’t make humans tell the computer what it knows Holly Cummins - https://youtu.be/vnrXXvnqriA
  21. @edeandrea What’s the Secret Sauce? 🤘Don’t be dynamic 🤘Dead code

    elimination / inlining 🤘Extensible build process so libraries can participate 🤘Jandex Indexing (offline reflection) 🤘Don’t make humans tell the computer what it knows Holly Cummins - https://youtu.be/vnrXXvnqriA
  22. @edeandrea What’s the Secret Sauce? 🤘Don’t be dynamic 🤘Dead code

    elimination / inlining 🤘Extensible build process so libraries can participate 🤘Jandex Indexing (offline reflection) 🤘Don’t make humans tell the computer what it knows Holly Cummins - https://youtu.be/vnrXXvnqriA
  23. @edeandrea What’s the Secret Sauce? 🤘Don’t be dynamic 🤘Dead code

    elimination / inlining 🤘Extensible build process so libraries can participate 🤘Jandex Indexing (offline reflection) 🤘Don’t make humans tell the computer what it knows 🤘Continuous profiling & shaving Holly Cummins - https://youtu.be/vnrXXvnqriA
  24. @edeandrea What’s the Secret Sauce? 🤘Don’t be dynamic 🤘Dead code

    elimination / inlining 🤘Extensible build process so libraries can participate 🤘Jandex Indexing (offline reflection) 🤘Don’t make humans tell the computer what it knows 🤘Continuous profiling & shaving 🤘Be reactive without forcing humans to do reactive Holly Cummins - https://youtu.be/vnrXXvnqriA
  25. @edeandrea Migration Toolkit For Applications “Simplifies the Migration of Spring

    Apps to Quarkus” 🤘 Automate Application Analysis 🤘 Estimate Level of Effort 🤘 Accelerate Code Transformation & Migration 🤘 Includes Rules for DI, Metrics, Security, Web, Shell, & More https://developers.redhat.com/products/mta
  26. @edeandrea JVM Native Quarkus Spring Boot Ratio (Quarkus / SB)

    Spring Boot (w/AOT) Ratio (Quarkus / SB AOT) Ratio (SB AOT / SB) Quarkus Spring Boot Ratio (Quarkus / SB) Framework version 3.17.5 3.4.1 3.4.1 3.17.5 3.4.1 Build time (s) 12.88 7.82 164.75% 16.88 76.34% 215.81% 172.8 283.39 60.97% Av. RSS after startup (MB) 190.6 297.92 63.98% 293.88 64.86% 98.64% 71.09 206.47 34.43% Av. time to 1st req (ms) 4,684 8,885.33 52.72% 7,940 58.99% 89.36% 132.67 924.33 14.35% Av. RSS after 1st req (MB) 241.29 344.86 69.97% 335.76 71.86% 97.36% 78.95 208.87 37.8% Av. throughput (req/sec) 30,769.99 6,713.7 458.32% 6,750.04 455.85% 100.54% 16,189.26 6,024.12 268.74% Max throughput density (req/sec/MB) 41.77 8.58 487.08% 8.75 477.32% 102.04% 61.1 14.33 426.38% Build RSS (GB) 6.0 7.83 76.63% Binary Size (MB) 90.47 156.58 57.78% Don’t Take My Word For It! Some real numbers (8 cores, 14GB RAM, GraalVM CE 21.0.2)
  27. @edeandrea JVM Native Quarkus Spring Boot Ratio (Quarkus / SB)

    Spring Boot (w/AOT) Ratio (Quarkus / SB AOT) Ratio (SB AOT / SB) Quarkus Spring Boot Ratio (Quarkus / SB) Framework version 3.17.5 3.4.1 3.4.1 3.17.5 3.4.1 Build time (s) 12.88 7.82 164.75% 16.88 76.34% 215.81% 172.8 283.39 60.97% Av. RSS after startup (MB) 190.6 297.92 63.98% 293.88 64.86% 98.64% 71.09 206.47 34.43% Av. time to 1st req (ms) 4,684 8,885.33 52.72% 7,940 58.99% 89.36% 132.67 924.33 14.35% Av. RSS after 1st req (MB) 241.29 344.86 69.97% 335.76 71.86% 97.36% 78.95 208.87 37.8% Av. throughput (req/sec) 30,769.99 6,713.7 458.32% 6,750.04 455.85% 100.54% 16,189.26 6,024.12 268.74% Max throughput density (req/sec/MB) 41.77 8.58 487.08% 8.75 477.32% 102.04% 61.1 14.33 426.38% Build RSS (GB) 6.0 7.83 76.63% Binary Size (MB) 90.47 156.58 57.78% Don’t Take My Word For It! Some real numbers (8 cores, 14GB RAM, GraalVM CE 21.0.2)
  28. @edeandrea JVM Native Quarkus Spring Boot Ratio (Quarkus / SB)

    Spring Boot (w/AOT) Ratio (Quarkus / SB AOT) Ratio (SB AOT / SB) Quarkus Spring Boot Ratio (Quarkus / SB) Framework version 3.17.5 3.4.1 3.4.1 3.17.5 3.4.1 Build time (s) 12.88 7.82 164.75% 16.88 76.34% 215.81% 172.8 283.39 60.97% Av. RSS after startup (MB) 190.6 297.92 63.98% 293.88 64.86% 98.64% 71.09 206.47 34.43% Av. time to 1st req (ms) 4,684 8,885.33 52.72% 7,940 58.99% 89.36% 132.67 924.33 14.35% Av. RSS after 1st req (MB) 241.29 344.86 69.97% 335.76 71.86% 97.36% 78.95 208.87 37.8% Av. throughput (req/sec) 30,769.99 6,713.7 458.32% 6,750.04 455.85% 100.54% 16,189.26 6,024.12 268.74% Max throughput density (req/sec/MB) 41.77 8.58 487.08% 8.75 477.32% 102.04% 61.1 14.33 426.38% Build RSS (GB) 6.0 7.83 76.63% Binary Size (MB) 90.47 156.58 57.78% Don’t Take My Word For It! Some real numbers (8 cores, 14GB RAM, GraalVM CE 21.0.2)
  29. @edeandrea JVM Native Quarkus Spring Boot Ratio (Quarkus / SB)

    Spring Boot (w/AOT) Ratio (Quarkus / SB AOT) Ratio (SB AOT / SB) Quarkus Spring Boot Ratio (Quarkus / SB) Framework version 3.17.5 3.4.1 3.4.1 3.17.5 3.4.1 Build time (s) 12.88 7.82 164.75% 16.88 76.34% 215.81% 172.8 283.39 60.97% Av. RSS after startup (MB) 190.6 297.92 63.98% 293.88 64.86% 98.64% 71.09 206.47 34.43% Av. time to 1st req (ms) 4,684 8,885.33 52.72% 7,940 58.99% 89.36% 132.67 924.33 14.35% Av. RSS after 1st req (MB) 241.29 344.86 69.97% 335.76 71.86% 97.36% 78.95 208.87 37.8% Av. throughput (req/sec) 30,769.99 6,713.7 458.32% 6,750.04 455.85% 100.54% 16,189.26 6,024.12 268.74% Max throughput density (req/sec/MB) 41.77 8.58 487.08% 8.75 477.32% 102.04% 61.1 14.33 426.38% Build RSS (GB) 6.0 7.83 76.63% Binary Size (MB) 90.47 156.58 57.78% Don’t Take My Word For It! Some real numbers (8 cores, 14GB RAM, GraalVM CE 21.0.2)
  30. @edeandrea JVM Native Quarkus Spring Boot Ratio (Quarkus / SB)

    Spring Boot (w/AOT) Ratio (Quarkus / SB AOT) Ratio (SB AOT / SB) Quarkus Spring Boot Ratio (Quarkus / SB) Framework version 3.17.5 3.4.1 3.4.1 3.17.5 3.4.1 Build time (s) 12.88 7.82 164.75% 16.88 76.34% 215.81% 172.8 283.39 60.97% Av. RSS after startup (MB) 190.6 297.92 63.98% 293.88 64.86% 98.64% 71.09 206.47 34.43% Av. time to 1st req (ms) 4,684 8,885.33 52.72% 7,940 58.99% 89.36% 132.67 924.33 14.35% Av. RSS after 1st req (MB) 241.29 344.86 69.97% 335.76 71.86% 97.36% 78.95 208.87 37.8% Av. throughput (req/sec) 30,769.99 6,713.7 458.32% 6,750.04 455.85% 100.54% 16,189.26 6,024.12 268.74% Max throughput density (req/sec/MB) 41.77 8.58 487.08% 8.75 477.32% 102.04% 61.1 14.33 426.38% Build RSS (GB) 6.0 7.83 76.63% Binary Size (MB) 90.47 156.58 57.78% Don’t Take My Word For It! Some real numbers (8 cores, 14GB RAM, GraalVM CE 21.0.2)
  31. @edeandrea JVM Native Quarkus Spring Boot Ratio (Quarkus / SB)

    Spring Boot (w/AOT) Ratio (Quarkus / SB AOT) Ratio (SB AOT / SB) Quarkus Spring Boot Ratio (Quarkus / SB) Framework version 3.17.5 3.4.1 3.4.1 3.17.5 3.4.1 Build time (s) 12.88 7.82 164.75% 16.88 76.34% 215.81% 172.8 283.39 60.97% Av. RSS after startup (MB) 190.6 297.92 63.98% 293.88 64.86% 98.64% 71.09 206.47 34.43% Av. time to 1st req (ms) 4,684 8,885.33 52.72% 7,940 58.99% 89.36% 132.67 924.33 14.35% Av. RSS after 1st req (MB) 241.29 344.86 69.97% 335.76 71.86% 97.36% 78.95 208.87 37.8% Av. throughput (req/sec) 30,769.99 6,713.7 458.32% 6,750.04 455.85% 100.54% 16,189.26 6,024.12 268.74% Max throughput density (req/sec/MB) 41.77 8.58 487.08% 8.75 477.32% 102.04% 61.1 14.33 426.38% Build RSS (GB) 6.0 7.83 76.63% Binary Size (MB) 90.47 156.58 57.78% Don’t Take My Word For It! Some real numbers (8 cores, 14GB RAM, GraalVM CE 21.0.2)
  32. @edeandrea 🤘 Spring Boot 3 application contents: ◦ 39,533 classes

    ◦ 84,792 fields ◦ 285,156 methods ◦ Reflection: ◦ 11,143 classes ◦ 1,637 fields ◦ 13,032 methods A Real Example
  33. @edeandrea 🤘 Spring Boot 3 application contents: ◦ 39,533 classes

    ◦ 84,792 fields ◦ 285,156 methods ◦ Reflection: ◦ 11,143 classes ◦ 1,637 fields ◦ 13,032 methods 🤘 Quarkus 3 application contents: ◦ 23,814 classes ◦ 47,373 fields ◦ 190,150 methods ◦ Reflection: ◦ 6,691 classes ◦ 202 fields ◦ 4,971 methods A Real Example
  34. @edeandrea 🤘 Spring Boot 3 application contents: ◦ 39,533 classes

    ◦ 84,792 fields ◦ 285,156 methods ◦ Reflection: ◦ 11,143 classes ◦ 1,637 fields ◦ 13,032 methods 🤘 Quarkus 3 application contents: ◦ 23,814 classes ◦ 47,373 fields ◦ 190,150 methods ◦ Reflection: ◦ 6,691 classes ◦ 202 fields ◦ 4,971 methods 🤘 The Quarkus application has: ◦ 15,719 (40%) less classes ◦ 37,419 (44%) less fields ◦ 87,519 (33%) less methods ◦ 4,452 (40%) less classes using reflection ◦ 1,435 (88%) less fields using reflection ◦ 8,061 (62%) less methods using reflection A Real Example