Replies: 1 comment 3 replies
-
How long does it take to fetch all data from that API? And how much memory does that consume? It might be interesting to try and load it into a lazy collection, that will already bring down the memory usage. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is more a conceptually question to share ideas. Once I have the final solution, I'm more than happy to share it with the community. A research results that such huge exports are not very common.
I'm fetching data from an REST API, make a collection and let Laravel export store it on disk before sending the sheet via mail. This raised numerous concerns in terms of resources and performance. Of course using Laravels job queueing engine.
Conceptually I build a class for the API call that returns all (160k rows) data which runs as a job out of an event listener that calls the laravel export class
API Class (truncated)
once the data are available, laravel export shall continue to make the export on disk
Laravel Excel Class (truncated)
The actual Job Class (truncated):
The
ProcessCredentialUserRegistrationReport::class
will be called by and event over a dedicatedconnection
for long jobs with an 3h timeout setting:'retry_after' => 10800
If I filter the results down to few hundred rows it works fine but coming the 100k> it looks like the sheet is losing few thousands rows.
Eg: requesting 132k rows, getting 59k in the sheet.
I could (and maybe will) debug this behavior deeper but I'm very concerned about the strategy dealing with such missive data. Temporarily I extended the memory in the infrastructure chain (php_ini, queue container, etc...) to 3Gb which should be fine from a monitoring perspective but I believe the entire concept is miles away from ideal.
So I decided to open this discussion for sharing ideas how to deal with 100k+ using Laravel Export.
What do you think about this and what would you do differently?
Many Thanks!
Beta Was this translation helpful? Give feedback.
All reactions