Quarkus vs Go Frameworks: Database read Performance

Mayank Choubey
Tech Tonic

--

This is a requested article. Readers have asked for an up-to-date comparison of Quarkus (Java) and popular Go frameworks like Gin, Fiber, and Echo. Please note that this is not an apples-to-apples comparison, as Quarkus is a fairly comprehensive framework, whereas the mentioned Go frameworks are relatively simple (similar to Express).

In the previous article, we’ve seen how Quarkus fares in front of Go frameworks for the simplest “hello world” case:

In this article, we will focus on a more real-world case: Database reads. The simple use is:

  • 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

Test setup

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

  • Quarkus 3.10.3 (Java 21.0.3)
  • Go 1.22.3

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

On the Go, we’re using Bun ORM (not to be confused with Bun JS runtime).

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:

Quarkus

Gin, Fiber, and Echo (Go)

(db.go is a common file)

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:

Analysis

We already know that Quarkus is one of the fastest options available in the Java world. The results for this use case are in line with Quarkus’s reputation.

Quarkus gives decent competition to the Go framework, but not as tough as we expected. Quarkus offers ~27K RPS, while Go frameworks range between 33–37K. The CPU usage is comparable, while Go’s memory usage (~40M) is very low compared to any Java framework, and Quarkus is no exception (~400M).

Winner: Fiber

Thanks for reading!

--

--