I would like to talk about SQL clients for Java application. In this article, we will compare the performance of good old JDBC(Spring Data JDBC) with new and promising R2DBC(Spring Data R2DBC). There is no such performance comparison in open access.
The source code is available in my GitHub
We will measure performance for fully reactive service(WebFlux, Netty, Spring Data R2DBC) and plain blocking service(Spring MVC, Tomcat, Spring Data JDBC)
Machine: Windows 10 Pro, i7–4710HQ, 12 GB RAM
Java: Oracle Java 11
Database: Postgres 11( running locally in Docker on the same machine, reserved limit 1 CPU)
We will work with User POJO.
Will measure Save, Get, Delete and Get List endpoints. Will use JMeter for the performance test.
- We will add for an empty user table 100.000 users (200 parallel JMeter users, 500 times)
- Select the user by id (200 parallel JMeter users, 500 times))
- Select the first 100 users(200 parallel JMeter users, 500 times))
- Delete 100.000 users(200 parallel JMeter users, 500 times)
Blocking Spring MVC and Spring Data JDBC + HikariCP
JVisualVM view for Select the first 100 users. 224 Threads with blocking.