My REST API ( Spring-Boot 2.7) is supposed to fetch 20 Million Records from DB and send the response back to UI ( Angular 6) . The overall data size reaches to cross 10GB.
This results into Heap Outofmemory error. JVM Xms and XmX are set to 15GB .
Currently am fetching data from DB in batches but ultimately it has to be stored in an ArrayList , which is where JVM memory get exhausted .
Can someone tell me another approach to overcome this situation , as I can not add more memory to JVM