R2DBC perfomance evaluation

59 Views Asked by At

R2DBC provides non blocking database connections. I would like to know what is the exact benefit of that?

To test the difference I made a simple Spring Boot application with R2dbcRepository and a query

@Query("select 42 as id from pg_sleep(1)")
Flux<Item> test();

If I make 50 concurrent queries then it takes 5 seconds. I would think that default pool size is 10.

So, in this particular case there seems not to by any difference between blocking db access and non-blocking.

Which test would demonstrate the benefit of using R2DBC driver over blocking driver? Or is it only that application can use CPU for other things while waiting for the database and it does not increase the throughput of the database?

0

There are 0 best solutions below