r2dbc write performance is really poor comparing with JDBC performance (number of parrallel request + database CPU utlisation) #624
Replies: 1 comment 3 replies
-
Generally speaking, your observations are in line with expectations. R2DBC uses non-blocking API hence the infrastructure maximizes CPU utilization for available work. Also, please note that reactive programming adds a lot of overhead. Any processes that yield zero or one result are at least 25% slower than their imperative counterpart. Reactive programming brings performance to applications that consume large result sets though. We've seen similar results with Imperative MongoDB vs Reactive MongoDB.
The question is really how much of that arrives on the database as the databases cannot scale indefinitely, instead, an ideal configuration permits a max number of concurrency in the area of number of CPU cores + discounted number of drives in a RAID array. I have my doubts about whether your test system runs on 120 CPU cores. |
Beta Was this translation helpful? Give feedback.
-
I was doing the analysis between r2dbc and jdbc with a springboot application.
Springboot3.2 + jooq(3.18)+ r2bc + r2dbc pool+ postgres (16.1)
implementation("io.r2dbc:r2dbc-spi:1.0.0.RELEASE")
implementation("io.r2dbc:r2dbc-pool:1.0.1.RELEASE")
implementation("org.postgresql:r2dbc-postgresql:1.0.2.RELEASE")
I have created an end to end nonblocking spring boot application
Which uses the suspend function from controller to repository
r2dbc Configuration
Repository
analysis
I have done load testing using k6 to see how many parallel requests it can process.
R2dbc analysis
whereas JDBC with Hikari pool was able to handle 120 plus parallel requests smoothly with the same configuration.
repository: https://github.com/arjunbalussery/kotlin-async
Run setup.sh bash file to make the application running
you can use k6 run k6/loadtest.js command to run load testing
Run stop.sh bash file to stop the application
Please let me know if any further information is needed.
Beta Was this translation helpful? Give feedback.
All reactions