DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • A Practical Guide to Creating a Spring Modulith Project
  • Distributed Tracing System (Spring Cloud Sleuth + OpenZipkin)
  • Java, Spring Boot, and MongoDB: Performance Analysis and Improvements
  • Spring Boot Secured By Let's Encrypt

Trending

  • Jakarta EE 12: Entering the Data Age of Enterprise Java
  • Alternative Structured Concurrency
  • RAG Is Not Enough: Advanced Retrieval Architectures Using Vertex AI Search on GCP
  • Mocking Kafka for Local Spring Development
  1. DZone
  2. Coding
  3. Frameworks
  4. Quarkus vs Spring Boot – Performance

Quarkus vs Spring Boot – Performance

In this article, we are going to compare the Quarkus and Spring Boot applications and how they behave in terms of memory management.

By 
Shabbir Dawoodi user avatar
Shabbir Dawoodi
·
Jun. 23, 20 · Tutorial
Likes (9)
Comment
Save
Tweet
Share
37.9K Views

Join the DZone community and get the full member experience.

Join For Free

In this article, we are going to compare the Quarkus and Spring Boot applications and how they behave in terms of memory management.

To be fair in comparison to both the applications, we will go with a standard set of dependencies. Both the application will include Spring Web dependencies only. They will be build using maven tool and jar files will be created. Both the application will have similar REST Endpoints.

quarkus vs spring boot

This comparison is going to be super crazy. We will create both applications from scratch.

Creating Quarkus Application

To create a quarkus application, go to https://code.quarkus.io/ and fill the below details.

quarkus homepage screenshot

Open this project in your preferred IDE.

Create a new class HomeController.java and add the below code in that class file.

Java
 




x
10


 
1
@RestController
2
@RequestMapping("/hello")
3
public class HomeController {
4
 
5
    @GetMapping
6
    public String hello() {
7
        return "hello";
8
    }
9
 
10
}


Now, to run this application, go to the terminal and run the below command. 

mvn clean package

Once the jar file is created, execute the below command to run the standalone jar file with the below command. 

java -jar code-with-quarkus-1.0.0.SNAPSHOT-runner.jar 

Creating a Spring Boot Application

To create a Spring Boot application, go to https://start.spring.io/ and fill the below details.

spring boot application homepage application

Open this project in your preferred IDE.

Create a new class HomeController.java and add the below code in that class file.

Java
 




xxxxxxxxxx
1
10


 
1
@RestController
2
@RequestMapping("/hello")
3
public class HomeController {
4
 
5
    @GetMapping
6
    public String hello() {
7
        return "hello";
8
    }
9
 
10
}


Now, to run this application, go to the terminal and run the below command.

mvn clean package 

Once the jar file is created, execute the below command to run the standalone jar file with the below command.

java -jar demo-0.0.1-SNAPSHOT.jar 

Comparison

Now, both the applications are running and we can compare the memory utilization by both the application using jconsole. Make sure that both the applications are running on different ports, so there are no port conflicts while starting the application

To open Jconsole, go to terminal and type jconsole command as shown in the below screenshot.

jconsole command

On executing the above command, it will open a prompt to select the process to check the resources. Below are the screenshots for selecting both Quarkus and Spring Boot applications resources.


spring boot resource

Select the appropriate processes for both the application and the new window will open to monitor those applications. 


quarkus using 27mb of memory
spring boot using 47mb of memory

The Straight forward comparison for both the application depicts that Quarkus uses way less memory while starting the application. Spring Boot is using around ~47 Mb of memory compared to Quarkus’s ~27 Mb of memory utilization.

Quarkus uses Ahead of Time compilation strategy while building the application, which gives the benefit to loading only the necessary classes which helps to start the application.

quarkus loads around 5,100 classes spring boot loads 7,100

In the above screenshot, we can see that Quarkus loads around ~5100 classes compared to ~7100 of the Spring Boot application. The comparison is too much considering that both the application has the same dependency and REST Endpoint.

Spring Boot is catching up with the support of GraalVM with the latest release. We need to wait and see in the future, how much benefit all the frameworks will get with increasing demands and use of GraalVM.

We will compare more in detail about all the other aspects of the application.

If you want to understand performance by video, click below.


Spring Framework Spring Boot application Quarkus

Opinions expressed by DZone contributors are their own.

Related

  • A Practical Guide to Creating a Spring Modulith Project
  • Distributed Tracing System (Spring Cloud Sleuth + OpenZipkin)
  • Java, Spring Boot, and MongoDB: Performance Analysis and Improvements
  • Spring Boot Secured By Let's Encrypt

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook