Out of memory error when loading large dataset with webflux

99 views Asked by At

I am responsible for designing an API that must return a large amount of data (around 4,500,000 given rows for 41 fields each). We decided to use Spring Webflux and R2DBC since it is a Mariadb database. The problem we have is weblux waits for the entire result of the query before loading the data in the form of a stream, and given the size of the data to load we end up with a long wait and a "Java Heap Space" type error . It seems to me that the very principle of webflux is to send data as and when it is available, so why this behavior? Even when the sql query is of type "Select COUNT" it is the same. Does anyone have a solution for me other than pagination?

0

There are 0 answers