Spring Boot vs Quarkus: Database reads performance

Mayank Choubey
Tech Tonic

--

In this article, we’re going to check the performance of Spring Boot and Quarkus for a simple use case:

  • Get HTTP request
  • Extract userEmail parameter out of the request body (JSON)
  • Perform a database read for extracted email
  • Return user record in the HTTP response

On Spring Boot side, we’ll use virtual threads.

Test setup

All tests have been executed on MacBook Pro M2 with 16G RAM & 8+4 CPU cores. The software versions are:

  • Spring Boot 3.2.5 (Java 21.0.3)
  • Quarkus 3.10.3 (Java 21.0.3)

The load tester is a modified version of Bombardier, that sends a random email in each HTTP request.

The Postgres database is preloaded with 100K user records:

# \d users
Table "public.users"
Column | Type | Collation | Nullable | Default
--------+------------------------+-----------+----------+---------
email | character varying(255) | | not null |
first | character varying(255) | | not null |
last | character varying(255) | | not null |
city | character varying(255) | | not null |
county | character varying(255) | | not null |
age | integer | | not null |
Indexes:
"users_pkey" PRIMARY KEY, btree (email)

# select count(*) from users;
count
-------
99999

# select * from users limit 1;
email | first | last | city | county | age
-----------------+----------------------+----------------------+----------------------+----------------------+-----
ongbj@clb1a.com | 2f63ac8f31590d716243 | aed71a8d1868ac6eb032 | 836ddca891d3c46e24fe | bd53f8e8da17cededead | 25

The application code is as follows:

Spring Boot

Quarkus

Note: Panache ORM didn’t work out for this case. So, we had to work with database in this way.

Results

Each test is carried out for 50, 100, and 200 concurrent connections, running for a total of 1M requests.

The results in chart form as follows:

Verdict

For this particular test, Quarkus delivers higher performance at lower cost (CPU and memory). Quarkus (~27K RPS) is approximately 45% faster than Spring Boot (~17K RPS).

Winner: Quarkus

Thanks for reading!

--

--