-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spring Data R2DBC two times slower than Spring Data JDBC for Flux response #203
Comments
@mp911de Not sure if it's possible to improve the performance. |
Thanks for having a look. Please check out our performance efforts at pgjdbc/r2dbc-postgresql#158 that contain JMH benchmarks. Results clearly show that PGJDBC is significantly faster in extended query mode than R2DBC. We're happy to receive contributions in the form of optimizations or if someone is able to pin down a specific issue that we can address. On a related note: With a bare-bone netty client that just receives and sends Postgres frames (without decoding these and without all the reactive dance), we weren't able to significantly improve |
@mp911de, Thank you. Didn't see this great JMH benchmarks. I got pretty the same result. |
Closing this issue as this isn't something we can work on for now. |
so actually no way to improve performance of select query? |
Primarily, this is a gap in the Postgres driver. PGJDBC yields on localhost about ~15.000 queries per sec, the R2DBC driver ~11.000 queries/sec (measurements as of my machine). Putting Postgres into docker yields ~ 1360 queries/sec with PGJDBC and about ~1355 queries/sec (both on localhost). So inducing latency as in real-world applications narrows the gap from ~36% difference to 1% difference. Please also note that due to heavy /cc @davecramer |
thanks a lot for theses explications |
It's actually fairly difficult to get better performance than the blocking driver when testing a single connection. I don't think anyone has tried to measure concurrent bandwidth |
it should have some... to help people to choose between two way of development |
@marccollin some ? |
You don't buy into reactive programming because you want your queries to run faster. You apply reactive programming patterns to improve your application scalability and resilience. |
@davecramer concurent bandwidth |
@marccollin I"d love to see some numbers. I think it's probably not easy to test given that the backend will have some effect on it as well |
@mp911de and throughput too. reactive programming in general should slightly slow down your program when system is not pressured, if there is a noticeable difference. |
@mp911de reply to #203 (comment)
How does reactive programming relate to application scalability and resilience? Maybe you are confused with Reactive System? or joke? |
@wplong11 Reactive programming and reactive systems are related concepts. Reactive programming is a programming paradigm that is designed to allow developers to build systems that are scalable, resilient, and responsive. It is based on the idea of creating software that reacts to changes in the environment, rather than being actively controlled by the developer. Reactive systems, on the other hand, are systems that are designed and built using reactive programming principles. They are systems that are event-driven, non-blocking, and capable of handling a high volume of concurrent requests and events. Reactive systems are often characterized by their ability to scale horizontally and their use of asynchronous, message-driven communication between components. Overall, reactive programming is a way of building software, while reactive systems are systems that are built using reactive programming principles. Reactive programming can be used to build a wide variety of systems, including web applications, distributed systems, and mobile apps. Reactive systems are often used to build highly scalable and resilient systems that can handle a high volume of concurrent requests and events. Can you tell your thoughts on why reactive programming is not related to the application scalability and resilience? |
Hi,
I've compared Spring Data R2DBC with Spring Data JDBC (Postgres DB) and see that add/get/delete performance almost the same. But for the method
public Flux<User> getWithLimit(@RequestParam int limit) { return userRepository.findWithLimit(limit); }
@Query("select * from blog.user limit $1") Flux<User> findWithLimit(int limit);
the throughput two times worse.
Here
The text was updated successfully, but these errors were encountered: