Reactive SQL client and gRPC data streaming not working properly #37420
-
When testing some stuff related to another discussion (#36691), I realised that I can't get data streaming to work propertly between a SQL database and a gRPC client. I have two apps to sync data:
The problem is that I expected these two apps to streaming data from start to end :
But the actual behavior is different: the server loads all the SQL results in the heap memory so with large data it ends with a OutOfMemory error. Project to reproduce and error details: https://github.com/jdussouillez/quarkus-db-grpc-streaming I'm not a Vert.x expert, but it seems that "row streaming" is supported: https://vertx.io/docs/vertx-pg-client/java/#_cursors_and_streaming |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
/cc @alesj (grpc), @cescoffier (grpc), @tsegismont (reactive-sql-clients), @vietj (reactive-sql-clients) |
Beta Was this translation helpful? Give feedback.
-
This is the expected behavior. The If you need streaming, you need to use a cursor and understand the consequences (keeping a connection open for the lifetime of the cursor, sometimes even a transaction (it depends on the database)) |
Beta Was this translation helpful? Give feedback.
This is the expected behavior. The
getAll
call in https://github.com/jdussouillez/quarkus-db-grpc-streaming/blob/master/server/server-rpc/src/main/java/com/github/jdussouillez/server/rpc/service/ProductApiService.java#L27 does not stream, because the database protocol does NOT stream (see https://foojay.io/today/optimizing-relational-database-access/).If you need streaming, you need to use a cursor and understand the consequences (keeping a connection open for the lifetime of the cursor, sometimes even a transaction (it depends on the database))