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

[JavaZone 2023] - Quarkus for Spring Developers

Eric Deandrea
September 07, 2023

[JavaZone 2023] - Quarkus for Spring Developers

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. Additionally, I will show similarities and differences in how testing is done, highlighting Quarkus Dev Services.

This session will be mostly code while minimizing the number of slides. I will introduce an existing Spring application with a full test suite and build a Quarkus equivalent version of it, live.

Eric Deandrea

September 07, 2023
Tweet

More Decks by Eric Deandrea

Other Decks in Technology

Transcript

  1. @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
  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 Free copy (while they last)! Come see me at the Red Hat booth! 2:00 PM today!
  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 JVM Quarkus Spring Boot Ratio (Quarkus / SB) Framework

    version 3.2.4.Final 3.1.2 Build time (s) 7.85 4.12 190.69% Av. RSS after startup (MB) 174.29 264.37 65.93% Av. time to 1st req (ms) 2,498.33 5,354 46.66% Av. RSS after 1st req (MB) 233.38 313.83 74.36% Av. throughput (req/sec) 28,212.77 7,159.16 394.08% Av. RSS for max throughput (MB) 412.74 472.65 87.33% Max throughput density (req/sec/ MB) 69.87 15.39 454.13% Native Quarkus Spring Boot Ratio (Quarkus / SB) Framework version 3.2.4.Final 3.1.2 Build time (s) 128 210.25 60.88% Av. RSS after startup (MB) 65.7 148.66 44.19% Av. time to 1st req (ms) 51.33 222.33 23.09% Av. RSS after 1st req (MB) 72.89 151.43 48.14% Av. throughput (req/sec) 17,661.69 6,196.88 285.01% Av. RSS for max throughput (MB) 344.49 480.85 71.64% Max throughput density (req/sec/ MB) 54.84 13.8 397.54% Don’t Take My Word For It! Some real numbers (8 cores, 12GB RAM, GraalVM 22.3.1.r17)
  12. @edeandrea JVM Quarkus Spring Boot Ratio (Quarkus / SB) Framework

    version 3.2.4.Final 3.1.2 Build time (s) 7.85 4.12 190.69% Av. RSS after startup (MB) 174.29 264.37 65.93% Av. time to 1st req (ms) 2,498.33 5,354 46.66% Av. RSS after 1st req (MB) 233.38 313.83 74.36% Av. throughput (req/sec) 28,212.77 7,159.16 394.08% Av. RSS for max throughput (MB) 412.74 472.65 87.33% Max throughput density (req/sec/ MB) 69.87 15.39 454.13% Native Quarkus Spring Boot Ratio (Quarkus / SB) Framework version 3.2.4.Final 3.1.2 Build time (s) 128 210.25 60.88% Av. RSS after startup (MB) 65.7 148.66 44.19% Av. time to 1st req (ms) 51.33 222.33 23.09% Av. RSS after 1st req (MB) 72.89 151.43 48.14% Av. throughput (req/sec) 17,661.69 6,196.88 285.01% Av. RSS for max throughput (MB) 344.49 480.85 71.64% Max throughput density (req/sec/ MB) 54.84 13.8 397.54% Don’t Take My Word For It! Some real numbers (8 cores, 12GB RAM, GraalVM 22.3.1.r17)
  13. @edeandrea JVM Quarkus Spring Boot Ratio (Quarkus / SB) Framework

    version 3.2.4.Final 3.1.2 Build time (s) 7.85 4.12 190.69% Av. RSS after startup (MB) 174.29 264.37 65.93% Av. time to 1st req (ms) 2,498.33 5,354 46.66% Av. RSS after 1st req (MB) 233.38 313.83 74.36% Av. throughput (req/sec) 28,212.77 7,159.16 394.08% Av. RSS for max throughput (MB) 412.74 472.65 87.33% Max throughput density (req/sec/ MB) 69.87 15.39 454.13% Native Quarkus Spring Boot Ratio (Quarkus / SB) Framework version 3.2.4.Final 3.1.2 Build time (s) 128 210.25 60.88% Av. RSS after startup (MB) 65.7 148.66 44.19% Av. time to 1st req (ms) 51.33 222.33 23.09% Av. RSS after 1st req (MB) 72.89 151.43 48.14% Av. throughput (req/sec) 17,661.69 6,196.88 285.01% Av. RSS for max throughput (MB) 344.49 480.85 71.64% Max throughput density (req/sec/ MB) 54.84 13.8 397.54% Don’t Take My Word For It! Some real numbers (8 cores, 12GB RAM, GraalVM 22.3.1.r17)
  14. @edeandrea JVM Quarkus Spring Boot Ratio (Quarkus / SB) Framework

    version 3.2.4.Final 3.1.2 Build time (s) 7.85 4.12 190.69% Av. RSS after startup (MB) 174.29 264.37 65.93% Av. time to 1st req (ms) 2,498.33 5,354 46.66% Av. RSS after 1st req (MB) 233.38 313.83 74.36% Av. throughput (req/sec) 28,212.77 7,159.16 394.08% Av. RSS for max throughput (MB) 412.74 472.65 87.33% Max throughput density (req/sec/ MB) 69.87 15.39 454.13% Native Quarkus Spring Boot Ratio (Quarkus / SB) Framework version 3.2.4.Final 3.1.2 Build time (s) 128 210.25 60.88% Av. RSS after startup (MB) 65.7 148.66 44.19% Av. time to 1st req (ms) 51.33 222.33 23.09% Av. RSS after 1st req (MB) 72.89 151.43 48.14% Av. throughput (req/sec) 17,661.69 6,196.88 285.01% Av. RSS for max throughput (MB) 344.49 480.85 71.64% Max throughput density (req/sec/ MB) 54.84 13.8 397.54% Don’t Take My Word For It! Some real numbers (8 cores, 12GB RAM, GraalVM 22.3.1.r17)
  15. @edeandrea 🤘 Compiling a Spring Boot 3 application: ◦ 36,583

    classes ◦ 80,008 fields ◦ 256,009 methods ◦ 1,783 classes, 2,186 fields, & 11,236 methods using reflection A Real Example
  16. @edeandrea 🤘 Compiling a Spring Boot 3 application: ◦ 36,583

    classes ◦ 80,008 fields ◦ 256,009 methods ◦ 1,783 classes, 2,186 fields, & 11,236 methods using reflection 🤘 Compiling a Quarkus 3 application: ◦ 22,420 classes ◦ 45,178 fields ◦ 180,478 methods ◦ 733 classes, 160 fields, & 3,968 methods using reflection A Real Example
  17. @edeandrea 🤘 Compiling a Spring Boot 3 application: ◦ 36,583

    classes ◦ 80,008 fields ◦ 256,009 methods ◦ 1,783 classes, 2,186 fields, & 11,236 methods using reflection 🤘 Compiling a Quarkus 3 application: ◦ 22,420 classes ◦ 45,178 fields ◦ 180,478 methods ◦ 733 classes, 160 fields, & 3,968 methods using reflection 🤘 The Quarkus application has: ◦ 14,163 (39%) less classes ◦ 34,830 (44%) less fields ◦ 75,531 (30%) less methods ◦ 1,050 (59%) less classes using reflection ◦ 2,026 (92%) less fields using reflection ◦ 7,268 (65%) less methods using reflection A Real Example
  18. @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
  19. @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 Free copy (while they last)! Come see me at the Red Hat booth! 2:00 PM today!