Hi, I set up a next.js app to receive an hourly cron job to fetch data from an external api and save it to a separately hosted Postgres DB. I received an email that says my app crashed because it ran out of memory with the following raw log message:
Out of memory: Killed process 532 (node) total-vm:10979168kB, anon-rss:177364kB, file-rss:0kB, shmem-rss:0kB, UID:0 pgtables:3156kB oom_score_adj:0
Yes, once every hour to fetch about 300-2000 entries of data from an external api.
Not sure why the memory burst would be that high since the data fetched from the api each time is less than 1 mb (probably in the kbs).
The same data (copied) can occupy different places at the same time, in memory (both kernel and user space). Your app’s structure will also use some space in memory, possibly more than the data itself.
These OOM kills are out of our control unfortunately. We try to use as less as possible from the init that we run in each VM (it shouldn’t be more than a few MBs).