Parallel database calls #87
Unanswered
Narayanbhat166
asked this question in
Q&A
Replies: 1 comment
-
See the documentation: https://docs.rs/diesel-async/0.3.1/diesel_async/struct.AsyncPgConnection.html |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I have a use case where multiple tables needs to be queried ( or inserted into ). Querying them can be done independently. A simple parallel database call would look like this
where the
join!()
is from future utilsCurrently the application dependencies looks like
The async-bb8-diesel crate mentions that
Because of this, when the parallel calls are made, those many threads are created for the blocking operation ( 2 threads in this case ). Wouldn't this lead to increased memory usage, if there are 100 requests per second, then there will be 200 threads at a moment.
I also looked into pipelining which supports executing multiple independent queries in the same network call, is there anything like this supported by diesel? In the end, what I want to know is, will it actually benefit if the database call futures are run in parallel, maybe by using a different connection pooling library which supports true async. Will using diesel_async be of any help here? Any information is appreciated, Thanks!
Beta Was this translation helpful? Give feedback.
All reactions