Go Fiber vs SpringBoot Webflux: Performance comparison for JWT verify and MySQL query

Mayank Choubey
Tech Tonic
4 min readSep 15, 2023

--

In response to the enthusiastic demand from our readers, we are delighted to present yet another highly anticipated article. Previously, we conducted an extensive series of technology comparisons, where we pitted Go’s Gin framework against a variety of other technologies, including Node.js, Rust, SpringBoot, Webflux, and more. However, our audience has expressed a strong interest in witnessing a similar comparison, this time featuring the Fiber framework.

Fiber, built on the foundation of fasthttp, shows promising potential for superior performance compared to Gin. In this article, we heed the call and provide a comprehensive benchmark analysis of Fiber versus SpringBoot Webflux, focusing on a real-world use case scenario. It’s worth noting that in prior tests, Gin outperformed SpringBoot Webflux for this particular use case. With Fiber, we anticipate even more impressive results.

Test setup

All tests are executed on MacBook Pro M1 with 16G of RAM.

The software versions are:

  • Go 1.21.0
  • SpringBoot Webflux 3.1.3 with Java v20.0.2

The other frameworks on the Go side are: golang-jwt for verifying and decoding JWTs, and go-sql-driver for performing MySQL queries.

The other frameworks on SpringBoot side are: jjwt for JWT verification and decoding, enhancing the security of our application, and mysql-connector-java for performing MySQL queries, maintaining data integrity and consistency.

The HTTP load tester is a modified version of Bombardier. There is a pre-created list of 100K JWTs. The tester picks random JWTs and sends it in the Authorization header of the HTTP request.

The MySQL database contains a table called users, which has 6 columns:

mysql> desc users;
+--------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+--------------+------+-----+---------+-------+
| email | varchar(255) | NO | PRI | NULL | |
| first | varchar(255) | YES | | NULL | |
| last | varchar(255) | YES | | NULL | |
| city | varchar(255) | YES | | NULL | |
| county | varchar(255) | YES | | NULL | |
| age | int | YES | | NULL | |
+--------+--------------+------+-----+---------+-------+
6 rows in set (0.00 sec)

The users table is prepopulated with 100K records:

mysql> select count(*) from users;
+----------+
| count(*) |
+----------+
| 99999 |
+----------+
1 row in set (0.01 sec)

For each email present in the JWT, there is a corresponding user record in the MySQL database.

Code

Go

SpringBoot Webflux

Results

Each test is executed for 1M requests in total. The concurrency levels are 10, 50, and 100 connections. A warm-up of 1K requests is given before taking measurements.

Here are the charts with the results:

A scorecard is generated from the results using the following formula. For each measurement, get the winning margin. If the winning margin is:

  • < 5%, no points are given
  • between 5% and 20%, 1 point is given to the winner
  • between 20% and 50%, 2 points are given to the winner
  • > 50%, 3 points are given to the winner

Thanks for reading!

A list of all real-world performance comparisons is here.

--

--